@supernova-studio/client 1.52.2 → 1.52.3

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
@@ -9312,6 +9312,182 @@ import z312 from "zod";
9312
9312
  // src/api/dto/forge/project-member.ts
9313
9313
  import { z as z311 } from "zod";
9314
9314
 
9315
+ // src/utils/figma.ts
9316
+ var figmaFileIdRegex = /^[0-9a-zA-Z]{22,128}$/;
9317
+ var nodeIdRegex = /^\d+-\d+$/;
9318
+ var nodeTypeRegex = /^[0-9a-zA-Z]^/;
9319
+ var ParsedFigmaFileURLError = /* @__PURE__ */ ((ParsedFigmaFileURLError2) => {
9320
+ ParsedFigmaFileURLError2["InvalidUrl"] = "InvalidUrl";
9321
+ ParsedFigmaFileURLError2["InvalidFigmaFileId"] = "InvalidFigmaFileId";
9322
+ return ParsedFigmaFileURLError2;
9323
+ })(ParsedFigmaFileURLError || {});
9324
+ var FigmaUtils = {
9325
+ tryParseFigmaFileURL(urlString) {
9326
+ if (!URL.canParse(urlString)) {
9327
+ return { status: "Error", error: "InvalidUrl" /* InvalidUrl */ };
9328
+ }
9329
+ const url = new URL(urlString);
9330
+ if (!url.hostname.endsWith("figma.com")) {
9331
+ return { status: "Error", error: "InvalidUrl" /* InvalidUrl */ };
9332
+ }
9333
+ const pathSegments = url.pathname.split("/");
9334
+ if (pathSegments[1] !== "design" && pathSegments[1] !== "file") {
9335
+ return { status: "Error", error: "InvalidUrl" /* InvalidUrl */ };
9336
+ }
9337
+ const fileId = pathSegments[2];
9338
+ if (!fileId || !fileId.match(figmaFileIdRegex)) {
9339
+ return { status: "Error", error: "InvalidFigmaFileId" /* InvalidFigmaFileId */ };
9340
+ }
9341
+ let fileName = null;
9342
+ const rawFileName = pathSegments[3];
9343
+ if (rawFileName) {
9344
+ fileName = rawFileName.replaceAll("-", " ");
9345
+ }
9346
+ let nodeId = null;
9347
+ const nodeIdRaw = url.searchParams.get("node-id");
9348
+ if (nodeIdRaw && nodeIdRaw.match(nodeIdRegex)) {
9349
+ nodeId = nodeIdRaw.replace("-", ":");
9350
+ }
9351
+ let nodeType = null;
9352
+ const nodeTypeRaw = url.searchParams.get("node-type");
9353
+ if (nodeTypeRaw && nodeTypeRaw.match(nodeTypeRegex)) {
9354
+ nodeType = nodeTypeRaw;
9355
+ }
9356
+ return { status: "Success", fileId, fileName, nodeId, nodeType };
9357
+ }
9358
+ };
9359
+
9360
+ // src/utils/hash.ts
9361
+ function hash(input) {
9362
+ return farmhash(input).toString(16);
9363
+ }
9364
+ function farmhash(input) {
9365
+ const seed = 2654435769;
9366
+ let hash2 = seed;
9367
+ for (let i = 0; i < input.length; i++) {
9368
+ const charCode = input.charCodeAt(i);
9369
+ hash2 ^= charCode;
9370
+ hash2 = Math.imul(hash2, 1540483477);
9371
+ hash2 ^= hash2 >>> 15;
9372
+ }
9373
+ hash2 = Math.imul(hash2, 1540483477);
9374
+ hash2 ^= hash2 >>> 13;
9375
+ hash2 = Math.imul(hash2, 1540483477);
9376
+ hash2 ^= hash2 >>> 15;
9377
+ return hash2 >>> 0;
9378
+ }
9379
+ function prepareObject(obj) {
9380
+ if (obj === null || typeof obj !== "object") {
9381
+ return obj;
9382
+ }
9383
+ if (Array.isArray(obj)) {
9384
+ return obj.map(prepareObject);
9385
+ }
9386
+ const sortedObj = {};
9387
+ for (const key of Object.keys(obj).sort()) {
9388
+ if (obj[key] === null || obj[key] === void 0) {
9389
+ continue;
9390
+ }
9391
+ sortedObj[key] = prepareObject(obj[key]);
9392
+ }
9393
+ return sortedObj;
9394
+ }
9395
+ function generateHash(input, debug = false) {
9396
+ if (typeof input === "object") {
9397
+ const sanitized = JSON.stringify(prepareObject(input));
9398
+ if (debug) {
9399
+ console.log("Hashing sanitized string:");
9400
+ console.log(sanitized);
9401
+ }
9402
+ return hash(sanitized);
9403
+ } else {
9404
+ try {
9405
+ const obj = JSON.parse(input);
9406
+ const sanitized = JSON.stringify(prepareObject(obj));
9407
+ if (debug) {
9408
+ console.log("Hashing sanitized string:");
9409
+ console.log(sanitized);
9410
+ }
9411
+ return hash(sanitized);
9412
+ } catch {
9413
+ return hash(input);
9414
+ }
9415
+ }
9416
+ }
9417
+
9418
+ // src/utils/redirect-validation.ts
9419
+ var exhaustiveInvalidUriPaths = {
9420
+ emptyPath: "",
9421
+ spacesInPath: "/invalid path/with spaces",
9422
+ specialCharacter1: "/path/with|invalid>characters",
9423
+ specialCharacter2: "/path/with<invalid*characters",
9424
+ specialCharacter3: "/path/{invalid}?characters",
9425
+ consecutiveSlashes: "/path//with///too/many/slashes",
9426
+ unencodedPercent: "/path/with/unencoded%percent",
9427
+ unencodedSpaces: "/path/with unencoded spaces",
9428
+ fragmentIdentifier: "/path/with#fragment",
9429
+ queryParameters: "/path/with?query=parameter",
9430
+ nullCharacter: "/path/with/\0nullcharacter",
9431
+ onlySlash: "/",
9432
+ controlCharacter: "/path/with/control\0character",
9433
+ extremelyLongPath: "/" + "a".repeat(2047),
9434
+ invalidStartCharacter: "///path/starting/with/slashes",
9435
+ invalidStartCharacterColon: ":/path/starting/with/colon",
9436
+ invalidTrailingDot: "/path/ending/with/dot.",
9437
+ invalidPercentEncoding1: "/path/with/%2",
9438
+ invalidPercentEncoding2: "/path/with/%ZZ",
9439
+ invalidPercentEncoding3: "/path/with/%G1",
9440
+ reservedCharacter1: "/path/with?<reserved>",
9441
+ reservedCharacter2: '/path/with/"quotes"',
9442
+ reservedCharacter3: "/path/with/[brackets]",
9443
+ reservedCharacter4: "/path/with/\\backslashes",
9444
+ nonAscii1: "/path/with/\u4F60\u597D",
9445
+ nonAscii2: "/path/with/emoji/\u{1F603}",
9446
+ mixedEncodingPath: "/path/%41A%42B%C3%28",
9447
+ directoryTraversal1: "/path/../../etc/passwd",
9448
+ directoryTraversal2: "/path/./././"
9449
+ };
9450
+ function isValidRedirectPath(path) {
9451
+ const trimmedPath = path.toLowerCase().trim();
9452
+ const url = "https://www.example.com" + trimmedPath;
9453
+ if (url.length > 2048) {
9454
+ return {
9455
+ isValid: false,
9456
+ reason: "TooLong"
9457
+ };
9458
+ }
9459
+ if (trimmedPath === "") {
9460
+ return {
9461
+ isValid: false,
9462
+ reason: "Empty"
9463
+ };
9464
+ }
9465
+ if (url === "/") {
9466
+ return {
9467
+ isValid: false,
9468
+ reason: "Empty"
9469
+ };
9470
+ }
9471
+ if (url.includes("?")) {
9472
+ return {
9473
+ isValid: false,
9474
+ reason: "ContainsQuery"
9475
+ };
9476
+ }
9477
+ if (url.includes("#")) {
9478
+ return {
9479
+ isValid: false,
9480
+ reason: "ContainsFragment"
9481
+ };
9482
+ }
9483
+ const regex = /^\/[A-Za-z0-9_-]+(\/[A-Za-z0-9_-]+)*$/;
9484
+ const isValid = regex.test(trimmedPath);
9485
+ return {
9486
+ isValid: regex.test(trimmedPath),
9487
+ reason: !isValid ? "InvalidURI" : void 0
9488
+ };
9489
+ }
9490
+
9315
9491
  // src/api/dto/forge/project-invitation.ts
9316
9492
  import { z as z310 } from "zod";
9317
9493
  var DTOForgeProjectInvitation = ForgeProjectInvitation;
@@ -9355,7 +9531,7 @@ var DTORemoveForgeProjectMember = DTOForgeProjectMember.pick({
9355
9531
  userId: true
9356
9532
  });
9357
9533
  var DTOForgeProjectMemberListQuery = z311.object({
9358
- includeImplicitMembers: z311.boolean().optional()
9534
+ includeImplicitMembers: zodQueryBoolean().optional()
9359
9535
  });
9360
9536
  var DTOForgeProjectMembersListResponse = z311.object({
9361
9537
  members: z311.array(DTOForgeProjectMember),
@@ -10914,145 +11090,197 @@ var DTOMCPStreamResponse = z340.object({
10914
11090
  stream: DTOMCPStream
10915
11091
  });
10916
11092
 
10917
- // src/api/dto/portal/portal-settings.ts
11093
+ // src/api/dto/notifications/notifications.ts
10918
11094
  import { z as z341 } from "zod";
11095
+ var DTONotificationChatMentionPayload = z341.object({
11096
+ messageAuthorId: z341.string(),
11097
+ messageText: z341.string(),
11098
+ messageId: z341.string(),
11099
+ parentMessageId: z341.string().optional(),
11100
+ workspaceId: z341.string(),
11101
+ projectId: z341.string(),
11102
+ subjectType: z341.string(),
11103
+ threadSubjectId: z341.string(),
11104
+ subjectName: z341.string()
11105
+ });
11106
+ var DTONotificationProjectInvitationPayload = z341.object({
11107
+ workspaceId: z341.string(),
11108
+ projectId: z341.string(),
11109
+ projectTitle: z341.string(),
11110
+ invitedByUserId: z341.string(),
11111
+ invitationRole: z341.string()
11112
+ });
11113
+ var DTONotificationProjectDocumentCommentPayload = z341.object({
11114
+ documentId: z341.string(),
11115
+ entityTitle: z341.string(),
11116
+ projectId: z341.string(),
11117
+ workspaceId: z341.string(),
11118
+ threadId: z341.string(),
11119
+ commentId: z341.string(),
11120
+ commentCreatedAt: z341.string(),
11121
+ commentAuthorId: z341.string(),
11122
+ commentBody: z341.string()
11123
+ });
11124
+ var DTONotificationBase = z341.object({
11125
+ userId: z341.string(),
11126
+ subjectId: z341.string(),
11127
+ roomId: z341.string().optional(),
11128
+ workspaceId: z341.string()
11129
+ });
11130
+ var DTONotificationCreateInput = z341.discriminatedUnion("type", [
11131
+ z341.object({
11132
+ type: z341.literal(DTONotificationType.enum.ChatMention),
11133
+ activityData: DTONotificationChatMentionPayload
11134
+ }),
11135
+ z341.object({
11136
+ type: z341.literal(DTONotificationType.enum.ProjectInvitation),
11137
+ activityData: DTONotificationProjectInvitationPayload
11138
+ }),
11139
+ z341.object({
11140
+ type: z341.literal(DTONotificationType.enum.ProjectDocumentComment),
11141
+ activityData: DTONotificationProjectDocumentCommentPayload
11142
+ })
11143
+ ]).and(DTONotificationBase);
11144
+
11145
+ // src/api/dto/portal/portal-settings.ts
11146
+ import { z as z342 } from "zod";
10919
11147
  var DTOPortalSettingsTheme = PortalSettingsTheme;
10920
11148
  var DTOPortalSettingsSidebarLink = PortalSettingsSidebarLink;
10921
11149
  var DTOPortalSettingsSidebarSection = PortalSettingsSidebarSection;
10922
11150
  var DTOPortalSettingsSidebar = PortalSettingsSidebar;
10923
- var DTOPortalSettings = z341.object({
10924
- id: z341.string(),
10925
- workspaceId: z341.string(),
10926
- enabledDesignSystemIds: z341.array(z341.string()),
10927
- enabledBrandPersistentIds: z341.array(z341.string()),
11151
+ var DTOPortalSettings = z342.object({
11152
+ id: z342.string(),
11153
+ workspaceId: z342.string(),
11154
+ enabledDesignSystemIds: z342.array(z342.string()),
11155
+ enabledBrandPersistentIds: z342.array(z342.string()),
10928
11156
  theme: DTOPortalSettingsTheme.nullish(),
10929
11157
  sidebar: DTOPortalSettingsSidebar.nullish(),
10930
- createdAt: z341.coerce.date(),
10931
- updatedAt: z341.coerce.date()
11158
+ createdAt: z342.coerce.date(),
11159
+ updatedAt: z342.coerce.date()
10932
11160
  });
10933
- var DTOPortalSettingsGetResponse = z341.object({
11161
+ var DTOPortalSettingsGetResponse = z342.object({
10934
11162
  portalSettings: DTOPortalSettings
10935
11163
  });
10936
- var DTOPortalSettingsUpdatePayload = z341.object({
10937
- enabledDesignSystemIds: z341.array(z341.string()).optional(),
10938
- enabledBrandPersistentIds: z341.array(z341.string()).optional(),
11164
+ var DTOPortalSettingsUpdatePayload = z342.object({
11165
+ enabledDesignSystemIds: z342.array(z342.string()).optional(),
11166
+ enabledBrandPersistentIds: z342.array(z342.string()).optional(),
10939
11167
  theme: DTOPortalSettingsTheme.nullish(),
10940
11168
  sidebar: DTOPortalSettingsSidebar.nullish()
10941
11169
  });
10942
11170
 
10943
11171
  // src/api/dto/sandboxes/template.ts
10944
- import z342 from "zod";
10945
- var DTOSandboxTemplateVersion = z342.object({
10946
- name: z342.string(),
10947
- createdAt: z342.string(),
10948
- createdByUserId: z342.string(),
10949
- e2bTemplateId: z342.string()
10950
- });
10951
- var DTOSandboxTemplate = z342.object({
10952
- id: z342.string(),
10953
- name: z342.string(),
10954
- workspaceId: z342.string(),
10955
- designSystemId: z342.string(),
10956
- createdAt: z342.string(),
11172
+ import z343 from "zod";
11173
+ var DTOSandboxTemplateVersion = z343.object({
11174
+ name: z343.string(),
11175
+ createdAt: z343.string(),
11176
+ createdByUserId: z343.string(),
11177
+ e2bTemplateId: z343.string()
11178
+ });
11179
+ var DTOSandboxTemplate = z343.object({
11180
+ id: z343.string(),
11181
+ name: z343.string(),
11182
+ workspaceId: z343.string(),
11183
+ designSystemId: z343.string(),
11184
+ createdAt: z343.string(),
10957
11185
  versions: DTOSandboxTemplateVersion.array()
10958
11186
  });
10959
- var DTOSandboxTemplateBuild = z342.object({
10960
- id: z342.string(),
10961
- workspaceId: z342.string(),
10962
- designSystemId: z342.string(),
10963
- name: z342.string(),
10964
- version: z342.string(),
10965
- createdAt: z342.string(),
10966
- finishedAt: z342.string().optional(),
10967
- createdByUserId: z342.string(),
10968
- dockerImagePath: z342.string(),
10969
- error: z342.string().optional(),
10970
- state: z342.enum(["PendingUpload", "Building", "Success", "Failure", "Timeout"])
10971
- });
10972
- var DTOSandboxTemplateFile = z342.object({
10973
- key: z342.string(),
10974
- fileId: z342.string(),
10975
- filePath: z342.string(),
10976
- url: z342.string()
10977
- });
10978
- var DTOSandboxTemplateVersionDetail = z342.object({
11187
+ var DTOSandboxTemplateBuild = z343.object({
11188
+ id: z343.string(),
11189
+ workspaceId: z343.string(),
11190
+ designSystemId: z343.string(),
11191
+ name: z343.string(),
11192
+ version: z343.string(),
11193
+ createdAt: z343.string(),
11194
+ finishedAt: z343.string().optional(),
11195
+ createdByUserId: z343.string(),
11196
+ dockerImagePath: z343.string(),
11197
+ error: z343.string().optional(),
11198
+ state: z343.enum(["PendingUpload", "Building", "Success", "Failure", "Timeout"])
11199
+ });
11200
+ var DTOSandboxTemplateFile = z343.object({
11201
+ key: z343.string(),
11202
+ fileId: z343.string(),
11203
+ filePath: z343.string(),
11204
+ url: z343.string()
11205
+ });
11206
+ var DTOSandboxTemplateVersionDetail = z343.object({
10979
11207
  version: DTOSandboxTemplateVersion,
10980
11208
  files: DTOSandboxTemplateFile.array()
10981
11209
  });
10982
- var DTOSandboxTemplateQuery = z342.object({
10983
- workspaceId: z342.string(),
10984
- designSystemId: z342.string().optional()
11210
+ var DTOSandboxTemplateQuery = z343.object({
11211
+ workspaceId: z343.string(),
11212
+ designSystemId: z343.string().optional()
10985
11213
  });
10986
- var DTOSandboxTemplateListResponse = z342.object({
11214
+ var DTOSandboxTemplateListResponse = z343.object({
10987
11215
  templates: DTOSandboxTemplate.array()
10988
11216
  });
10989
- var DTOSandboxTemplateResponse = z342.object({
11217
+ var DTOSandboxTemplateResponse = z343.object({
10990
11218
  template: DTOSandboxTemplate
10991
11219
  });
10992
- var DTOSandboxTemplateBuildResponse = z342.object({
11220
+ var DTOSandboxTemplateBuildResponse = z343.object({
10993
11221
  build: DTOSandboxTemplateBuild
10994
11222
  });
10995
- var DTOSandboxTemplateBuildCreateInput = z342.object({
10996
- workspaceId: z342.string(),
10997
- designSystemId: z342.string(),
10998
- name: z342.string(),
10999
- version: z342.string(),
11000
- isExistingVersionUpdateAllowed: z342.boolean()
11223
+ var DTOSandboxTemplateBuildCreateInput = z343.object({
11224
+ workspaceId: z343.string(),
11225
+ designSystemId: z343.string(),
11226
+ name: z343.string(),
11227
+ version: z343.string(),
11228
+ isExistingVersionUpdateAllowed: z343.boolean()
11001
11229
  });
11002
- var DTOSandboxTemplateBuildCreateResponse = z342.object({
11230
+ var DTOSandboxTemplateBuildCreateResponse = z343.object({
11003
11231
  /** @deprecated use domain + build.dockerImagePath */
11004
- dockerUrl: z342.string().optional(),
11005
- dockerRegistryDomain: z342.string(),
11232
+ dockerUrl: z343.string().optional(),
11233
+ dockerRegistryDomain: z343.string(),
11006
11234
  /** @deprecated use docker-login endpoint */
11007
- dockerAccessToken: z342.string().optional(),
11235
+ dockerAccessToken: z343.string().optional(),
11008
11236
  build: DTOSandboxTemplateBuild
11009
11237
  });
11010
- var DTOSandboxTemplateBuildFinalizeResponse = z342.object({
11011
- ok: z342.boolean()
11238
+ var DTOSandboxTemplateBuildFinalizeResponse = z343.object({
11239
+ ok: z343.boolean()
11012
11240
  });
11013
11241
 
11014
11242
  // src/api/dto/themes/override.ts
11015
- import { z as z343 } from "zod";
11243
+ import { z as z344 } from "zod";
11016
11244
  var DTOThemeOverride = DesignTokenTypedData.and(
11017
- z343.object({
11018
- tokenPersistentId: z343.string(),
11245
+ z344.object({
11246
+ tokenPersistentId: z344.string(),
11019
11247
  origin: ThemeOverrideOrigin.optional()
11020
11248
  })
11021
11249
  );
11022
11250
  var DTOThemeOverrideCreatePayload = DesignTokenTypedData.and(
11023
- z343.object({
11024
- tokenPersistentId: z343.string()
11251
+ z344.object({
11252
+ tokenPersistentId: z344.string()
11025
11253
  })
11026
11254
  );
11027
11255
 
11028
11256
  // src/api/dto/themes/theme.ts
11029
- import { z as z344 } from "zod";
11030
- var DTOTheme = z344.object({
11031
- id: z344.string(),
11032
- persistentId: z344.string(),
11033
- designSystemVersionId: z344.string(),
11034
- brandId: z344.string(),
11257
+ import { z as z345 } from "zod";
11258
+ var DTOTheme = z345.object({
11259
+ id: z345.string(),
11260
+ persistentId: z345.string(),
11261
+ designSystemVersionId: z345.string(),
11262
+ brandId: z345.string(),
11035
11263
  meta: ObjectMeta,
11036
- codeName: z344.string(),
11264
+ codeName: z345.string(),
11037
11265
  overrides: DTOThemeOverride.array()
11038
11266
  });
11039
- var DTOThemeResponse = z344.object({
11267
+ var DTOThemeResponse = z345.object({
11040
11268
  theme: DTOTheme
11041
11269
  });
11042
- var DTOThemeListResponse = z344.object({
11270
+ var DTOThemeListResponse = z345.object({
11043
11271
  themes: DTOTheme.array()
11044
11272
  });
11045
- var DTOThemeCreatePayload = z344.object({
11273
+ var DTOThemeCreatePayload = z345.object({
11046
11274
  meta: ObjectMeta,
11047
- persistentId: z344.string(),
11048
- brandId: z344.string(),
11049
- codeName: z344.string(),
11275
+ persistentId: z345.string(),
11276
+ brandId: z345.string(),
11277
+ codeName: z345.string(),
11050
11278
  overrides: DTOThemeOverride.array()
11051
11279
  });
11052
11280
 
11053
11281
  // src/api/dto/trail-events/trail-events.ts
11054
- import { z as z345 } from "zod";
11055
- var DTOTrailEventType = z345.enum([
11282
+ import { z as z346 } from "zod";
11283
+ var DTOTrailEventType = z346.enum([
11056
11284
  "IterationCreated",
11057
11285
  "IterationBookmarked",
11058
11286
  "FeatureCreated",
@@ -11068,340 +11296,112 @@ var DTOTrailEventType = z345.enum([
11068
11296
  "ProjectContextCreated",
11069
11297
  "ProjectContextArchived"
11070
11298
  ]);
11071
- var DTOTrailEventBase = z345.object({
11072
- id: z345.string(),
11073
- projectId: z345.string(),
11074
- userId: z345.string(),
11075
- createdAt: z345.coerce.date(),
11076
- updatedAt: z345.coerce.date()
11077
- });
11078
- var DTOTrailEventIterationCreatedPayload = z345.object({
11079
- iterationName: z345.string(),
11080
- iterationId: z345.string().uuid(),
11081
- featureId: z345.string().uuid()
11082
- });
11083
- var DTOTrailEventIterationBookmarkedPayload = z345.object({
11084
- iterationId: z345.string().uuid(),
11085
- featureId: z345.string().uuid(),
11086
- iterationName: z345.string()
11087
- });
11088
- var DTOTrailEventIterationPromotedPayload = z345.object({
11089
- iterationId: z345.string().uuid(),
11090
- featureId: z345.string().uuid(),
11091
- iterationName: z345.string()
11092
- });
11093
- var DTOTrailEventFeatureCreatedPayload = z345.object({
11094
- featureId: z345.string().uuid(),
11095
- name: z345.string(),
11096
- description: z345.string().optional()
11097
- });
11098
- var DTOTrailEventFeatureDeletedPayload = z345.object({
11099
- featureId: z345.string().uuid(),
11100
- name: z345.string()
11101
- });
11102
- var DTOTrailEventFeatureArchivedPayload = z345.object({
11103
- featureId: z345.string().uuid(),
11104
- name: z345.string()
11105
- });
11106
- var DTOTrailEventDocumentCreatedPayload = z345.object({
11107
- documentId: z345.string().uuid(),
11108
- title: z345.string(),
11109
- sectionId: z345.string().uuid().optional()
11110
- });
11111
- var DTOTrailEventDocumentDeletedPayload = z345.object({
11112
- documentId: z345.string().uuid(),
11113
- title: z345.string()
11114
- });
11115
- var DTOTrailEventDocumentUpdatedPayload = z345.object({
11116
- documentId: z345.string().uuid(),
11117
- title: z345.string(),
11118
- sectionId: z345.string().uuid().optional()
11119
- });
11120
- var DTOTrailEventDocumentCommentSentPayload = z345.object({
11121
- documentId: z345.string().uuid(),
11122
- title: z345.string(),
11123
- sectionId: z345.string().uuid().optional()
11124
- });
11125
- var DTOTrailEventProjectCreatedPayload = z345.object({
11126
- name: z345.string(),
11127
- description: z345.string().optional()
11128
- });
11129
- var DTOTrailEventProjectArchivedPayload = z345.object({
11130
- name: z345.string()
11131
- });
11132
- var DTOTrailEventProjectContextCreatedPayload = z345.object({
11133
- contextId: z345.number(),
11134
- name: z345.string(),
11135
- description: z345.string().optional()
11136
- });
11137
- var DTOTrailEventProjectContextArchivedPayload = z345.object({
11138
- contextId: z345.number()
11139
- });
11140
- var DTOTrailEventPayload = z345.discriminatedUnion("type", [
11141
- z345.object({ type: z345.literal("IterationCreated"), payload: DTOTrailEventIterationCreatedPayload }),
11142
- z345.object({ type: z345.literal("IterationBookmarked"), payload: DTOTrailEventIterationBookmarkedPayload }),
11143
- z345.object({ type: z345.literal("FeatureCreated"), payload: DTOTrailEventFeatureCreatedPayload }),
11144
- z345.object({ type: z345.literal("FeatureDeleted"), payload: DTOTrailEventFeatureDeletedPayload }),
11145
- z345.object({ type: z345.literal("FeatureArchived"), payload: DTOTrailEventFeatureArchivedPayload }),
11146
- z345.object({ type: z345.literal("DocumentCreated"), payload: DTOTrailEventDocumentCreatedPayload }),
11147
- z345.object({ type: z345.literal("DocumentDeleted"), payload: DTOTrailEventDocumentDeletedPayload }),
11148
- z345.object({ type: z345.literal("DocumentUpdated"), payload: DTOTrailEventDocumentUpdatedPayload }),
11149
- z345.object({ type: z345.literal("DocumentCommentSent"), payload: DTOTrailEventDocumentCommentSentPayload }),
11150
- z345.object({ type: z345.literal("ProjectCreated"), payload: DTOTrailEventProjectCreatedPayload }),
11151
- z345.object({ type: z345.literal("ProjectArchived"), payload: DTOTrailEventProjectArchivedPayload }),
11152
- z345.object({ type: z345.literal("IterationPromoted"), payload: DTOTrailEventIterationPromotedPayload }),
11153
- z345.object({ type: z345.literal("ProjectContextCreated"), payload: DTOTrailEventProjectContextCreatedPayload }),
11154
- z345.object({ type: z345.literal("ProjectContextArchived"), payload: DTOTrailEventProjectContextArchivedPayload })
11299
+ var DTOTrailEventBase = z346.object({
11300
+ id: z346.string(),
11301
+ projectId: z346.string(),
11302
+ userId: z346.string(),
11303
+ createdAt: z346.coerce.date(),
11304
+ updatedAt: z346.coerce.date()
11305
+ });
11306
+ var DTOTrailEventIterationCreatedPayload = z346.object({
11307
+ iterationName: z346.string(),
11308
+ iterationId: z346.string().uuid(),
11309
+ featureId: z346.string().uuid()
11310
+ });
11311
+ var DTOTrailEventIterationBookmarkedPayload = z346.object({
11312
+ iterationId: z346.string().uuid(),
11313
+ featureId: z346.string().uuid(),
11314
+ iterationName: z346.string()
11315
+ });
11316
+ var DTOTrailEventIterationPromotedPayload = z346.object({
11317
+ iterationId: z346.string().uuid(),
11318
+ featureId: z346.string().uuid(),
11319
+ iterationName: z346.string()
11320
+ });
11321
+ var DTOTrailEventFeatureCreatedPayload = z346.object({
11322
+ featureId: z346.string().uuid(),
11323
+ name: z346.string(),
11324
+ description: z346.string().optional()
11325
+ });
11326
+ var DTOTrailEventFeatureDeletedPayload = z346.object({
11327
+ featureId: z346.string().uuid(),
11328
+ name: z346.string()
11329
+ });
11330
+ var DTOTrailEventFeatureArchivedPayload = z346.object({
11331
+ featureId: z346.string().uuid(),
11332
+ name: z346.string()
11333
+ });
11334
+ var DTOTrailEventDocumentCreatedPayload = z346.object({
11335
+ documentId: z346.string().uuid(),
11336
+ title: z346.string(),
11337
+ sectionId: z346.string().uuid().optional()
11338
+ });
11339
+ var DTOTrailEventDocumentDeletedPayload = z346.object({
11340
+ documentId: z346.string().uuid(),
11341
+ title: z346.string()
11342
+ });
11343
+ var DTOTrailEventDocumentUpdatedPayload = z346.object({
11344
+ documentId: z346.string().uuid(),
11345
+ title: z346.string(),
11346
+ sectionId: z346.string().uuid().optional()
11347
+ });
11348
+ var DTOTrailEventDocumentCommentSentPayload = z346.object({
11349
+ documentId: z346.string().uuid(),
11350
+ title: z346.string(),
11351
+ sectionId: z346.string().uuid().optional()
11352
+ });
11353
+ var DTOTrailEventProjectCreatedPayload = z346.object({
11354
+ name: z346.string(),
11355
+ description: z346.string().optional()
11356
+ });
11357
+ var DTOTrailEventProjectArchivedPayload = z346.object({
11358
+ name: z346.string()
11359
+ });
11360
+ var DTOTrailEventProjectContextCreatedPayload = z346.object({
11361
+ contextId: z346.number(),
11362
+ name: z346.string(),
11363
+ description: z346.string().optional()
11364
+ });
11365
+ var DTOTrailEventProjectContextArchivedPayload = z346.object({
11366
+ contextId: z346.number()
11367
+ });
11368
+ var DTOTrailEventPayload = z346.discriminatedUnion("type", [
11369
+ z346.object({ type: z346.literal("IterationCreated"), payload: DTOTrailEventIterationCreatedPayload }),
11370
+ z346.object({ type: z346.literal("IterationBookmarked"), payload: DTOTrailEventIterationBookmarkedPayload }),
11371
+ z346.object({ type: z346.literal("FeatureCreated"), payload: DTOTrailEventFeatureCreatedPayload }),
11372
+ z346.object({ type: z346.literal("FeatureDeleted"), payload: DTOTrailEventFeatureDeletedPayload }),
11373
+ z346.object({ type: z346.literal("FeatureArchived"), payload: DTOTrailEventFeatureArchivedPayload }),
11374
+ z346.object({ type: z346.literal("DocumentCreated"), payload: DTOTrailEventDocumentCreatedPayload }),
11375
+ z346.object({ type: z346.literal("DocumentDeleted"), payload: DTOTrailEventDocumentDeletedPayload }),
11376
+ z346.object({ type: z346.literal("DocumentUpdated"), payload: DTOTrailEventDocumentUpdatedPayload }),
11377
+ z346.object({ type: z346.literal("DocumentCommentSent"), payload: DTOTrailEventDocumentCommentSentPayload }),
11378
+ z346.object({ type: z346.literal("ProjectCreated"), payload: DTOTrailEventProjectCreatedPayload }),
11379
+ z346.object({ type: z346.literal("ProjectArchived"), payload: DTOTrailEventProjectArchivedPayload }),
11380
+ z346.object({ type: z346.literal("IterationPromoted"), payload: DTOTrailEventIterationPromotedPayload }),
11381
+ z346.object({ type: z346.literal("ProjectContextCreated"), payload: DTOTrailEventProjectContextCreatedPayload }),
11382
+ z346.object({ type: z346.literal("ProjectContextArchived"), payload: DTOTrailEventProjectContextArchivedPayload })
11155
11383
  ]);
11156
11384
  var DTOTrailEvent = DTOTrailEventPayload.and(DTOTrailEventBase);
11157
11385
  var DTOTrailEventWithDetails = DTOTrailEvent.and(
11158
- z345.object({
11159
- projectName: z345.string().optional(),
11160
- userName: z345.string().optional()
11386
+ z346.object({
11387
+ projectName: z346.string().optional(),
11388
+ userName: z346.string().optional()
11161
11389
  })
11162
11390
  );
11163
- var DTOTrailEventListInput = z345.object({
11164
- projectId: z345.string()
11391
+ var DTOTrailEventListInput = z346.object({
11392
+ projectId: z346.string()
11165
11393
  });
11166
- var DTOTrailEventListResponse = z345.object({
11167
- events: z345.array(DTOTrailEventWithDetails)
11394
+ var DTOTrailEventListResponse = z346.object({
11395
+ events: z346.array(DTOTrailEventWithDetails)
11168
11396
  });
11169
11397
  var DTOTrailEventCreate = DTOTrailEventPayload.and(
11170
11398
  DTOTrailEventBase.omit({ id: true, createdAt: true, updatedAt: true })
11171
11399
  );
11172
- var DTOTrailEventClientCreate = z345.discriminatedUnion("type", [
11173
- z345.object({ type: z345.literal("DocumentUpdated"), payload: DTOTrailEventDocumentUpdatedPayload }),
11174
- z345.object({ type: z345.literal("DocumentCommentSent"), payload: DTOTrailEventDocumentCommentSentPayload })
11400
+ var DTOTrailEventClientCreate = z346.discriminatedUnion("type", [
11401
+ z346.object({ type: z346.literal("DocumentUpdated"), payload: DTOTrailEventDocumentUpdatedPayload }),
11402
+ z346.object({ type: z346.literal("DocumentCommentSent"), payload: DTOTrailEventDocumentCommentSentPayload })
11175
11403
  ]).and(DTOTrailEventBase.omit({ id: true, createdAt: true, updatedAt: true }));
11176
11404
 
11177
- // src/api/dto/notifications/notifications.ts
11178
- import { z as z346 } from "zod";
11179
- var DTONotificationChatMentionPayload = z346.object({
11180
- messageAuthorId: z346.string(),
11181
- messageText: z346.string(),
11182
- messageId: z346.string(),
11183
- parentMessageId: z346.string().optional(),
11184
- workspaceId: z346.string(),
11185
- projectId: z346.string(),
11186
- subjectType: z346.string(),
11187
- threadSubjectId: z346.string(),
11188
- subjectName: z346.string()
11189
- });
11190
- var DTONotificationProjectInvitationPayload = z346.object({
11191
- workspaceId: z346.string(),
11192
- projectId: z346.string(),
11193
- projectTitle: z346.string(),
11194
- invitedByUserId: z346.string(),
11195
- invitationRole: z346.string()
11196
- });
11197
- var DTONotificationProjectDocumentCommentPayload = z346.object({
11198
- documentId: z346.string(),
11199
- entityTitle: z346.string(),
11200
- projectId: z346.string(),
11201
- workspaceId: z346.string(),
11202
- threadId: z346.string(),
11203
- commentId: z346.string(),
11204
- commentCreatedAt: z346.string(),
11205
- commentAuthorId: z346.string(),
11206
- commentBody: z346.string()
11207
- });
11208
- var DTONotificationBase = z346.object({
11209
- userId: z346.string(),
11210
- subjectId: z346.string(),
11211
- roomId: z346.string().optional(),
11212
- workspaceId: z346.string()
11213
- });
11214
- var DTONotificationCreateInput = z346.discriminatedUnion("type", [
11215
- z346.object({
11216
- type: z346.literal(DTONotificationType.enum.ChatMention),
11217
- activityData: DTONotificationChatMentionPayload
11218
- }),
11219
- z346.object({
11220
- type: z346.literal(DTONotificationType.enum.ProjectInvitation),
11221
- activityData: DTONotificationProjectInvitationPayload
11222
- }),
11223
- z346.object({
11224
- type: z346.literal(DTONotificationType.enum.ProjectDocumentComment),
11225
- activityData: DTONotificationProjectDocumentCommentPayload
11226
- })
11227
- ]).and(DTONotificationBase);
11228
-
11229
- // src/utils/figma.ts
11230
- var figmaFileIdRegex = /^[0-9a-zA-Z]{22,128}$/;
11231
- var nodeIdRegex = /^\d+-\d+$/;
11232
- var nodeTypeRegex = /^[0-9a-zA-Z]^/;
11233
- var ParsedFigmaFileURLError = /* @__PURE__ */ ((ParsedFigmaFileURLError2) => {
11234
- ParsedFigmaFileURLError2["InvalidUrl"] = "InvalidUrl";
11235
- ParsedFigmaFileURLError2["InvalidFigmaFileId"] = "InvalidFigmaFileId";
11236
- return ParsedFigmaFileURLError2;
11237
- })(ParsedFigmaFileURLError || {});
11238
- var FigmaUtils = {
11239
- tryParseFigmaFileURL(urlString) {
11240
- if (!URL.canParse(urlString)) {
11241
- return { status: "Error", error: "InvalidUrl" /* InvalidUrl */ };
11242
- }
11243
- const url = new URL(urlString);
11244
- if (!url.hostname.endsWith("figma.com")) {
11245
- return { status: "Error", error: "InvalidUrl" /* InvalidUrl */ };
11246
- }
11247
- const pathSegments = url.pathname.split("/");
11248
- if (pathSegments[1] !== "design" && pathSegments[1] !== "file") {
11249
- return { status: "Error", error: "InvalidUrl" /* InvalidUrl */ };
11250
- }
11251
- const fileId = pathSegments[2];
11252
- if (!fileId || !fileId.match(figmaFileIdRegex)) {
11253
- return { status: "Error", error: "InvalidFigmaFileId" /* InvalidFigmaFileId */ };
11254
- }
11255
- let fileName = null;
11256
- const rawFileName = pathSegments[3];
11257
- if (rawFileName) {
11258
- fileName = rawFileName.replaceAll("-", " ");
11259
- }
11260
- let nodeId = null;
11261
- const nodeIdRaw = url.searchParams.get("node-id");
11262
- if (nodeIdRaw && nodeIdRaw.match(nodeIdRegex)) {
11263
- nodeId = nodeIdRaw.replace("-", ":");
11264
- }
11265
- let nodeType = null;
11266
- const nodeTypeRaw = url.searchParams.get("node-type");
11267
- if (nodeTypeRaw && nodeTypeRaw.match(nodeTypeRegex)) {
11268
- nodeType = nodeTypeRaw;
11269
- }
11270
- return { status: "Success", fileId, fileName, nodeId, nodeType };
11271
- }
11272
- };
11273
-
11274
- // src/utils/hash.ts
11275
- function hash(input) {
11276
- return farmhash(input).toString(16);
11277
- }
11278
- function farmhash(input) {
11279
- const seed = 2654435769;
11280
- let hash2 = seed;
11281
- for (let i = 0; i < input.length; i++) {
11282
- const charCode = input.charCodeAt(i);
11283
- hash2 ^= charCode;
11284
- hash2 = Math.imul(hash2, 1540483477);
11285
- hash2 ^= hash2 >>> 15;
11286
- }
11287
- hash2 = Math.imul(hash2, 1540483477);
11288
- hash2 ^= hash2 >>> 13;
11289
- hash2 = Math.imul(hash2, 1540483477);
11290
- hash2 ^= hash2 >>> 15;
11291
- return hash2 >>> 0;
11292
- }
11293
- function prepareObject(obj) {
11294
- if (obj === null || typeof obj !== "object") {
11295
- return obj;
11296
- }
11297
- if (Array.isArray(obj)) {
11298
- return obj.map(prepareObject);
11299
- }
11300
- const sortedObj = {};
11301
- for (const key of Object.keys(obj).sort()) {
11302
- if (obj[key] === null || obj[key] === void 0) {
11303
- continue;
11304
- }
11305
- sortedObj[key] = prepareObject(obj[key]);
11306
- }
11307
- return sortedObj;
11308
- }
11309
- function generateHash(input, debug = false) {
11310
- if (typeof input === "object") {
11311
- const sanitized = JSON.stringify(prepareObject(input));
11312
- if (debug) {
11313
- console.log("Hashing sanitized string:");
11314
- console.log(sanitized);
11315
- }
11316
- return hash(sanitized);
11317
- } else {
11318
- try {
11319
- const obj = JSON.parse(input);
11320
- const sanitized = JSON.stringify(prepareObject(obj));
11321
- if (debug) {
11322
- console.log("Hashing sanitized string:");
11323
- console.log(sanitized);
11324
- }
11325
- return hash(sanitized);
11326
- } catch {
11327
- return hash(input);
11328
- }
11329
- }
11330
- }
11331
-
11332
- // src/utils/redirect-validation.ts
11333
- var exhaustiveInvalidUriPaths = {
11334
- emptyPath: "",
11335
- spacesInPath: "/invalid path/with spaces",
11336
- specialCharacter1: "/path/with|invalid>characters",
11337
- specialCharacter2: "/path/with<invalid*characters",
11338
- specialCharacter3: "/path/{invalid}?characters",
11339
- consecutiveSlashes: "/path//with///too/many/slashes",
11340
- unencodedPercent: "/path/with/unencoded%percent",
11341
- unencodedSpaces: "/path/with unencoded spaces",
11342
- fragmentIdentifier: "/path/with#fragment",
11343
- queryParameters: "/path/with?query=parameter",
11344
- nullCharacter: "/path/with/\0nullcharacter",
11345
- onlySlash: "/",
11346
- controlCharacter: "/path/with/control\0character",
11347
- extremelyLongPath: "/" + "a".repeat(2047),
11348
- invalidStartCharacter: "///path/starting/with/slashes",
11349
- invalidStartCharacterColon: ":/path/starting/with/colon",
11350
- invalidTrailingDot: "/path/ending/with/dot.",
11351
- invalidPercentEncoding1: "/path/with/%2",
11352
- invalidPercentEncoding2: "/path/with/%ZZ",
11353
- invalidPercentEncoding3: "/path/with/%G1",
11354
- reservedCharacter1: "/path/with?<reserved>",
11355
- reservedCharacter2: '/path/with/"quotes"',
11356
- reservedCharacter3: "/path/with/[brackets]",
11357
- reservedCharacter4: "/path/with/\\backslashes",
11358
- nonAscii1: "/path/with/\u4F60\u597D",
11359
- nonAscii2: "/path/with/emoji/\u{1F603}",
11360
- mixedEncodingPath: "/path/%41A%42B%C3%28",
11361
- directoryTraversal1: "/path/../../etc/passwd",
11362
- directoryTraversal2: "/path/./././"
11363
- };
11364
- function isValidRedirectPath(path) {
11365
- const trimmedPath = path.toLowerCase().trim();
11366
- const url = "https://www.example.com" + trimmedPath;
11367
- if (url.length > 2048) {
11368
- return {
11369
- isValid: false,
11370
- reason: "TooLong"
11371
- };
11372
- }
11373
- if (trimmedPath === "") {
11374
- return {
11375
- isValid: false,
11376
- reason: "Empty"
11377
- };
11378
- }
11379
- if (url === "/") {
11380
- return {
11381
- isValid: false,
11382
- reason: "Empty"
11383
- };
11384
- }
11385
- if (url.includes("?")) {
11386
- return {
11387
- isValid: false,
11388
- reason: "ContainsQuery"
11389
- };
11390
- }
11391
- if (url.includes("#")) {
11392
- return {
11393
- isValid: false,
11394
- reason: "ContainsFragment"
11395
- };
11396
- }
11397
- const regex = /^\/[A-Za-z0-9_-]+(\/[A-Za-z0-9_-]+)*$/;
11398
- const isValid = regex.test(trimmedPath);
11399
- return {
11400
- isValid: regex.test(trimmedPath),
11401
- reason: !isValid ? "InvalidURI" : void 0
11402
- };
11403
- }
11404
-
11405
11405
  // src/api/endpoints/codegen/exporters.ts
11406
11406
  var ExportersEndpoint = class {
11407
11407
  constructor(requestExecutor) {