@supernova-studio/client 1.2.3 → 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 +22 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2070 -2054
- 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
|
@@ -131,6 +131,7 @@ var _slugify = require('@sindresorhus/slugify'); var _slugify2 = _interopRequire
|
|
|
131
131
|
|
|
132
132
|
|
|
133
133
|
|
|
134
|
+
|
|
134
135
|
|
|
135
136
|
|
|
136
137
|
var _ipcidr = require('ip-cidr'); var _ipcidr2 = _interopRequireDefault(_ipcidr);
|
|
@@ -3305,6 +3306,12 @@ var DataSourceVersion = _zod.z.object({
|
|
|
3305
3306
|
function zeroNumberByDefault2() {
|
|
3306
3307
|
return _zod.z.number().nullish().transform((v) => _nullishCoalesce(v, () => ( 0)));
|
|
3307
3308
|
}
|
|
3309
|
+
var FigmaFile = _zod.z.object({
|
|
3310
|
+
id: _zod.z.string(),
|
|
3311
|
+
name: _zod.z.string(),
|
|
3312
|
+
lastModifiedAt: _zod.z.date(),
|
|
3313
|
+
thumbnailUrl: _zod.z.string().optional()
|
|
3314
|
+
});
|
|
3308
3315
|
var ImportJobState = _zod.z.enum(["PendingInput", "Queued", "InProgress", "Failed", "Success"]);
|
|
3309
3316
|
var ImportJobOperation = _zod.z.enum(["Check", "Import"]);
|
|
3310
3317
|
var ImportJob = Entity.extend({
|
|
@@ -13579,18 +13586,21 @@ var LocalDocsElementActionExecutor = class {
|
|
|
13579
13586
|
__publicField(this, "pages");
|
|
13580
13587
|
__publicField(this, "groups");
|
|
13581
13588
|
__publicField(this, "approvalStates");
|
|
13589
|
+
__publicField(this, "pageLiveblockRoomIds");
|
|
13582
13590
|
const { designSystemVersionId, remoteState, userId } = config;
|
|
13583
13591
|
this.userId = userId;
|
|
13584
13592
|
this.designSystemVersionId = designSystemVersionId;
|
|
13585
13593
|
this.pages = mapByUnique(remoteState.pages, (p) => p.persistentId);
|
|
13586
13594
|
this.groups = mapByUnique(remoteState.groups, (p) => p.persistentId);
|
|
13587
13595
|
this.approvalStates = mapByUnique(remoteState.approvals, (a) => a.pagePersistentId);
|
|
13596
|
+
this.pageLiveblockRoomIds = { ...remoteState.pageLiveblockRoomIds };
|
|
13588
13597
|
}
|
|
13589
13598
|
get localState() {
|
|
13590
13599
|
return {
|
|
13591
13600
|
pages: Array.from(this.pages.values()),
|
|
13592
13601
|
groups: Array.from(this.groups.values()),
|
|
13593
|
-
approvals: Array.from(this.approvalStates.values())
|
|
13602
|
+
approvals: Array.from(this.approvalStates.values()),
|
|
13603
|
+
pageLiveblockRoomIds: this.pageLiveblockRoomIds
|
|
13594
13604
|
};
|
|
13595
13605
|
}
|
|
13596
13606
|
applyActions(trx) {
|
|
@@ -13635,6 +13645,7 @@ var LocalDocsElementActionExecutor = class {
|
|
|
13635
13645
|
//
|
|
13636
13646
|
documentationPageCreate(trx) {
|
|
13637
13647
|
const { input } = trx;
|
|
13648
|
+
const { persistentId } = input;
|
|
13638
13649
|
if (this.pages.has(input.persistentId)) {
|
|
13639
13650
|
return;
|
|
13640
13651
|
}
|
|
@@ -13642,9 +13653,9 @@ var LocalDocsElementActionExecutor = class {
|
|
|
13642
13653
|
throw new Error(`Cannot create page: parent persistent id ${input.parentPersistentId} was not found`);
|
|
13643
13654
|
}
|
|
13644
13655
|
const localPage = {
|
|
13656
|
+
persistentId,
|
|
13645
13657
|
createdAt: /* @__PURE__ */ new Date(),
|
|
13646
13658
|
parentPersistentId: input.parentPersistentId,
|
|
13647
|
-
persistentId: input.persistentId,
|
|
13648
13659
|
shortPersistentId: generateShortPersistentId(),
|
|
13649
13660
|
slug: slugify(input.title),
|
|
13650
13661
|
meta: { name: input.title },
|
|
@@ -13656,7 +13667,9 @@ var LocalDocsElementActionExecutor = class {
|
|
|
13656
13667
|
sortOrder: this.calculateSortOrder(input.parentPersistentId, input.afterPersistentId),
|
|
13657
13668
|
designSystemVersionId: this.designSystemVersionId
|
|
13658
13669
|
};
|
|
13659
|
-
this.pages.set(
|
|
13670
|
+
this.pages.set(persistentId, localPage);
|
|
13671
|
+
const roomId = `${RoomType.DocumentationPage}:${this.designSystemVersionId}:${persistentId}`;
|
|
13672
|
+
this.pageLiveblockRoomIds[persistentId] = roomId;
|
|
13660
13673
|
}
|
|
13661
13674
|
documentationPageUpdate(trx) {
|
|
13662
13675
|
const { input } = trx;
|
|
@@ -13700,6 +13713,7 @@ var LocalDocsElementActionExecutor = class {
|
|
|
13700
13713
|
if (!this.pages.delete(trx.input.id)) {
|
|
13701
13714
|
throw new Error(`Cannot delete page: page id ${input.id} was not found`);
|
|
13702
13715
|
}
|
|
13716
|
+
delete this.pageLiveblockRoomIds[trx.input.id];
|
|
13703
13717
|
}
|
|
13704
13718
|
//
|
|
13705
13719
|
// Group
|
|
@@ -13955,7 +13969,7 @@ var DocsStructureRepository = class {
|
|
|
13955
13969
|
const executedTransactionIds = new Set(yState.executedTransactionIds);
|
|
13956
13970
|
const localActions = this.localActions.filter((a) => a.tId && !executedTransactionIds.has(a.tId));
|
|
13957
13971
|
this.localActions = localActions;
|
|
13958
|
-
const { pages, groups, approvals } = applyActionsLocally({
|
|
13972
|
+
const { pages, groups, approvals, pageLiveblockRoomIds } = applyActionsLocally({
|
|
13959
13973
|
userId: this.userId,
|
|
13960
13974
|
designSystemVersionId: this.designSystemVersionId,
|
|
13961
13975
|
remoteState: yState,
|
|
@@ -13963,14 +13977,16 @@ var DocsStructureRepository = class {
|
|
|
13963
13977
|
});
|
|
13964
13978
|
const hierarchy = computeDocsHierarchy(
|
|
13965
13979
|
{
|
|
13980
|
+
// Merged remote + local
|
|
13966
13981
|
pages,
|
|
13967
13982
|
groups,
|
|
13968
13983
|
approvals,
|
|
13984
|
+
pageLiveblockRoomIds,
|
|
13985
|
+
// Remote only
|
|
13969
13986
|
groupSnapshots: yState.groupSnapshots,
|
|
13970
13987
|
pageContentHashes: yState.pageContentHashes,
|
|
13971
13988
|
pageSnapshots: yState.pageSnapshots,
|
|
13972
|
-
settings: yState.settings
|
|
13973
|
-
pageLiveblockRoomIds: yState.pageLiveblockRoomIds
|
|
13989
|
+
settings: yState.settings
|
|
13974
13990
|
},
|
|
13975
13991
|
{ includeDeletedContent: true }
|
|
13976
13992
|
);
|