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