@supernova-studio/client 1.0.0-alpha.20 → 1.0.0-alpha.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.d.mts +4544 -1370
- package/dist/index.d.ts +4544 -1370
- package/dist/index.js +231 -26
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +229 -24
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -3317,7 +3317,7 @@ var ImportJob = Entity.extend({
|
|
|
3317
3317
|
var ImportFunctionInput = z91.object({
|
|
3318
3318
|
importJobId: z91.string(),
|
|
3319
3319
|
importContextId: z91.string(),
|
|
3320
|
-
designSystemId: z91.string()
|
|
3320
|
+
designSystemId: z91.string()
|
|
3321
3321
|
});
|
|
3322
3322
|
var ImportedFigmaSourceData = z91.object({
|
|
3323
3323
|
sourceId: z91.string(),
|
|
@@ -3480,11 +3480,7 @@ var DataSourceImportModel = z97.object({
|
|
|
3480
3480
|
fileName: z97.string().optional(),
|
|
3481
3481
|
thumbnailUrl: z97.string().optional()
|
|
3482
3482
|
});
|
|
3483
|
-
var
|
|
3484
|
-
png: FigmaPngRenderImportModel,
|
|
3485
|
-
svg: FigmaSvgRenderImportModel
|
|
3486
|
-
});
|
|
3487
|
-
var FigmaFileStructureNodeImportModel = FigmaFileStructureNodeImportModelBase.extend({
|
|
3483
|
+
var FigmaFileStructureNodeImportModel = FigmaFileStructureNodeBase.extend({
|
|
3488
3484
|
children: z98.lazy(() => FigmaFileStructureNodeImportModel.array())
|
|
3489
3485
|
});
|
|
3490
3486
|
var FigmaFileStructureImportModelPart = z98.object({
|
|
@@ -3954,7 +3950,17 @@ var UserNotificationSettings = z131.object({
|
|
|
3954
3950
|
var UserOnboardingDepartment = z132.enum(["Design", "Engineering", "Product", "Brand", "Other"]);
|
|
3955
3951
|
var UserOnboardingJobLevel = z132.enum(["Executive", "Manager", "IndividualContributor", "Other"]);
|
|
3956
3952
|
var UserTheme = z132.object({
|
|
3957
|
-
preset: z132.enum([
|
|
3953
|
+
preset: z132.enum([
|
|
3954
|
+
"Custom",
|
|
3955
|
+
"Default",
|
|
3956
|
+
"HighContrast",
|
|
3957
|
+
"DefaultDark",
|
|
3958
|
+
"HighContrastDark",
|
|
3959
|
+
"SpaceBlue",
|
|
3960
|
+
"DarkGrey",
|
|
3961
|
+
"SystemPreference",
|
|
3962
|
+
"Sepia"
|
|
3963
|
+
]).optional(),
|
|
3958
3964
|
backgroundColor: z132.string().optional(),
|
|
3959
3965
|
accentColor: z132.string().optional(),
|
|
3960
3966
|
contrast: z132.number().min(16).max(100).optional(),
|
|
@@ -4337,6 +4343,15 @@ var ExportDestinationsMap = z148.object({
|
|
|
4337
4343
|
destinationGitlab: ExporterDestinationGitlab.optional(),
|
|
4338
4344
|
destinationBitbucket: ExporterDestinationBitbucket.optional()
|
|
4339
4345
|
});
|
|
4346
|
+
var ExportDestinationsMapUpdate = z148.object({
|
|
4347
|
+
webhookUrl: z148.string().nullish(),
|
|
4348
|
+
destinationSnDocs: ExporterDestinationDocs.nullish(),
|
|
4349
|
+
destinationS3: ExporterDestinationS3.nullish(),
|
|
4350
|
+
destinationGithub: ExporterDestinationGithub.nullish(),
|
|
4351
|
+
destinationAzure: ExporterDestinationAzure.nullish(),
|
|
4352
|
+
destinationGitlab: ExporterDestinationGitlab.nullish(),
|
|
4353
|
+
destinationBitbucket: ExporterDestinationBitbucket.nullish()
|
|
4354
|
+
});
|
|
4340
4355
|
var PipelineEventType = z149.enum(["OnVersionReleased", "OnHeadChanged", "OnSourceUpdated", "None"]);
|
|
4341
4356
|
var PipelineDestinationGitType = z149.enum(["Github", "Gitlab", "Bitbucket", "Azure"]);
|
|
4342
4357
|
var PipelineDestinationExtraType = z149.enum(["WebhookUrl", "S3", "Documentation"]);
|
|
@@ -4422,9 +4437,7 @@ var RestoredDocumentationPage = z152.object({
|
|
|
4422
4437
|
page: DocumentationPageV2,
|
|
4423
4438
|
pageParent: ElementGroup,
|
|
4424
4439
|
pageContent: DocumentationPageContentData,
|
|
4425
|
-
contentHash: z152.string()
|
|
4426
|
-
snapshotId: z152.string(),
|
|
4427
|
-
roomId: z152.string().optional()
|
|
4440
|
+
contentHash: z152.string()
|
|
4428
4441
|
});
|
|
4429
4442
|
var RestoredDocumentationGroup = z152.object({
|
|
4430
4443
|
group: ElementGroup,
|
|
@@ -6378,7 +6391,14 @@ var DTOGetDocumentationPageAnchorsResponse = z222.object({
|
|
|
6378
6391
|
|
|
6379
6392
|
// src/api/dto/documentation/approvals.ts
|
|
6380
6393
|
import { z as z223 } from "zod";
|
|
6381
|
-
var DTODocumentationPageApprovalState =
|
|
6394
|
+
var DTODocumentationPageApprovalState = z223.object({
|
|
6395
|
+
approvalState: DocumentationPageApprovalState,
|
|
6396
|
+
pagePersistentId: z223.string(),
|
|
6397
|
+
updatedByUserId: z223.string(),
|
|
6398
|
+
designSystemVersionId: z223.string(),
|
|
6399
|
+
updatedAt: z223.coerce.date(),
|
|
6400
|
+
createdAt: z223.coerce.date()
|
|
6401
|
+
});
|
|
6382
6402
|
var DTODocumentationGroupApprovalState = z223.object({
|
|
6383
6403
|
persistentId: z223.string(),
|
|
6384
6404
|
groupPersistentId: z223.string(),
|
|
@@ -6474,12 +6494,18 @@ var DTOCreateDocumentationPageInputV2 = z227.object({
|
|
|
6474
6494
|
afterPersistentId: z227.string().nullish()
|
|
6475
6495
|
});
|
|
6476
6496
|
var DTOUpdateDocumentationPageInputV2 = z227.object({
|
|
6477
|
-
// Identifier of the
|
|
6497
|
+
// Identifier of the page to update
|
|
6478
6498
|
id: z227.string(),
|
|
6479
6499
|
// Page properties
|
|
6480
6500
|
title: z227.string().optional(),
|
|
6481
6501
|
configuration: DTODocumentationItemConfigurationV2.partial().optional()
|
|
6482
6502
|
});
|
|
6503
|
+
var DTOUpdateDocumentationPageDocumentInputV2 = z227.object({
|
|
6504
|
+
// Identifier of the page to update
|
|
6505
|
+
id: z227.string(),
|
|
6506
|
+
// Page properties
|
|
6507
|
+
documentItems: z227.array(DocumentationPageContentItem)
|
|
6508
|
+
});
|
|
6483
6509
|
var DTOMoveDocumentationPageInputV2 = z227.object({
|
|
6484
6510
|
// Identifier of the group to update
|
|
6485
6511
|
id: z227.string(),
|
|
@@ -6958,6 +6984,10 @@ var DTODocumentationPageUpdateActionOutputV2 = z242.object({
|
|
|
6958
6984
|
type: z242.literal("DocumentationPageUpdate"),
|
|
6959
6985
|
output: SuccessPayload2
|
|
6960
6986
|
});
|
|
6987
|
+
var DTODocumentationPageUpdateDocumentActionOutputV2 = z242.object({
|
|
6988
|
+
type: z242.literal("DocumentationPageUpdateDocument"),
|
|
6989
|
+
output: SuccessPayload2
|
|
6990
|
+
});
|
|
6961
6991
|
var DTODocumentationPageMoveActionOutputV2 = z242.object({
|
|
6962
6992
|
type: z242.literal("DocumentationPageMove"),
|
|
6963
6993
|
output: SuccessPayload2
|
|
@@ -6990,6 +7020,10 @@ var DTODocumentationPageUpdateActionInputV2 = z242.object({
|
|
|
6990
7020
|
type: z242.literal("DocumentationPageUpdate"),
|
|
6991
7021
|
input: DTOUpdateDocumentationPageInputV2
|
|
6992
7022
|
});
|
|
7023
|
+
var DTODocumentationPageUpdateDocumentActionInputV2 = z242.object({
|
|
7024
|
+
type: z242.literal("DocumentationPageUpdateDocument"),
|
|
7025
|
+
input: DTOUpdateDocumentationPageDocumentInputV2
|
|
7026
|
+
});
|
|
6993
7027
|
var DTODocumentationPageMoveActionInputV2 = z242.object({
|
|
6994
7028
|
type: z242.literal("DocumentationPageMove"),
|
|
6995
7029
|
input: DTOMoveDocumentationPageInputV2
|
|
@@ -7276,6 +7310,7 @@ var DTOElementActionOutput = z254.discriminatedUnion("type", [
|
|
|
7276
7310
|
// Documentation pages
|
|
7277
7311
|
DTODocumentationPageCreateActionOutputV2,
|
|
7278
7312
|
DTODocumentationPageUpdateActionOutputV2,
|
|
7313
|
+
DTODocumentationPageUpdateDocumentActionOutputV2,
|
|
7279
7314
|
DTODocumentationPageMoveActionOutputV2,
|
|
7280
7315
|
DTODocumentationPageDuplicateActionOutputV2,
|
|
7281
7316
|
DTODocumentationPageDeleteActionOutputV2,
|
|
@@ -7300,6 +7335,7 @@ var DTOElementActionInput = z254.discriminatedUnion("type", [
|
|
|
7300
7335
|
// Documentation pages
|
|
7301
7336
|
DTODocumentationPageCreateActionInputV2,
|
|
7302
7337
|
DTODocumentationPageUpdateActionInputV2,
|
|
7338
|
+
DTODocumentationPageUpdateDocumentActionInputV2,
|
|
7303
7339
|
DTODocumentationPageMoveActionInputV2,
|
|
7304
7340
|
DTODocumentationPageDuplicateActionInputV2,
|
|
7305
7341
|
DTODocumentationPageDeleteActionInputV2,
|
|
@@ -7524,6 +7560,79 @@ function serializeQuery(query) {
|
|
|
7524
7560
|
return new URLSearchParams(queryWithStrings);
|
|
7525
7561
|
}
|
|
7526
7562
|
|
|
7563
|
+
// src/utils/redirect-validation.ts
|
|
7564
|
+
var exhaustiveInvalidUriPaths = {
|
|
7565
|
+
emptyPath: "",
|
|
7566
|
+
spacesInPath: "/invalid path/with spaces",
|
|
7567
|
+
specialCharacter1: "/path/with|invalid>characters",
|
|
7568
|
+
specialCharacter2: "/path/with<invalid*characters",
|
|
7569
|
+
specialCharacter3: "/path/{invalid}?characters",
|
|
7570
|
+
consecutiveSlashes: "/path//with///too/many/slashes",
|
|
7571
|
+
unencodedPercent: "/path/with/unencoded%percent",
|
|
7572
|
+
unencodedSpaces: "/path/with unencoded spaces",
|
|
7573
|
+
fragmentIdentifier: "/path/with#fragment",
|
|
7574
|
+
queryParameters: "/path/with?query=parameter",
|
|
7575
|
+
nullCharacter: "/path/with/\0nullcharacter",
|
|
7576
|
+
onlySlash: "/",
|
|
7577
|
+
controlCharacter: "/path/with/control\0character",
|
|
7578
|
+
extremelyLongPath: "/" + "a".repeat(2047),
|
|
7579
|
+
invalidStartCharacter: "///path/starting/with/slashes",
|
|
7580
|
+
invalidStartCharacterColon: ":/path/starting/with/colon",
|
|
7581
|
+
invalidTrailingDot: "/path/ending/with/dot.",
|
|
7582
|
+
invalidPercentEncoding1: "/path/with/%2",
|
|
7583
|
+
invalidPercentEncoding2: "/path/with/%ZZ",
|
|
7584
|
+
invalidPercentEncoding3: "/path/with/%G1",
|
|
7585
|
+
reservedCharacter1: "/path/with?<reserved>",
|
|
7586
|
+
reservedCharacter2: '/path/with/"quotes"',
|
|
7587
|
+
reservedCharacter3: "/path/with/[brackets]",
|
|
7588
|
+
reservedCharacter4: "/path/with/\\backslashes",
|
|
7589
|
+
nonAscii1: "/path/with/\u4F60\u597D",
|
|
7590
|
+
nonAscii2: "/path/with/emoji/\u{1F603}",
|
|
7591
|
+
mixedEncodingPath: "/path/%41A%42B%C3%28",
|
|
7592
|
+
directoryTraversal1: "/path/../../etc/passwd",
|
|
7593
|
+
directoryTraversal2: "/path/./././"
|
|
7594
|
+
};
|
|
7595
|
+
function isValidRedirectPath(path) {
|
|
7596
|
+
const trimmedPath = path.toLowerCase().trim();
|
|
7597
|
+
const url = "https://www.example.com" + trimmedPath;
|
|
7598
|
+
if (url.length > 2048) {
|
|
7599
|
+
return {
|
|
7600
|
+
isValid: false,
|
|
7601
|
+
reason: "TooLong"
|
|
7602
|
+
};
|
|
7603
|
+
}
|
|
7604
|
+
if (trimmedPath === "") {
|
|
7605
|
+
return {
|
|
7606
|
+
isValid: false,
|
|
7607
|
+
reason: "Empty"
|
|
7608
|
+
};
|
|
7609
|
+
}
|
|
7610
|
+
if (url === "/") {
|
|
7611
|
+
return {
|
|
7612
|
+
isValid: false,
|
|
7613
|
+
reason: "Empty"
|
|
7614
|
+
};
|
|
7615
|
+
}
|
|
7616
|
+
if (url.includes("?")) {
|
|
7617
|
+
return {
|
|
7618
|
+
isValid: false,
|
|
7619
|
+
reason: "ContainsQuery"
|
|
7620
|
+
};
|
|
7621
|
+
}
|
|
7622
|
+
if (url.includes("#")) {
|
|
7623
|
+
return {
|
|
7624
|
+
isValid: false,
|
|
7625
|
+
reason: "ContainsFragment"
|
|
7626
|
+
};
|
|
7627
|
+
}
|
|
7628
|
+
const regex = /^\/[A-Za-z0-9_-]+(\/[A-Za-z0-9_-]+)*$/;
|
|
7629
|
+
const isValid = regex.test(trimmedPath);
|
|
7630
|
+
return {
|
|
7631
|
+
isValid: regex.test(trimmedPath),
|
|
7632
|
+
reason: !isValid ? "InvalidURI" : void 0
|
|
7633
|
+
};
|
|
7634
|
+
}
|
|
7635
|
+
|
|
7527
7636
|
// src/api/endpoints/codegen/exporters.ts
|
|
7528
7637
|
var ExportersEndpoint = class {
|
|
7529
7638
|
constructor(requestExecutor) {
|
|
@@ -8120,6 +8229,43 @@ var DesignSystemSourcesEndpoint = class {
|
|
|
8120
8229
|
}
|
|
8121
8230
|
};
|
|
8122
8231
|
|
|
8232
|
+
// src/api/endpoints/design-system/redirects.ts
|
|
8233
|
+
var DesignSystemPageRedirectsEndpoint = class {
|
|
8234
|
+
constructor(requestExecutor) {
|
|
8235
|
+
this.requestExecutor = requestExecutor;
|
|
8236
|
+
}
|
|
8237
|
+
create(dsId, body) {
|
|
8238
|
+
return this.requestExecutor.json(`/design-systems/${dsId}/documentation/redirects`, DTOPageRedirectResponse, {
|
|
8239
|
+
body,
|
|
8240
|
+
method: "POST"
|
|
8241
|
+
});
|
|
8242
|
+
}
|
|
8243
|
+
list(dsId) {
|
|
8244
|
+
return this.requestExecutor.json(`/design-systems/${dsId}/documentation/redirects`, DTOPageRedirectListResponse, {
|
|
8245
|
+
method: "GET"
|
|
8246
|
+
});
|
|
8247
|
+
}
|
|
8248
|
+
update(dsId, redirectId, body) {
|
|
8249
|
+
return this.requestExecutor.json(
|
|
8250
|
+
`/design-systems/${dsId}/documentation/redirects/${redirectId}`,
|
|
8251
|
+
DTOPageRedirectResponse,
|
|
8252
|
+
{
|
|
8253
|
+
body,
|
|
8254
|
+
method: "PUT"
|
|
8255
|
+
}
|
|
8256
|
+
);
|
|
8257
|
+
}
|
|
8258
|
+
delete(dsId, redirectId) {
|
|
8259
|
+
return this.requestExecutor.json(
|
|
8260
|
+
`/design-systems/${dsId}/documentation/redirects/${redirectId}`,
|
|
8261
|
+
DTOPageRedirectDeleteResponse,
|
|
8262
|
+
{
|
|
8263
|
+
method: "DELETE"
|
|
8264
|
+
}
|
|
8265
|
+
);
|
|
8266
|
+
}
|
|
8267
|
+
};
|
|
8268
|
+
|
|
8123
8269
|
// src/api/endpoints/design-system/design-systems.ts
|
|
8124
8270
|
var DesignSystemsEndpoint = class {
|
|
8125
8271
|
constructor(requestExecutor) {
|
|
@@ -8129,11 +8275,13 @@ var DesignSystemsEndpoint = class {
|
|
|
8129
8275
|
__publicField(this, "bff");
|
|
8130
8276
|
__publicField(this, "sources");
|
|
8131
8277
|
__publicField(this, "contacts");
|
|
8278
|
+
__publicField(this, "redirects");
|
|
8132
8279
|
this.members = new DesignSystemMembersEndpoint(requestExecutor);
|
|
8133
8280
|
this.versions = new DesignSystemVersionsEndpoint(requestExecutor);
|
|
8134
8281
|
this.bff = new DesignSystemBffEndpoint(requestExecutor);
|
|
8135
8282
|
this.sources = new DesignSystemSourcesEndpoint(requestExecutor);
|
|
8136
8283
|
this.contacts = new DesignSystemContactsEndpoint(requestExecutor);
|
|
8284
|
+
this.redirects = new DesignSystemPageRedirectsEndpoint(requestExecutor);
|
|
8137
8285
|
}
|
|
8138
8286
|
create(body) {
|
|
8139
8287
|
return this.requestExecutor.json("/design-systems", DTODesignSystemResponse, { method: "POST", body });
|
|
@@ -13362,27 +13510,33 @@ var BackendVersionRoomYDoc = class {
|
|
|
13362
13510
|
};
|
|
13363
13511
|
|
|
13364
13512
|
// src/sync/local-action-executor.ts
|
|
13365
|
-
function applyActionsLocally(
|
|
13366
|
-
const actionExecutor = new LocalDocsElementActionExecutor(
|
|
13367
|
-
actionExecutor.
|
|
13513
|
+
function applyActionsLocally(input) {
|
|
13514
|
+
const actionExecutor = new LocalDocsElementActionExecutor(input);
|
|
13515
|
+
actionExecutor.applyActions(input.actions);
|
|
13368
13516
|
return actionExecutor.localState;
|
|
13369
13517
|
}
|
|
13370
13518
|
var LocalDocsElementActionExecutor = class {
|
|
13371
|
-
constructor(
|
|
13519
|
+
constructor(config) {
|
|
13520
|
+
__publicField(this, "userId");
|
|
13372
13521
|
__publicField(this, "designSystemVersionId");
|
|
13373
13522
|
__publicField(this, "pages");
|
|
13374
13523
|
__publicField(this, "groups");
|
|
13524
|
+
__publicField(this, "approvalStates");
|
|
13525
|
+
const { designSystemVersionId, remoteState, userId } = config;
|
|
13526
|
+
this.userId = userId;
|
|
13375
13527
|
this.designSystemVersionId = designSystemVersionId;
|
|
13376
13528
|
this.pages = mapByUnique(remoteState.pages, (p) => p.persistentId);
|
|
13377
13529
|
this.groups = mapByUnique(remoteState.groups, (p) => p.persistentId);
|
|
13530
|
+
this.approvalStates = mapByUnique(remoteState.approvals, (a) => a.pagePersistentId);
|
|
13378
13531
|
}
|
|
13379
13532
|
get localState() {
|
|
13380
13533
|
return {
|
|
13381
13534
|
pages: Array.from(this.pages.values()),
|
|
13382
|
-
groups: Array.from(this.groups.values())
|
|
13535
|
+
groups: Array.from(this.groups.values()),
|
|
13536
|
+
approvals: Array.from(this.approvalStates.values())
|
|
13383
13537
|
};
|
|
13384
13538
|
}
|
|
13385
|
-
|
|
13539
|
+
applyActions(trx) {
|
|
13386
13540
|
trx.forEach((trx2) => this.applyTransaction(trx2));
|
|
13387
13541
|
}
|
|
13388
13542
|
applyTransaction(trx) {
|
|
@@ -13407,6 +13561,7 @@ var LocalDocsElementActionExecutor = class {
|
|
|
13407
13561
|
case "DocumentationPageDelete":
|
|
13408
13562
|
return this.documentationPageDelete(trx);
|
|
13409
13563
|
case "DocumentationPageApprovalStateChange":
|
|
13564
|
+
return this.documentationApprovalStateUpdate(trx);
|
|
13410
13565
|
case "DocumentationPageDuplicate":
|
|
13411
13566
|
case "DocumentationPageRestore":
|
|
13412
13567
|
throw new Error(`Transaction type ${trx.type} is not yet implemented`);
|
|
@@ -13561,6 +13716,25 @@ var LocalDocsElementActionExecutor = class {
|
|
|
13561
13716
|
}
|
|
13562
13717
|
}
|
|
13563
13718
|
//
|
|
13719
|
+
// Approval states
|
|
13720
|
+
//
|
|
13721
|
+
documentationApprovalStateUpdate(trx) {
|
|
13722
|
+
const { input } = trx;
|
|
13723
|
+
const existingApproval = this.approvalStates.get(input.persistentId);
|
|
13724
|
+
if (input.approvalState) {
|
|
13725
|
+
this.approvalStates.set(input.persistentId, {
|
|
13726
|
+
approvalState: input.approvalState,
|
|
13727
|
+
createdAt: existingApproval?.createdAt ?? /* @__PURE__ */ new Date(),
|
|
13728
|
+
designSystemVersionId: this.designSystemVersionId,
|
|
13729
|
+
pagePersistentId: input.persistentId,
|
|
13730
|
+
updatedAt: /* @__PURE__ */ new Date(),
|
|
13731
|
+
updatedByUserId: this.userId
|
|
13732
|
+
});
|
|
13733
|
+
} else {
|
|
13734
|
+
this.approvalStates.delete(input.persistentId);
|
|
13735
|
+
}
|
|
13736
|
+
}
|
|
13737
|
+
//
|
|
13564
13738
|
// Utils
|
|
13565
13739
|
//
|
|
13566
13740
|
calculateSortOrder(parentPersistentId, afterPersistentId) {
|
|
@@ -13589,6 +13763,7 @@ var LocalDocsElementActionExecutor = class {
|
|
|
13589
13763
|
// src/sync/docs-structure-repo.ts
|
|
13590
13764
|
var DocsStructureRepository = class {
|
|
13591
13765
|
constructor(config) {
|
|
13766
|
+
__publicField(this, "userId");
|
|
13592
13767
|
__publicField(this, "designSystemVersionId");
|
|
13593
13768
|
__publicField(this, "yDoc");
|
|
13594
13769
|
__publicField(this, "yObserver");
|
|
@@ -13599,14 +13774,18 @@ var DocsStructureRepository = class {
|
|
|
13599
13774
|
__publicField(this, "actionQueue");
|
|
13600
13775
|
__publicField(this, "hierarchyObservers", /* @__PURE__ */ new Set());
|
|
13601
13776
|
__publicField(this, "settingsObservers", /* @__PURE__ */ new Set());
|
|
13777
|
+
__publicField(this, "errorObservers", /* @__PURE__ */ new Set());
|
|
13602
13778
|
__publicField(this, "initCallbacks", /* @__PURE__ */ new Set());
|
|
13603
13779
|
__publicField(this, "transactionIdGenerator");
|
|
13780
|
+
__publicField(this, "transactionExecutor");
|
|
13781
|
+
this.userId = config.userId;
|
|
13604
13782
|
this.designSystemVersionId = config.designSystemVersionId;
|
|
13605
13783
|
this.yDoc = config.yDoc;
|
|
13606
13784
|
this.yObserver = this.yDoc.on("update", () => this.onYUpdate());
|
|
13607
13785
|
this.onYUpdate();
|
|
13608
|
-
this.
|
|
13786
|
+
this.transactionExecutor = config.transactionExecutor;
|
|
13609
13787
|
this.transactionIdGenerator = config.transactionIdGenerator;
|
|
13788
|
+
this.actionQueue = new TransactionQueue((action) => this.executeInternalAction(action));
|
|
13610
13789
|
}
|
|
13611
13790
|
//
|
|
13612
13791
|
// Lifecycle
|
|
@@ -13637,9 +13816,17 @@ var DocsStructureRepository = class {
|
|
|
13637
13816
|
removeSettingsObserver(observer) {
|
|
13638
13817
|
this.settingsObservers.delete(observer);
|
|
13639
13818
|
}
|
|
13819
|
+
addErrorObserver(observer) {
|
|
13820
|
+
this.errorObservers.add(observer);
|
|
13821
|
+
}
|
|
13822
|
+
removeErrorObserver(observer) {
|
|
13823
|
+
this.errorObservers.delete(observer);
|
|
13824
|
+
}
|
|
13640
13825
|
dispose() {
|
|
13641
13826
|
this.yDoc.off("update", this.yObserver);
|
|
13642
13827
|
this.hierarchyObservers.clear();
|
|
13828
|
+
this.settingsObservers.clear();
|
|
13829
|
+
this.errorObservers.clear();
|
|
13643
13830
|
this.actionQueue.clear();
|
|
13644
13831
|
}
|
|
13645
13832
|
//
|
|
@@ -13654,14 +13841,14 @@ var DocsStructureRepository = class {
|
|
|
13654
13841
|
//
|
|
13655
13842
|
// Actions
|
|
13656
13843
|
//
|
|
13657
|
-
executeAction(action) {
|
|
13844
|
+
executeAction(action, metadata) {
|
|
13658
13845
|
void this.executeActionPromise(action);
|
|
13659
13846
|
}
|
|
13660
|
-
executeActionPromise(action) {
|
|
13847
|
+
executeActionPromise(action, metadata) {
|
|
13661
13848
|
const fullAction = { ...action, tId: this.transactionIdGenerator() };
|
|
13662
13849
|
this.localActions.push(fullAction);
|
|
13663
13850
|
this.refreshHierarchy();
|
|
13664
|
-
return this.actionQueue.enqueue(fullAction);
|
|
13851
|
+
return this.actionQueue.enqueue({ action: fullAction, metadata });
|
|
13665
13852
|
}
|
|
13666
13853
|
notifyPageContentUpdated(pagePersistentId, content, definitions) {
|
|
13667
13854
|
const pageContentHash = generatePageContentHash(content, definitions);
|
|
@@ -13669,6 +13856,13 @@ var DocsStructureRepository = class {
|
|
|
13669
13856
|
[pagePersistentId]: pageContentHash
|
|
13670
13857
|
});
|
|
13671
13858
|
}
|
|
13859
|
+
async executeInternalAction(action) {
|
|
13860
|
+
try {
|
|
13861
|
+
return this.transactionExecutor(action.action);
|
|
13862
|
+
} catch (e) {
|
|
13863
|
+
this.errorObservers.forEach((o) => o(e, action.metadata));
|
|
13864
|
+
}
|
|
13865
|
+
}
|
|
13672
13866
|
//
|
|
13673
13867
|
// Reactions
|
|
13674
13868
|
//
|
|
@@ -13704,12 +13898,17 @@ var DocsStructureRepository = class {
|
|
|
13704
13898
|
const executedTransactionIds = new Set(yState.executedTransactionIds);
|
|
13705
13899
|
const localActions = this.localActions.filter((a) => a.tId && !executedTransactionIds.has(a.tId));
|
|
13706
13900
|
this.localActions = localActions;
|
|
13707
|
-
const { pages, groups } = applyActionsLocally(
|
|
13901
|
+
const { pages, groups, approvals } = applyActionsLocally({
|
|
13902
|
+
userId: this.userId,
|
|
13903
|
+
designSystemVersionId: this.designSystemVersionId,
|
|
13904
|
+
remoteState: yState,
|
|
13905
|
+
actions: localActions
|
|
13906
|
+
});
|
|
13708
13907
|
const hierarchy = computeDocsHierarchy(
|
|
13709
13908
|
{
|
|
13710
13909
|
pages,
|
|
13711
13910
|
groups,
|
|
13712
|
-
approvals
|
|
13911
|
+
approvals,
|
|
13713
13912
|
groupSnapshots: yState.groupSnapshots,
|
|
13714
13913
|
pageContentHashes: yState.pageContentHashes,
|
|
13715
13914
|
pageSnapshots: yState.pageSnapshots,
|
|
@@ -13876,6 +14075,8 @@ export {
|
|
|
13876
14075
|
DTODocumentationPageSnapshot,
|
|
13877
14076
|
DTODocumentationPageUpdateActionInputV2,
|
|
13878
14077
|
DTODocumentationPageUpdateActionOutputV2,
|
|
14078
|
+
DTODocumentationPageUpdateDocumentActionInputV2,
|
|
14079
|
+
DTODocumentationPageUpdateDocumentActionOutputV2,
|
|
13879
14080
|
DTODocumentationPageV2,
|
|
13880
14081
|
DTODocumentationPublishMetadata,
|
|
13881
14082
|
DTODocumentationPublishTypeQueryParams,
|
|
@@ -14028,6 +14229,7 @@ export {
|
|
|
14028
14229
|
DTOTokenCollectionsListReponse,
|
|
14029
14230
|
DTOTransferOwnershipPayload,
|
|
14030
14231
|
DTOUpdateDocumentationGroupInput,
|
|
14232
|
+
DTOUpdateDocumentationPageDocumentInputV2,
|
|
14031
14233
|
DTOUpdateDocumentationPageInputV2,
|
|
14032
14234
|
DTOUpdateUserNotificationSettingsPayload,
|
|
14033
14235
|
DTOUpdateVersionInput,
|
|
@@ -14064,6 +14266,7 @@ export {
|
|
|
14064
14266
|
DesignSystemComponentEndpoint,
|
|
14065
14267
|
DesignSystemContactsEndpoint,
|
|
14066
14268
|
DesignSystemMembersEndpoint,
|
|
14269
|
+
DesignSystemPageRedirectsEndpoint,
|
|
14067
14270
|
DesignSystemSourcesEndpoint,
|
|
14068
14271
|
DesignSystemVersionsEndpoint,
|
|
14069
14272
|
DesignSystemsEndpoint,
|
|
@@ -14136,6 +14339,7 @@ export {
|
|
|
14136
14339
|
elementGroupsToDocumentationGroupFixedConfigurationDTOV1,
|
|
14137
14340
|
elementGroupsToDocumentationGroupFixedConfigurationDTOV2,
|
|
14138
14341
|
elementGroupsToDocumentationGroupStructureDTOV1,
|
|
14342
|
+
exhaustiveInvalidUriPaths,
|
|
14139
14343
|
generateHash,
|
|
14140
14344
|
generatePageContentHash,
|
|
14141
14345
|
getDtoDefaultItemConfigurationV1,
|
|
@@ -14148,6 +14352,7 @@ export {
|
|
|
14148
14352
|
innerEditorProsemirrorSchema,
|
|
14149
14353
|
integrationCredentialToDto,
|
|
14150
14354
|
integrationToDto,
|
|
14355
|
+
isValidRedirectPath,
|
|
14151
14356
|
itemConfigurationToYjs,
|
|
14152
14357
|
mainEditorProsemirrorSchema,
|
|
14153
14358
|
pageToProsemirrorDoc,
|