@supernova-studio/client 1.52.2 → 1.52.4

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),
@@ -10333,7 +10509,8 @@ var DTOThreadMessageFinalizeInput = z325.object({
10333
10509
  });
10334
10510
  var DTOThreadMessageRetryInput = z325.object({
10335
10511
  agentMessageId: Id,
10336
- runtimeError: z325.string().optional()
10512
+ runtimeError: z325.string().optional(),
10513
+ message: DTOThreadMessage.pick({ id: true, body: true }).optional()
10337
10514
  });
10338
10515
  var DTOThreadMessageUpdateInput = DTOThreadMessage.pick({
10339
10516
  id: true
@@ -10914,145 +11091,197 @@ var DTOMCPStreamResponse = z340.object({
10914
11091
  stream: DTOMCPStream
10915
11092
  });
10916
11093
 
10917
- // src/api/dto/portal/portal-settings.ts
11094
+ // src/api/dto/notifications/notifications.ts
10918
11095
  import { z as z341 } from "zod";
11096
+ var DTONotificationChatMentionPayload = z341.object({
11097
+ messageAuthorId: z341.string(),
11098
+ messageText: z341.string(),
11099
+ messageId: z341.string(),
11100
+ parentMessageId: z341.string().optional(),
11101
+ workspaceId: z341.string(),
11102
+ projectId: z341.string(),
11103
+ subjectType: z341.string(),
11104
+ threadSubjectId: z341.string(),
11105
+ subjectName: z341.string()
11106
+ });
11107
+ var DTONotificationProjectInvitationPayload = z341.object({
11108
+ workspaceId: z341.string(),
11109
+ projectId: z341.string(),
11110
+ projectTitle: z341.string(),
11111
+ invitedByUserId: z341.string(),
11112
+ invitationRole: z341.string()
11113
+ });
11114
+ var DTONotificationProjectDocumentCommentPayload = z341.object({
11115
+ documentId: z341.string(),
11116
+ entityTitle: z341.string(),
11117
+ projectId: z341.string(),
11118
+ workspaceId: z341.string(),
11119
+ threadId: z341.string(),
11120
+ commentId: z341.string(),
11121
+ commentCreatedAt: z341.string(),
11122
+ commentAuthorId: z341.string(),
11123
+ commentBody: z341.string()
11124
+ });
11125
+ var DTONotificationBase = z341.object({
11126
+ userId: z341.string(),
11127
+ subjectId: z341.string(),
11128
+ roomId: z341.string().optional(),
11129
+ workspaceId: z341.string()
11130
+ });
11131
+ var DTONotificationCreateInput = z341.discriminatedUnion("type", [
11132
+ z341.object({
11133
+ type: z341.literal(DTONotificationType.enum.ChatMention),
11134
+ activityData: DTONotificationChatMentionPayload
11135
+ }),
11136
+ z341.object({
11137
+ type: z341.literal(DTONotificationType.enum.ProjectInvitation),
11138
+ activityData: DTONotificationProjectInvitationPayload
11139
+ }),
11140
+ z341.object({
11141
+ type: z341.literal(DTONotificationType.enum.ProjectDocumentComment),
11142
+ activityData: DTONotificationProjectDocumentCommentPayload
11143
+ })
11144
+ ]).and(DTONotificationBase);
11145
+
11146
+ // src/api/dto/portal/portal-settings.ts
11147
+ import { z as z342 } from "zod";
10919
11148
  var DTOPortalSettingsTheme = PortalSettingsTheme;
10920
11149
  var DTOPortalSettingsSidebarLink = PortalSettingsSidebarLink;
10921
11150
  var DTOPortalSettingsSidebarSection = PortalSettingsSidebarSection;
10922
11151
  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()),
11152
+ var DTOPortalSettings = z342.object({
11153
+ id: z342.string(),
11154
+ workspaceId: z342.string(),
11155
+ enabledDesignSystemIds: z342.array(z342.string()),
11156
+ enabledBrandPersistentIds: z342.array(z342.string()),
10928
11157
  theme: DTOPortalSettingsTheme.nullish(),
10929
11158
  sidebar: DTOPortalSettingsSidebar.nullish(),
10930
- createdAt: z341.coerce.date(),
10931
- updatedAt: z341.coerce.date()
11159
+ createdAt: z342.coerce.date(),
11160
+ updatedAt: z342.coerce.date()
10932
11161
  });
10933
- var DTOPortalSettingsGetResponse = z341.object({
11162
+ var DTOPortalSettingsGetResponse = z342.object({
10934
11163
  portalSettings: DTOPortalSettings
10935
11164
  });
10936
- var DTOPortalSettingsUpdatePayload = z341.object({
10937
- enabledDesignSystemIds: z341.array(z341.string()).optional(),
10938
- enabledBrandPersistentIds: z341.array(z341.string()).optional(),
11165
+ var DTOPortalSettingsUpdatePayload = z342.object({
11166
+ enabledDesignSystemIds: z342.array(z342.string()).optional(),
11167
+ enabledBrandPersistentIds: z342.array(z342.string()).optional(),
10939
11168
  theme: DTOPortalSettingsTheme.nullish(),
10940
11169
  sidebar: DTOPortalSettingsSidebar.nullish()
10941
11170
  });
10942
11171
 
10943
11172
  // 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(),
11173
+ import z343 from "zod";
11174
+ var DTOSandboxTemplateVersion = z343.object({
11175
+ name: z343.string(),
11176
+ createdAt: z343.string(),
11177
+ createdByUserId: z343.string(),
11178
+ e2bTemplateId: z343.string()
11179
+ });
11180
+ var DTOSandboxTemplate = z343.object({
11181
+ id: z343.string(),
11182
+ name: z343.string(),
11183
+ workspaceId: z343.string(),
11184
+ designSystemId: z343.string(),
11185
+ createdAt: z343.string(),
10957
11186
  versions: DTOSandboxTemplateVersion.array()
10958
11187
  });
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({
11188
+ var DTOSandboxTemplateBuild = z343.object({
11189
+ id: z343.string(),
11190
+ workspaceId: z343.string(),
11191
+ designSystemId: z343.string(),
11192
+ name: z343.string(),
11193
+ version: z343.string(),
11194
+ createdAt: z343.string(),
11195
+ finishedAt: z343.string().optional(),
11196
+ createdByUserId: z343.string(),
11197
+ dockerImagePath: z343.string(),
11198
+ error: z343.string().optional(),
11199
+ state: z343.enum(["PendingUpload", "Building", "Success", "Failure", "Timeout"])
11200
+ });
11201
+ var DTOSandboxTemplateFile = z343.object({
11202
+ key: z343.string(),
11203
+ fileId: z343.string(),
11204
+ filePath: z343.string(),
11205
+ url: z343.string()
11206
+ });
11207
+ var DTOSandboxTemplateVersionDetail = z343.object({
10979
11208
  version: DTOSandboxTemplateVersion,
10980
11209
  files: DTOSandboxTemplateFile.array()
10981
11210
  });
10982
- var DTOSandboxTemplateQuery = z342.object({
10983
- workspaceId: z342.string(),
10984
- designSystemId: z342.string().optional()
11211
+ var DTOSandboxTemplateQuery = z343.object({
11212
+ workspaceId: z343.string(),
11213
+ designSystemId: z343.string().optional()
10985
11214
  });
10986
- var DTOSandboxTemplateListResponse = z342.object({
11215
+ var DTOSandboxTemplateListResponse = z343.object({
10987
11216
  templates: DTOSandboxTemplate.array()
10988
11217
  });
10989
- var DTOSandboxTemplateResponse = z342.object({
11218
+ var DTOSandboxTemplateResponse = z343.object({
10990
11219
  template: DTOSandboxTemplate
10991
11220
  });
10992
- var DTOSandboxTemplateBuildResponse = z342.object({
11221
+ var DTOSandboxTemplateBuildResponse = z343.object({
10993
11222
  build: DTOSandboxTemplateBuild
10994
11223
  });
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()
11224
+ var DTOSandboxTemplateBuildCreateInput = z343.object({
11225
+ workspaceId: z343.string(),
11226
+ designSystemId: z343.string(),
11227
+ name: z343.string(),
11228
+ version: z343.string(),
11229
+ isExistingVersionUpdateAllowed: z343.boolean()
11001
11230
  });
11002
- var DTOSandboxTemplateBuildCreateResponse = z342.object({
11231
+ var DTOSandboxTemplateBuildCreateResponse = z343.object({
11003
11232
  /** @deprecated use domain + build.dockerImagePath */
11004
- dockerUrl: z342.string().optional(),
11005
- dockerRegistryDomain: z342.string(),
11233
+ dockerUrl: z343.string().optional(),
11234
+ dockerRegistryDomain: z343.string(),
11006
11235
  /** @deprecated use docker-login endpoint */
11007
- dockerAccessToken: z342.string().optional(),
11236
+ dockerAccessToken: z343.string().optional(),
11008
11237
  build: DTOSandboxTemplateBuild
11009
11238
  });
11010
- var DTOSandboxTemplateBuildFinalizeResponse = z342.object({
11011
- ok: z342.boolean()
11239
+ var DTOSandboxTemplateBuildFinalizeResponse = z343.object({
11240
+ ok: z343.boolean()
11012
11241
  });
11013
11242
 
11014
11243
  // src/api/dto/themes/override.ts
11015
- import { z as z343 } from "zod";
11244
+ import { z as z344 } from "zod";
11016
11245
  var DTOThemeOverride = DesignTokenTypedData.and(
11017
- z343.object({
11018
- tokenPersistentId: z343.string(),
11246
+ z344.object({
11247
+ tokenPersistentId: z344.string(),
11019
11248
  origin: ThemeOverrideOrigin.optional()
11020
11249
  })
11021
11250
  );
11022
11251
  var DTOThemeOverrideCreatePayload = DesignTokenTypedData.and(
11023
- z343.object({
11024
- tokenPersistentId: z343.string()
11252
+ z344.object({
11253
+ tokenPersistentId: z344.string()
11025
11254
  })
11026
11255
  );
11027
11256
 
11028
11257
  // 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(),
11258
+ import { z as z345 } from "zod";
11259
+ var DTOTheme = z345.object({
11260
+ id: z345.string(),
11261
+ persistentId: z345.string(),
11262
+ designSystemVersionId: z345.string(),
11263
+ brandId: z345.string(),
11035
11264
  meta: ObjectMeta,
11036
- codeName: z344.string(),
11265
+ codeName: z345.string(),
11037
11266
  overrides: DTOThemeOverride.array()
11038
11267
  });
11039
- var DTOThemeResponse = z344.object({
11268
+ var DTOThemeResponse = z345.object({
11040
11269
  theme: DTOTheme
11041
11270
  });
11042
- var DTOThemeListResponse = z344.object({
11271
+ var DTOThemeListResponse = z345.object({
11043
11272
  themes: DTOTheme.array()
11044
11273
  });
11045
- var DTOThemeCreatePayload = z344.object({
11274
+ var DTOThemeCreatePayload = z345.object({
11046
11275
  meta: ObjectMeta,
11047
- persistentId: z344.string(),
11048
- brandId: z344.string(),
11049
- codeName: z344.string(),
11276
+ persistentId: z345.string(),
11277
+ brandId: z345.string(),
11278
+ codeName: z345.string(),
11050
11279
  overrides: DTOThemeOverride.array()
11051
11280
  });
11052
11281
 
11053
11282
  // src/api/dto/trail-events/trail-events.ts
11054
- import { z as z345 } from "zod";
11055
- var DTOTrailEventType = z345.enum([
11283
+ import { z as z346 } from "zod";
11284
+ var DTOTrailEventType = z346.enum([
11056
11285
  "IterationCreated",
11057
11286
  "IterationBookmarked",
11058
11287
  "FeatureCreated",
@@ -11068,340 +11297,112 @@ var DTOTrailEventType = z345.enum([
11068
11297
  "ProjectContextCreated",
11069
11298
  "ProjectContextArchived"
11070
11299
  ]);
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 })
11300
+ var DTOTrailEventBase = z346.object({
11301
+ id: z346.string(),
11302
+ projectId: z346.string(),
11303
+ userId: z346.string(),
11304
+ createdAt: z346.coerce.date(),
11305
+ updatedAt: z346.coerce.date()
11306
+ });
11307
+ var DTOTrailEventIterationCreatedPayload = z346.object({
11308
+ iterationName: z346.string(),
11309
+ iterationId: z346.string().uuid(),
11310
+ featureId: z346.string().uuid()
11311
+ });
11312
+ var DTOTrailEventIterationBookmarkedPayload = z346.object({
11313
+ iterationId: z346.string().uuid(),
11314
+ featureId: z346.string().uuid(),
11315
+ iterationName: z346.string()
11316
+ });
11317
+ var DTOTrailEventIterationPromotedPayload = z346.object({
11318
+ iterationId: z346.string().uuid(),
11319
+ featureId: z346.string().uuid(),
11320
+ iterationName: z346.string()
11321
+ });
11322
+ var DTOTrailEventFeatureCreatedPayload = z346.object({
11323
+ featureId: z346.string().uuid(),
11324
+ name: z346.string(),
11325
+ description: z346.string().optional()
11326
+ });
11327
+ var DTOTrailEventFeatureDeletedPayload = z346.object({
11328
+ featureId: z346.string().uuid(),
11329
+ name: z346.string()
11330
+ });
11331
+ var DTOTrailEventFeatureArchivedPayload = z346.object({
11332
+ featureId: z346.string().uuid(),
11333
+ name: z346.string()
11334
+ });
11335
+ var DTOTrailEventDocumentCreatedPayload = z346.object({
11336
+ documentId: z346.string().uuid(),
11337
+ title: z346.string(),
11338
+ sectionId: z346.string().uuid().optional()
11339
+ });
11340
+ var DTOTrailEventDocumentDeletedPayload = z346.object({
11341
+ documentId: z346.string().uuid(),
11342
+ title: z346.string()
11343
+ });
11344
+ var DTOTrailEventDocumentUpdatedPayload = z346.object({
11345
+ documentId: z346.string().uuid(),
11346
+ title: z346.string(),
11347
+ sectionId: z346.string().uuid().optional()
11348
+ });
11349
+ var DTOTrailEventDocumentCommentSentPayload = z346.object({
11350
+ documentId: z346.string().uuid(),
11351
+ title: z346.string(),
11352
+ sectionId: z346.string().uuid().optional()
11353
+ });
11354
+ var DTOTrailEventProjectCreatedPayload = z346.object({
11355
+ name: z346.string(),
11356
+ description: z346.string().optional()
11357
+ });
11358
+ var DTOTrailEventProjectArchivedPayload = z346.object({
11359
+ name: z346.string()
11360
+ });
11361
+ var DTOTrailEventProjectContextCreatedPayload = z346.object({
11362
+ contextId: z346.number(),
11363
+ name: z346.string(),
11364
+ description: z346.string().optional()
11365
+ });
11366
+ var DTOTrailEventProjectContextArchivedPayload = z346.object({
11367
+ contextId: z346.number()
11368
+ });
11369
+ var DTOTrailEventPayload = z346.discriminatedUnion("type", [
11370
+ z346.object({ type: z346.literal("IterationCreated"), payload: DTOTrailEventIterationCreatedPayload }),
11371
+ z346.object({ type: z346.literal("IterationBookmarked"), payload: DTOTrailEventIterationBookmarkedPayload }),
11372
+ z346.object({ type: z346.literal("FeatureCreated"), payload: DTOTrailEventFeatureCreatedPayload }),
11373
+ z346.object({ type: z346.literal("FeatureDeleted"), payload: DTOTrailEventFeatureDeletedPayload }),
11374
+ z346.object({ type: z346.literal("FeatureArchived"), payload: DTOTrailEventFeatureArchivedPayload }),
11375
+ z346.object({ type: z346.literal("DocumentCreated"), payload: DTOTrailEventDocumentCreatedPayload }),
11376
+ z346.object({ type: z346.literal("DocumentDeleted"), payload: DTOTrailEventDocumentDeletedPayload }),
11377
+ z346.object({ type: z346.literal("DocumentUpdated"), payload: DTOTrailEventDocumentUpdatedPayload }),
11378
+ z346.object({ type: z346.literal("DocumentCommentSent"), payload: DTOTrailEventDocumentCommentSentPayload }),
11379
+ z346.object({ type: z346.literal("ProjectCreated"), payload: DTOTrailEventProjectCreatedPayload }),
11380
+ z346.object({ type: z346.literal("ProjectArchived"), payload: DTOTrailEventProjectArchivedPayload }),
11381
+ z346.object({ type: z346.literal("IterationPromoted"), payload: DTOTrailEventIterationPromotedPayload }),
11382
+ z346.object({ type: z346.literal("ProjectContextCreated"), payload: DTOTrailEventProjectContextCreatedPayload }),
11383
+ z346.object({ type: z346.literal("ProjectContextArchived"), payload: DTOTrailEventProjectContextArchivedPayload })
11155
11384
  ]);
11156
11385
  var DTOTrailEvent = DTOTrailEventPayload.and(DTOTrailEventBase);
11157
11386
  var DTOTrailEventWithDetails = DTOTrailEvent.and(
11158
- z345.object({
11159
- projectName: z345.string().optional(),
11160
- userName: z345.string().optional()
11387
+ z346.object({
11388
+ projectName: z346.string().optional(),
11389
+ userName: z346.string().optional()
11161
11390
  })
11162
11391
  );
11163
- var DTOTrailEventListInput = z345.object({
11164
- projectId: z345.string()
11392
+ var DTOTrailEventListInput = z346.object({
11393
+ projectId: z346.string()
11165
11394
  });
11166
- var DTOTrailEventListResponse = z345.object({
11167
- events: z345.array(DTOTrailEventWithDetails)
11395
+ var DTOTrailEventListResponse = z346.object({
11396
+ events: z346.array(DTOTrailEventWithDetails)
11168
11397
  });
11169
11398
  var DTOTrailEventCreate = DTOTrailEventPayload.and(
11170
11399
  DTOTrailEventBase.omit({ id: true, createdAt: true, updatedAt: true })
11171
11400
  );
11172
- var DTOTrailEventClientCreate = z345.discriminatedUnion("type", [
11173
- z345.object({ type: z345.literal("DocumentUpdated"), payload: DTOTrailEventDocumentUpdatedPayload }),
11174
- z345.object({ type: z345.literal("DocumentCommentSent"), payload: DTOTrailEventDocumentCommentSentPayload })
11401
+ var DTOTrailEventClientCreate = z346.discriminatedUnion("type", [
11402
+ z346.object({ type: z346.literal("DocumentUpdated"), payload: DTOTrailEventDocumentUpdatedPayload }),
11403
+ z346.object({ type: z346.literal("DocumentCommentSent"), payload: DTOTrailEventDocumentCommentSentPayload })
11175
11404
  ]).and(DTOTrailEventBase.omit({ id: true, createdAt: true, updatedAt: true }));
11176
11405
 
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
11406
  // src/api/endpoints/codegen/exporters.ts
11406
11407
  var ExportersEndpoint = class {
11407
11408
  constructor(requestExecutor) {