@supernova-studio/client 0.58.21 → 0.58.22

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.mjs CHANGED
@@ -838,6 +838,12 @@ function areShallowObjectsEqual(lhs, rhs) {
838
838
  }
839
839
  return true;
840
840
  }
841
+ function recordToMap(record) {
842
+ const map = /* @__PURE__ */ new Map();
843
+ for (const [k, v] of Object.entries(record))
844
+ map.set(k, v);
845
+ return map;
846
+ }
841
847
  var ContentLoadInstruction = z34.object({
842
848
  from: z34.string(),
843
849
  to: z34.string(),
@@ -5048,25 +5054,26 @@ function documentationPageToDTOV1(page, pagePathMap) {
5048
5054
  }
5049
5055
 
5050
5056
  // src/api/conversion/documentation/documentation-page-v2-to-dto.ts
5051
- function documentationPageToDTOV2(page, groups, routingVersion) {
5057
+ function documentationPageToDTOV2(page, groups, routingVersion, pageLiveblocksRoomIdMap) {
5052
5058
  const pathsMap = buildDocPagePublishPaths(groups, [page], routingVersion);
5053
- return _documentationPageToDTOV2(page, pathsMap);
5059
+ return _documentationPageToDTOV2(page, pathsMap, pageLiveblocksRoomIdMap);
5054
5060
  }
5055
- function documentationPagesToDTOV2(pages, groups, routingVersion) {
5061
+ function documentationPagesToDTOV2(pages, groups, routingVersion, pageLiveblocksRoomIdMap) {
5056
5062
  const pathsMap = buildDocPagePublishPaths(groups, pages, routingVersion);
5057
- return pages.map((page) => _documentationPageToDTOV2(page, pathsMap));
5063
+ return pages.map((page) => _documentationPageToDTOV2(page, pathsMap, pageLiveblocksRoomIdMap));
5058
5064
  }
5059
- function documentationPagesFixedConfigurationToDTOV2(pages, groups, routingVersion) {
5065
+ function documentationPagesFixedConfigurationToDTOV2(pages, groups, routingVersion, pageLiveblocksRoomIdMap) {
5060
5066
  const pathsMap = buildDocPagePublishPaths(groups, pages, routingVersion);
5061
5067
  const { pages: fixedPages } = applyPrivacyConfigurationToNestedItems(pages, groups, getDtoDefaultItemConfigurationV2);
5062
- return fixedPages.map((page) => _documentationPageToDTOV2(page, pathsMap));
5068
+ return fixedPages.map((page) => _documentationPageToDTOV2(page, pathsMap, pageLiveblocksRoomIdMap));
5063
5069
  }
5064
- function _documentationPageToDTOV2(page, pagePathMap) {
5070
+ function _documentationPageToDTOV2(page, pagePathMap, pageLiveblocksRoomIdMap) {
5065
5071
  let path = pagePathMap.get(page.persistentId);
5066
5072
  if (!path)
5067
5073
  throw new Error(`Path for page ${page.id} was not calculated`);
5068
5074
  if (path.startsWith("/"))
5069
5075
  path = path.substring(1);
5076
+ const liveblocksRoomId = pageLiveblocksRoomIdMap.get(page.persistentId);
5070
5077
  return {
5071
5078
  id: page.id,
5072
5079
  designSystemVersionId: page.designSystemVersionId,
@@ -5079,7 +5086,8 @@ function _documentationPageToDTOV2(page, pagePathMap) {
5079
5086
  createdAt: page.createdAt,
5080
5087
  updatedAt: page.updatedAt,
5081
5088
  path,
5082
- type: "Page"
5089
+ type: "Page",
5090
+ ...liveblocksRoomId && { liveblocksRoomId }
5083
5091
  };
5084
5092
  }
5085
5093
 
@@ -6271,6 +6279,8 @@ var DTODocumentationPageV2 = z222.object({
6271
6279
  publishMetadata: DTODocumentationPublishMetadata.optional(),
6272
6280
  /** Defines the approval state of the documentation page */
6273
6281
  approvalState: DTODocumentationPageApprovalState.optional(),
6282
+ /** Id of the page document room */
6283
+ liveblocksRoomId: z222.string().optional(),
6274
6284
  // Backward compatibility
6275
6285
  type: z222.literal("Page")
6276
6286
  });
@@ -8268,6 +8278,18 @@ var VersionRoomBaseYDoc = class {
8268
8278
  });
8269
8279
  return result;
8270
8280
  }
8281
+ getDocumentationPageLiveblocksRoomIds() {
8282
+ const map = this.documentationPageLiveblocksRoomIdsYMap;
8283
+ const result = {};
8284
+ map.forEach((hash2, key) => {
8285
+ if (typeof hash2 === "string")
8286
+ result[key] = hash2;
8287
+ });
8288
+ return result;
8289
+ }
8290
+ get documentationPageLiveblocksRoomIdsYMap() {
8291
+ return this.yDoc.getMap("documentationPageLiveblocksRoomIds");
8292
+ }
8271
8293
  updateDocumentationPageContentHashes(hashes) {
8272
8294
  const map = this.documentationPageContentHashesYMap;
8273
8295
  Object.entries(hashes).forEach(([key, hash2]) => map.set(key, hash2));
@@ -8375,12 +8397,13 @@ var FrontendVersionRoomYDoc = class {
8375
8397
  const groups = doc.getGroups();
8376
8398
  const pageSnapshots = doc.getPageSnapshots();
8377
8399
  const groupSnapshots = doc.getGroupSnapshots();
8400
+ const liveblocksRoomIds = recordToMap(doc.getDocumentationPageLiveblocksRoomIds());
8378
8401
  if (includeDeletedContent) {
8379
8402
  pages.push(...this.getDeletedPages(pages, pageSnapshots));
8380
8403
  groups.push(...this.getDeletedGroups(groups, groupSnapshots));
8381
8404
  }
8382
8405
  const settings = doc.getDocumentationInternalSettings();
8383
- const pageDTOs = documentationPagesToDTOV2(pages, groups, settings.routingVersion);
8406
+ const pageDTOs = documentationPagesToDTOV2(pages, groups, settings.routingVersion, liveblocksRoomIds);
8384
8407
  const groupDTOs = elementGroupsToDocumentationGroupDTOV2(groups, pages);
8385
8408
  if (!settings.isDraftFeatureAdopted) {
8386
8409
  return {