@supernova-studio/client 0.47.27 → 0.47.29

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
@@ -2185,7 +2185,8 @@ var PageBlockDefinitionPropertyType = z102.enum([
2185
2185
  "Table",
2186
2186
  "Divider",
2187
2187
  "Storybook",
2188
- "Color"
2188
+ "Color",
2189
+ "FigmaComponent"
2189
2190
  ]);
2190
2191
  var PageBlockDefinitionRichTextPropertyStyle = z102.enum([
2191
2192
  "Title1",
@@ -2773,6 +2774,7 @@ var ExportJobContext = z131.object({
2773
2774
  apiUrl: z131.string(),
2774
2775
  accessToken: z131.string(),
2775
2776
  designSystemId: z131.string(),
2777
+ exporterId: z131.string(),
2776
2778
  versionId: z131.string(),
2777
2779
  brandId: z131.string().optional(),
2778
2780
  themeId: z131.string().optional(),
@@ -2800,8 +2802,8 @@ var ExporterDestinationGithub = z133.object({
2800
2802
  branch: z133.string(),
2801
2803
  relativePath: nullishToOptional(z133.string()),
2802
2804
  // Legacy deprecated fields. Use `credentialId` instead
2803
- connectionId: z133.string().optional(),
2804
- userId: z133.number().optional()
2805
+ connectionId: nullishToOptional(z133.string()),
2806
+ userId: nullishToOptional(z133.number())
2805
2807
  });
2806
2808
  var ExporterDestinationAzure = z133.object({
2807
2809
  credentialId: z133.string().optional(),
@@ -2815,8 +2817,8 @@ var ExporterDestinationAzure = z133.object({
2815
2817
  // Maybe not needed
2816
2818
  url: nullishToOptional(z133.string()),
2817
2819
  // Legacy deprecated fields. Use `credentialId` instead
2818
- connectionId: z133.string().optional(),
2819
- userId: z133.number().optional()
2820
+ connectionId: nullishToOptional(z133.string()),
2821
+ userId: nullishToOptional(z133.number())
2820
2822
  });
2821
2823
  var ExporterDestinationGitlab = z133.object({
2822
2824
  credentialId: z133.string().optional(),
@@ -2828,8 +2830,8 @@ var ExporterDestinationGitlab = z133.object({
2828
2830
  // Maybe not needed
2829
2831
  url: nullishToOptional(z133.string()),
2830
2832
  // Legacy deprecated fields. Use `credentialId` instead
2831
- connectionId: z133.string().optional(),
2832
- userId: z133.number().optional()
2833
+ connectionId: nullishToOptional(z133.string()),
2834
+ userId: nullishToOptional(z133.number())
2833
2835
  });
2834
2836
  var ExporterDestinationBitbucket = z133.object({
2835
2837
  credentialId: z133.string().optional(),
@@ -2841,8 +2843,8 @@ var ExporterDestinationBitbucket = z133.object({
2841
2843
  branch: z133.string(),
2842
2844
  relativePath: nullishToOptional(z133.string()),
2843
2845
  // Legacy deprecated fields. Use `credentialId` instead
2844
- connectionId: z133.string().optional(),
2845
- userId: z133.number().optional()
2846
+ connectionId: nullishToOptional(z133.string()),
2847
+ userId: nullishToOptional(z133.number())
2846
2848
  });
2847
2849
  var ExportDestinationsMap = z133.object({
2848
2850
  webhookUrl: z133.string().optional(),
@@ -2889,12 +2891,13 @@ var ExportJobResult = z134.object({
2889
2891
  azure: nullishToOptional(ExportJobPullRequestDestinationResult),
2890
2892
  gitlab: nullishToOptional(ExportJobPullRequestDestinationResult),
2891
2893
  bitbucket: nullishToOptional(ExportJobPullRequestDestinationResult),
2892
- sndocs: nullishToOptional(ExportJobDocsDestinationResult)
2894
+ sndocs: nullishToOptional(ExportJobDocsDestinationResult),
2895
+ logs: nullishToOptional(ExportJobLogEntry.array())
2893
2896
  });
2894
2897
  var ExportJob = z134.object({
2895
2898
  id: z134.string(),
2896
- createdAt: z134.date(),
2897
- finishedAt: z134.date().optional(),
2899
+ createdAt: z134.coerce.date(),
2900
+ finishedAt: z134.coerce.date().optional(),
2898
2901
  designSystemId: z134.string(),
2899
2902
  designSystemVersionId: z134.string(),
2900
2903
  workspaceId: z134.string(),
@@ -3075,18 +3078,26 @@ var GitObjectsQuery = z144.object({
3075
3078
  var GitOrganization = z144.object({
3076
3079
  id: z144.string(),
3077
3080
  name: z144.string(),
3078
- url: z144.string()
3081
+ url: z144.string(),
3082
+ slug: z144.string()
3079
3083
  });
3080
3084
  var GitProject = z144.object({
3081
3085
  id: z144.string(),
3082
3086
  name: z144.string(),
3083
- url: z144.string()
3087
+ url: z144.string(),
3088
+ slug: z144.string()
3084
3089
  });
3085
3090
  var GitRepository = z144.object({
3086
3091
  id: z144.string(),
3087
3092
  name: z144.string(),
3088
3093
  url: z144.string(),
3089
- defaultBranch: z144.string()
3094
+ slug: z144.string(),
3095
+ /**
3096
+ * Can be undefined when:
3097
+ * - there are no branches in the repository yet
3098
+ * - Git provider doesn't expose this information on a repository via their API
3099
+ */
3100
+ defaultBranch: z144.string().optional()
3090
3101
  });
3091
3102
  var GitBranch = z144.object({
3092
3103
  name: z144.string(),
@@ -3100,13 +3111,15 @@ var IntegrationDesignSystem = z145.object({
3100
3111
  date: z145.coerce.date().optional()
3101
3112
  });
3102
3113
  var IntegrationCredentialsType = z145.enum(["OAuth2", "PAT", "GithubApp"]);
3114
+ var IntegrationCredentialsState = z145.enum(["Active", "Inactive"]);
3103
3115
  var IntegrationCredentialsProfile = z145.object({
3104
3116
  id: nullishToOptional(z145.string()),
3105
3117
  email: nullishToOptional(z145.string()),
3106
3118
  handle: nullishToOptional(z145.string()),
3107
3119
  type: nullishToOptional(z145.string()),
3108
3120
  avatarUrl: nullishToOptional(z145.string()),
3109
- organization: nullishToOptional(z145.string())
3121
+ organization: nullishToOptional(z145.string()),
3122
+ collection: nullishToOptional(z145.string())
3110
3123
  });
3111
3124
  var IntegrationCredentials = z145.object({
3112
3125
  id: z145.string(),
@@ -3123,6 +3136,7 @@ var IntegrationCredentials = z145.object({
3123
3136
  appInstallationId: z145.string().optional(),
3124
3137
  profile: IntegrationCredentialsProfile.optional(),
3125
3138
  customUrl: z145.string().optional(),
3139
+ state: IntegrationCredentialsState,
3126
3140
  user: UserMinified.optional()
3127
3141
  });
3128
3142
  var ExtendedIntegrationType = z145.enum([
@@ -3143,7 +3157,6 @@ var Integration = z145.object({
3143
3157
  createdAt: z145.coerce.date(),
3144
3158
  integrationCredentials: z145.array(IntegrationCredentials).optional()
3145
3159
  });
3146
- var forbiddenCustomUrldomainList = ["github.com", "gitlab.com", "bitbucket.org", "figma.com", "dev.azure.com"];
3147
3160
  var IntegrationToken = z145.object({
3148
3161
  access_token: z145.string(),
3149
3162
  refresh_token: z145.string().optional(),
@@ -3151,16 +3164,12 @@ var IntegrationToken = z145.object({
3151
3164
  token_type: z145.string().optional(),
3152
3165
  token_name: z145.string().optional(),
3153
3166
  token_azure_organization_name: z145.string().optional(),
3154
- // Azure only
3167
+ // Azure Cloud PAT only
3168
+ token_azure_collection_name: z145.string().optional(),
3169
+ // Azure Server PAT only
3155
3170
  token_bitbucket_username: z145.string().optional(),
3156
3171
  // Bitbucket only
3157
- custom_url: z145.string().optional().refine((value) => {
3158
- if (!value)
3159
- return true;
3160
- if (forbiddenCustomUrldomainList.some((domain) => value.includes(domain)))
3161
- return false;
3162
- return true;
3163
- }, "Custom URL validation failed")
3172
+ custom_url: z145.string().url().optional().transform((value) => value && formatCustomUrl(value))
3164
3173
  }).refine((data) => {
3165
3174
  if (data.custom_url && data.token_azure_organization_name) {
3166
3175
  return false;
@@ -3175,19 +3184,21 @@ var IntegrationToken = z145.object({
3175
3184
  tokenName: data.token_name,
3176
3185
  tokenBitbucketUsername: data.token_bitbucket_username,
3177
3186
  tokenAzureOrganizationName: data.token_azure_organization_name,
3178
- customUrl: data.custom_url ? formatCustomUrl(data.custom_url) : void 0
3187
+ tokenAzureCollection: data.token_azure_collection_name,
3188
+ customUrl: data.custom_url
3179
3189
  };
3180
- function formatCustomUrl(url) {
3181
- let formattedUrl = url.trim();
3182
- if (!formattedUrl.startsWith("http://") && !formattedUrl.startsWith("https://")) {
3183
- formattedUrl = "http://" + formattedUrl;
3184
- }
3185
- if (formattedUrl.endsWith("/")) {
3186
- formattedUrl = formattedUrl.slice(0, -1);
3187
- }
3188
- return formattedUrl;
3189
- }
3190
3190
  });
3191
+ var forbiddenCustomUrlDomainList = ["github.com", "gitlab.com", "bitbucket.org", "figma.com", "dev.azure.com"];
3192
+ function formatCustomUrl(url) {
3193
+ let formattedUrl = url.trim().toLowerCase();
3194
+ if (!formattedUrl.startsWith("http://") && !formattedUrl.startsWith("https://")) {
3195
+ formattedUrl = "https://" + formattedUrl;
3196
+ }
3197
+ if (formattedUrl.endsWith("/")) {
3198
+ formattedUrl = formattedUrl.slice(0, -1);
3199
+ }
3200
+ return forbiddenCustomUrlDomainList.some((domain) => formattedUrl.includes(domain)) ? void 0 : formattedUrl;
3201
+ }
3191
3202
  var IntegrationTokenSchemaOld = z146.object({
3192
3203
  id: z146.string(),
3193
3204
  provider: OAuthProviderSchema,
@@ -3345,6 +3356,9 @@ var SupernovaException = class _SupernovaException extends Error {
3345
3356
  static missingIntegration(message) {
3346
3357
  return new _SupernovaException("MissingIntegration", message);
3347
3358
  }
3359
+ static missingIntegrationAccess(message) {
3360
+ return new _SupernovaException("MissingIntegrationAccess", message);
3361
+ }
3348
3362
  static noAccess(message) {
3349
3363
  return new _SupernovaException("NoAccess", message);
3350
3364
  }
@@ -4388,14 +4402,16 @@ function gitOrganizationToDto(org) {
4388
4402
  return {
4389
4403
  id: org.id,
4390
4404
  name: org.name,
4391
- url: org.url
4405
+ url: org.url,
4406
+ slug: org.slug
4392
4407
  };
4393
4408
  }
4394
4409
  function gitProjectToDto(project) {
4395
4410
  return {
4396
4411
  id: project.id,
4397
4412
  name: project.name,
4398
- url: project.url
4413
+ url: project.url,
4414
+ slug: project.slug
4399
4415
  };
4400
4416
  }
4401
4417
  function gitRepositoryToDto(repo) {
@@ -4403,6 +4419,7 @@ function gitRepositoryToDto(repo) {
4403
4419
  id: repo.id,
4404
4420
  name: repo.name,
4405
4421
  url: repo.url,
4422
+ slug: repo.slug,
4406
4423
  defaultBranch: repo.defaultBranch
4407
4424
  };
4408
4425
  }
@@ -4438,7 +4455,8 @@ function integrationCredentialToDto(credential) {
4438
4455
  profile: credential.profile,
4439
4456
  tokenName: credential.tokenName,
4440
4457
  username: credential.username,
4441
- appInstallationId: credential.appInstallationId
4458
+ appInstallationId: credential.appInstallationId,
4459
+ state: credential.state
4442
4460
  };
4443
4461
  }
4444
4462
 
@@ -5383,8 +5401,8 @@ var DTOExportJobDestinations = z189.object({
5383
5401
  });
5384
5402
  var DTOExportJob = z189.object({
5385
5403
  id: z189.string(),
5386
- createdAt: z189.date(),
5387
- finishedAt: z189.date().optional(),
5404
+ createdAt: z189.coerce.date(),
5405
+ finishedAt: z189.coerce.date().optional(),
5388
5406
  index: z189.number().optional(),
5389
5407
  status: ExportJobStatus,
5390
5408
  estimatedExecutionTime: z189.number().optional(),
@@ -5435,18 +5453,21 @@ import { z as z193 } from "zod";
5435
5453
  var DTOGitOrganization = z193.object({
5436
5454
  id: z193.string(),
5437
5455
  name: z193.string(),
5438
- url: z193.string()
5456
+ url: z193.string(),
5457
+ slug: z193.string()
5439
5458
  });
5440
5459
  var DTOGitProject = z193.object({
5441
5460
  id: z193.string(),
5442
5461
  name: z193.string(),
5443
- url: z193.string()
5462
+ url: z193.string(),
5463
+ slug: z193.string()
5444
5464
  });
5445
5465
  var DTOGitRepository = z193.object({
5446
5466
  id: z193.string(),
5447
5467
  name: z193.string(),
5448
5468
  url: z193.string(),
5449
- defaultBranch: z193.string()
5469
+ slug: z193.string(),
5470
+ defaultBranch: z193.string().optional()
5450
5471
  });
5451
5472
  var DTOGitBranch = z193.object({
5452
5473
  name: z193.string(),
@@ -9222,6 +9243,8 @@ function valueSchemaForPropertyType(type) {
9222
9243
  return PageBlockItemStorybookValue;
9223
9244
  case "Color":
9224
9245
  return PageBlockItemColorValue;
9246
+ case "FigmaComponent":
9247
+ return PageBlockItemFigmaComponentValue;
9225
9248
  }
9226
9249
  }
9227
9250
  function getProsemirrorBlockId(prosemirrorNode) {