@supernova-studio/client 1.3.0 → 1.3.1
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.mts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +15 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -103221,6 +103221,7 @@ declare function applyActionsLocally(input: Input): {
|
|
|
103221
103221
|
pages: Page[];
|
|
103222
103222
|
groups: Group[];
|
|
103223
103223
|
approvals: ApprovalState[];
|
|
103224
|
+
pageLiveblockRoomIds: Record<string, string>;
|
|
103224
103225
|
};
|
|
103225
103226
|
type LocalExecutorConfig = {
|
|
103226
103227
|
userId: string;
|
|
@@ -103233,11 +103234,13 @@ declare class LocalDocsElementActionExecutor {
|
|
|
103233
103234
|
private readonly pages;
|
|
103234
103235
|
private readonly groups;
|
|
103235
103236
|
private readonly approvalStates;
|
|
103237
|
+
private readonly pageLiveblockRoomIds;
|
|
103236
103238
|
constructor(config: LocalExecutorConfig);
|
|
103237
103239
|
get localState(): {
|
|
103238
103240
|
pages: Page[];
|
|
103239
103241
|
groups: Group[];
|
|
103240
103242
|
approvals: ApprovalState[];
|
|
103243
|
+
pageLiveblockRoomIds: Record<string, string>;
|
|
103241
103244
|
};
|
|
103242
103245
|
applyActions(trx: DTOElementActionInput[]): void;
|
|
103243
103246
|
applyTransaction(trx: DTOElementActionInput): void;
|
package/dist/index.d.ts
CHANGED
|
@@ -103221,6 +103221,7 @@ declare function applyActionsLocally(input: Input): {
|
|
|
103221
103221
|
pages: Page[];
|
|
103222
103222
|
groups: Group[];
|
|
103223
103223
|
approvals: ApprovalState[];
|
|
103224
|
+
pageLiveblockRoomIds: Record<string, string>;
|
|
103224
103225
|
};
|
|
103225
103226
|
type LocalExecutorConfig = {
|
|
103226
103227
|
userId: string;
|
|
@@ -103233,11 +103234,13 @@ declare class LocalDocsElementActionExecutor {
|
|
|
103233
103234
|
private readonly pages;
|
|
103234
103235
|
private readonly groups;
|
|
103235
103236
|
private readonly approvalStates;
|
|
103237
|
+
private readonly pageLiveblockRoomIds;
|
|
103236
103238
|
constructor(config: LocalExecutorConfig);
|
|
103237
103239
|
get localState(): {
|
|
103238
103240
|
pages: Page[];
|
|
103239
103241
|
groups: Group[];
|
|
103240
103242
|
approvals: ApprovalState[];
|
|
103243
|
+
pageLiveblockRoomIds: Record<string, string>;
|
|
103241
103244
|
};
|
|
103242
103245
|
applyActions(trx: DTOElementActionInput[]): void;
|
|
103243
103246
|
applyTransaction(trx: DTOElementActionInput): void;
|
package/dist/index.js
CHANGED
|
@@ -13586,18 +13586,21 @@ var LocalDocsElementActionExecutor = class {
|
|
|
13586
13586
|
__publicField(this, "pages");
|
|
13587
13587
|
__publicField(this, "groups");
|
|
13588
13588
|
__publicField(this, "approvalStates");
|
|
13589
|
+
__publicField(this, "pageLiveblockRoomIds");
|
|
13589
13590
|
const { designSystemVersionId, remoteState, userId } = config;
|
|
13590
13591
|
this.userId = userId;
|
|
13591
13592
|
this.designSystemVersionId = designSystemVersionId;
|
|
13592
13593
|
this.pages = mapByUnique(remoteState.pages, (p) => p.persistentId);
|
|
13593
13594
|
this.groups = mapByUnique(remoteState.groups, (p) => p.persistentId);
|
|
13594
13595
|
this.approvalStates = mapByUnique(remoteState.approvals, (a) => a.pagePersistentId);
|
|
13596
|
+
this.pageLiveblockRoomIds = { ...remoteState.pageLiveblockRoomIds };
|
|
13595
13597
|
}
|
|
13596
13598
|
get localState() {
|
|
13597
13599
|
return {
|
|
13598
13600
|
pages: Array.from(this.pages.values()),
|
|
13599
13601
|
groups: Array.from(this.groups.values()),
|
|
13600
|
-
approvals: Array.from(this.approvalStates.values())
|
|
13602
|
+
approvals: Array.from(this.approvalStates.values()),
|
|
13603
|
+
pageLiveblockRoomIds: this.pageLiveblockRoomIds
|
|
13601
13604
|
};
|
|
13602
13605
|
}
|
|
13603
13606
|
applyActions(trx) {
|
|
@@ -13642,6 +13645,7 @@ var LocalDocsElementActionExecutor = class {
|
|
|
13642
13645
|
//
|
|
13643
13646
|
documentationPageCreate(trx) {
|
|
13644
13647
|
const { input } = trx;
|
|
13648
|
+
const { persistentId } = input;
|
|
13645
13649
|
if (this.pages.has(input.persistentId)) {
|
|
13646
13650
|
return;
|
|
13647
13651
|
}
|
|
@@ -13649,9 +13653,9 @@ var LocalDocsElementActionExecutor = class {
|
|
|
13649
13653
|
throw new Error(`Cannot create page: parent persistent id ${input.parentPersistentId} was not found`);
|
|
13650
13654
|
}
|
|
13651
13655
|
const localPage = {
|
|
13656
|
+
persistentId,
|
|
13652
13657
|
createdAt: /* @__PURE__ */ new Date(),
|
|
13653
13658
|
parentPersistentId: input.parentPersistentId,
|
|
13654
|
-
persistentId: input.persistentId,
|
|
13655
13659
|
shortPersistentId: generateShortPersistentId(),
|
|
13656
13660
|
slug: slugify(input.title),
|
|
13657
13661
|
meta: { name: input.title },
|
|
@@ -13663,7 +13667,9 @@ var LocalDocsElementActionExecutor = class {
|
|
|
13663
13667
|
sortOrder: this.calculateSortOrder(input.parentPersistentId, input.afterPersistentId),
|
|
13664
13668
|
designSystemVersionId: this.designSystemVersionId
|
|
13665
13669
|
};
|
|
13666
|
-
this.pages.set(
|
|
13670
|
+
this.pages.set(persistentId, localPage);
|
|
13671
|
+
const roomId = `${RoomType.DocumentationPage}:${this.designSystemVersionId}:${persistentId}`;
|
|
13672
|
+
this.pageLiveblockRoomIds[persistentId] = roomId;
|
|
13667
13673
|
}
|
|
13668
13674
|
documentationPageUpdate(trx) {
|
|
13669
13675
|
const { input } = trx;
|
|
@@ -13707,6 +13713,7 @@ var LocalDocsElementActionExecutor = class {
|
|
|
13707
13713
|
if (!this.pages.delete(trx.input.id)) {
|
|
13708
13714
|
throw new Error(`Cannot delete page: page id ${input.id} was not found`);
|
|
13709
13715
|
}
|
|
13716
|
+
delete this.pageLiveblockRoomIds[trx.input.id];
|
|
13710
13717
|
}
|
|
13711
13718
|
//
|
|
13712
13719
|
// Group
|
|
@@ -13962,7 +13969,7 @@ var DocsStructureRepository = class {
|
|
|
13962
13969
|
const executedTransactionIds = new Set(yState.executedTransactionIds);
|
|
13963
13970
|
const localActions = this.localActions.filter((a) => a.tId && !executedTransactionIds.has(a.tId));
|
|
13964
13971
|
this.localActions = localActions;
|
|
13965
|
-
const { pages, groups, approvals } = applyActionsLocally({
|
|
13972
|
+
const { pages, groups, approvals, pageLiveblockRoomIds } = applyActionsLocally({
|
|
13966
13973
|
userId: this.userId,
|
|
13967
13974
|
designSystemVersionId: this.designSystemVersionId,
|
|
13968
13975
|
remoteState: yState,
|
|
@@ -13970,14 +13977,16 @@ var DocsStructureRepository = class {
|
|
|
13970
13977
|
});
|
|
13971
13978
|
const hierarchy = computeDocsHierarchy(
|
|
13972
13979
|
{
|
|
13980
|
+
// Merged remote + local
|
|
13973
13981
|
pages,
|
|
13974
13982
|
groups,
|
|
13975
13983
|
approvals,
|
|
13984
|
+
pageLiveblockRoomIds,
|
|
13985
|
+
// Remote only
|
|
13976
13986
|
groupSnapshots: yState.groupSnapshots,
|
|
13977
13987
|
pageContentHashes: yState.pageContentHashes,
|
|
13978
13988
|
pageSnapshots: yState.pageSnapshots,
|
|
13979
|
-
settings: yState.settings
|
|
13980
|
-
pageLiveblockRoomIds: yState.pageLiveblockRoomIds
|
|
13989
|
+
settings: yState.settings
|
|
13981
13990
|
},
|
|
13982
13991
|
{ includeDeletedContent: true }
|
|
13983
13992
|
);
|