@supernova-studio/model 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.mjs CHANGED
@@ -3224,6 +3224,7 @@ var ExportJobContext = z131.object({
3224
3224
  apiUrl: z131.string(),
3225
3225
  accessToken: z131.string(),
3226
3226
  designSystemId: z131.string(),
3227
+ exporterId: z131.string(),
3227
3228
  versionId: z131.string(),
3228
3229
  brandId: z131.string().optional(),
3229
3230
  themeId: z131.string().optional(),
@@ -3257,8 +3258,8 @@ var ExporterDestinationGithub = z133.object({
3257
3258
  branch: z133.string(),
3258
3259
  relativePath: nullishToOptional(z133.string()),
3259
3260
  // Legacy deprecated fields. Use `credentialId` instead
3260
- connectionId: z133.string().optional(),
3261
- userId: z133.number().optional()
3261
+ connectionId: nullishToOptional(z133.string()),
3262
+ userId: nullishToOptional(z133.number())
3262
3263
  });
3263
3264
  var ExporterDestinationAzure = z133.object({
3264
3265
  credentialId: z133.string().optional(),
@@ -3272,8 +3273,8 @@ var ExporterDestinationAzure = z133.object({
3272
3273
  // Maybe not needed
3273
3274
  url: nullishToOptional(z133.string()),
3274
3275
  // Legacy deprecated fields. Use `credentialId` instead
3275
- connectionId: z133.string().optional(),
3276
- userId: z133.number().optional()
3276
+ connectionId: nullishToOptional(z133.string()),
3277
+ userId: nullishToOptional(z133.number())
3277
3278
  });
3278
3279
  var ExporterDestinationGitlab = z133.object({
3279
3280
  credentialId: z133.string().optional(),
@@ -3285,8 +3286,8 @@ var ExporterDestinationGitlab = z133.object({
3285
3286
  // Maybe not needed
3286
3287
  url: nullishToOptional(z133.string()),
3287
3288
  // Legacy deprecated fields. Use `credentialId` instead
3288
- connectionId: z133.string().optional(),
3289
- userId: z133.number().optional()
3289
+ connectionId: nullishToOptional(z133.string()),
3290
+ userId: nullishToOptional(z133.number())
3290
3291
  });
3291
3292
  var ExporterDestinationBitbucket = z133.object({
3292
3293
  credentialId: z133.string().optional(),
@@ -3298,8 +3299,8 @@ var ExporterDestinationBitbucket = z133.object({
3298
3299
  branch: z133.string(),
3299
3300
  relativePath: nullishToOptional(z133.string()),
3300
3301
  // Legacy deprecated fields. Use `credentialId` instead
3301
- connectionId: z133.string().optional(),
3302
- userId: z133.number().optional()
3302
+ connectionId: nullishToOptional(z133.string()),
3303
+ userId: nullishToOptional(z133.number())
3303
3304
  });
3304
3305
  var ExportDestinationsMap = z133.object({
3305
3306
  webhookUrl: z133.string().optional(),
@@ -3349,12 +3350,13 @@ var ExportJobResult = z134.object({
3349
3350
  azure: nullishToOptional(ExportJobPullRequestDestinationResult),
3350
3351
  gitlab: nullishToOptional(ExportJobPullRequestDestinationResult),
3351
3352
  bitbucket: nullishToOptional(ExportJobPullRequestDestinationResult),
3352
- sndocs: nullishToOptional(ExportJobDocsDestinationResult)
3353
+ sndocs: nullishToOptional(ExportJobDocsDestinationResult),
3354
+ logs: nullishToOptional(ExportJobLogEntry.array())
3353
3355
  });
3354
3356
  var ExportJob = z134.object({
3355
3357
  id: z134.string(),
3356
- createdAt: z134.date(),
3357
- finishedAt: z134.date().optional(),
3358
+ createdAt: z134.coerce.date(),
3359
+ finishedAt: z134.coerce.date().optional(),
3358
3360
  designSystemId: z134.string(),
3359
3361
  designSystemVersionId: z134.string(),
3360
3362
  workspaceId: z134.string(),
@@ -3569,18 +3571,26 @@ var GitObjectsQuery = z144.object({
3569
3571
  var GitOrganization = z144.object({
3570
3572
  id: z144.string(),
3571
3573
  name: z144.string(),
3572
- url: z144.string()
3574
+ url: z144.string(),
3575
+ slug: z144.string()
3573
3576
  });
3574
3577
  var GitProject = z144.object({
3575
3578
  id: z144.string(),
3576
3579
  name: z144.string(),
3577
- url: z144.string()
3580
+ url: z144.string(),
3581
+ slug: z144.string()
3578
3582
  });
3579
3583
  var GitRepository = z144.object({
3580
3584
  id: z144.string(),
3581
3585
  name: z144.string(),
3582
3586
  url: z144.string(),
3583
- defaultBranch: z144.string()
3587
+ slug: z144.string(),
3588
+ /**
3589
+ * Can be undefined when:
3590
+ * - there are no branches in the repository yet
3591
+ * - Git provider doesn't expose this information on a repository via their API
3592
+ */
3593
+ defaultBranch: z144.string().optional()
3584
3594
  });
3585
3595
  var GitBranch = z144.object({
3586
3596
  name: z144.string(),
@@ -3597,13 +3607,15 @@ var IntegrationDesignSystem = z145.object({
3597
3607
  date: z145.coerce.date().optional()
3598
3608
  });
3599
3609
  var IntegrationCredentialsType = z145.enum(["OAuth2", "PAT", "GithubApp"]);
3610
+ var IntegrationCredentialsState = z145.enum(["Active", "Inactive"]);
3600
3611
  var IntegrationCredentialsProfile = z145.object({
3601
3612
  id: nullishToOptional(z145.string()),
3602
3613
  email: nullishToOptional(z145.string()),
3603
3614
  handle: nullishToOptional(z145.string()),
3604
3615
  type: nullishToOptional(z145.string()),
3605
3616
  avatarUrl: nullishToOptional(z145.string()),
3606
- organization: nullishToOptional(z145.string())
3617
+ organization: nullishToOptional(z145.string()),
3618
+ collection: nullishToOptional(z145.string())
3607
3619
  });
3608
3620
  var IntegrationCredentials = z145.object({
3609
3621
  id: z145.string(),
@@ -3620,6 +3632,7 @@ var IntegrationCredentials = z145.object({
3620
3632
  appInstallationId: z145.string().optional(),
3621
3633
  profile: IntegrationCredentialsProfile.optional(),
3622
3634
  customUrl: z145.string().optional(),
3635
+ state: IntegrationCredentialsState,
3623
3636
  user: UserMinified.optional()
3624
3637
  });
3625
3638
  var ExtendedIntegrationType = z145.enum([
@@ -3640,7 +3653,6 @@ var Integration = z145.object({
3640
3653
  createdAt: z145.coerce.date(),
3641
3654
  integrationCredentials: z145.array(IntegrationCredentials).optional()
3642
3655
  });
3643
- var forbiddenCustomUrldomainList = ["github.com", "gitlab.com", "bitbucket.org", "figma.com", "dev.azure.com"];
3644
3656
  var IntegrationToken = z145.object({
3645
3657
  access_token: z145.string(),
3646
3658
  refresh_token: z145.string().optional(),
@@ -3648,16 +3660,12 @@ var IntegrationToken = z145.object({
3648
3660
  token_type: z145.string().optional(),
3649
3661
  token_name: z145.string().optional(),
3650
3662
  token_azure_organization_name: z145.string().optional(),
3651
- // Azure only
3663
+ // Azure Cloud PAT only
3664
+ token_azure_collection_name: z145.string().optional(),
3665
+ // Azure Server PAT only
3652
3666
  token_bitbucket_username: z145.string().optional(),
3653
3667
  // Bitbucket only
3654
- custom_url: z145.string().optional().refine((value) => {
3655
- if (!value)
3656
- return true;
3657
- if (forbiddenCustomUrldomainList.some((domain) => value.includes(domain)))
3658
- return false;
3659
- return true;
3660
- }, "Custom URL validation failed")
3668
+ custom_url: z145.string().url().optional().transform((value) => value && formatCustomUrl(value))
3661
3669
  }).refine((data) => {
3662
3670
  if (data.custom_url && data.token_azure_organization_name) {
3663
3671
  return false;
@@ -3672,19 +3680,21 @@ var IntegrationToken = z145.object({
3672
3680
  tokenName: data.token_name,
3673
3681
  tokenBitbucketUsername: data.token_bitbucket_username,
3674
3682
  tokenAzureOrganizationName: data.token_azure_organization_name,
3675
- customUrl: data.custom_url ? formatCustomUrl(data.custom_url) : void 0
3683
+ tokenAzureCollection: data.token_azure_collection_name,
3684
+ customUrl: data.custom_url
3676
3685
  };
3677
- function formatCustomUrl(url) {
3678
- let formattedUrl = url.trim();
3679
- if (!formattedUrl.startsWith("http://") && !formattedUrl.startsWith("https://")) {
3680
- formattedUrl = "http://" + formattedUrl;
3681
- }
3682
- if (formattedUrl.endsWith("/")) {
3683
- formattedUrl = formattedUrl.slice(0, -1);
3684
- }
3685
- return formattedUrl;
3686
- }
3687
3686
  });
3687
+ var forbiddenCustomUrlDomainList = ["github.com", "gitlab.com", "bitbucket.org", "figma.com", "dev.azure.com"];
3688
+ function formatCustomUrl(url) {
3689
+ let formattedUrl = url.trim().toLowerCase();
3690
+ if (!formattedUrl.startsWith("http://") && !formattedUrl.startsWith("https://")) {
3691
+ formattedUrl = "https://" + formattedUrl;
3692
+ }
3693
+ if (formattedUrl.endsWith("/")) {
3694
+ formattedUrl = formattedUrl.slice(0, -1);
3695
+ }
3696
+ return forbiddenCustomUrlDomainList.some((domain) => formattedUrl.includes(domain)) ? void 0 : formattedUrl;
3697
+ }
3688
3698
 
3689
3699
  // src/integrations/oauth-token.ts
3690
3700
  import { z as z146 } from "zod";
@@ -3871,6 +3881,9 @@ var SupernovaException = class _SupernovaException extends Error {
3871
3881
  static missingIntegration(message) {
3872
3882
  return new _SupernovaException("MissingIntegration", message);
3873
3883
  }
3884
+ static missingIntegrationAccess(message) {
3885
+ return new _SupernovaException("MissingIntegrationAccess", message);
3886
+ }
3874
3887
  static noAccess(message) {
3875
3888
  return new _SupernovaException("NoAccess", message);
3876
3889
  }
@@ -3959,6 +3972,9 @@ async function promiseWithTimeout(timeoutMs, promise) {
3959
3972
  async function sleep(ms) {
3960
3973
  return new Promise((resolve) => setTimeout(resolve, ms));
3961
3974
  }
3975
+ function uniqueBy(items, prop) {
3976
+ return Array.from(mapByUnique(items, prop).values());
3977
+ }
3962
3978
 
3963
3979
  // src/utils/content-loader-instruction.ts
3964
3980
  import { z as z155 } from "zod";
@@ -4932,6 +4948,7 @@ export {
4932
4948
  IntegrationAuthType,
4933
4949
  IntegrationCredentials,
4934
4950
  IntegrationCredentialsProfile,
4951
+ IntegrationCredentialsState,
4935
4952
  IntegrationCredentialsType,
4936
4953
  IntegrationDesignSystem,
4937
4954
  IntegrationToken,
@@ -5270,6 +5287,7 @@ export {
5270
5287
  trimTrailingSlash,
5271
5288
  tryParseShortPersistentId,
5272
5289
  tryParseUrl,
5290
+ uniqueBy,
5273
5291
  zodCreateInputOmit,
5274
5292
  zodUpdateInputOmit
5275
5293
  };