@supernova-studio/model 0.45.0 → 0.46.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@supernova-studio/model",
3
- "version": "0.45.0",
3
+ "version": "0.46.0",
4
4
  "description": "Supernova Data Models",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -3,16 +3,16 @@ import { DocumentationItemHeaderV2, defaultDocumentationItemHeaderV2 } from "./i
3
3
 
4
4
  export const DocumentationItemConfigurationV2 = z.object({
5
5
  showSidebar: z.boolean(),
6
- isPrivate: z.boolean(),
7
- isHidden: z.boolean(),
6
+ isPrivate: z.boolean().optional(),
7
+ isHidden: z.boolean().optional(),
8
8
  header: DocumentationItemHeaderV2,
9
9
  });
10
10
 
11
11
  export type DocumentationItemConfigurationV2 = z.infer<typeof DocumentationItemConfigurationV2>;
12
12
 
13
- export const defaultDocumentationItemConfigurationV2: DocumentationItemConfigurationV2 = {
13
+ export const defaultDocumentationItemConfigurationV2 = {
14
14
  header: defaultDocumentationItemHeaderV2,
15
15
  isHidden: false,
16
16
  isPrivate: false,
17
17
  showSidebar: true,
18
- };
18
+ } as const;
@@ -18,6 +18,7 @@ export const PublishedDocPage = z.object({
18
18
  pathV1: z.string(),
19
19
  pathV2: z.string(),
20
20
  storagePath: z.string(),
21
+ fallbackPublicPath: z.string().optional(),
21
22
  locale: z.string().optional(),
22
23
 
23
24
  isPrivate: z.boolean(),
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod";
2
2
 
3
- export const IntegrationCredentialsType = z.enum(["OAuth2", "PAT"]);
3
+ export const IntegrationCredentialsType = z.enum(["OAuth2", "PAT", "GithubApp"]);
4
4
  export type IntegrationCredentialsType = z.infer<typeof IntegrationCredentialsType>;
5
5
 
6
6
  export const IntegrationCredentialsProfile = z.object({
@@ -11,7 +11,7 @@ export const IntegrationCredentialsProfile = z.object({
11
11
 
12
12
  export type IntegrationCredentialsProfile = z.infer<typeof IntegrationCredentialsProfile>;
13
13
 
14
- export const IntegrationCredentialsSchema = z.object({
14
+ export const IntegrationCredentials = z.object({
15
15
  id: z.string(),
16
16
  type: IntegrationCredentialsType,
17
17
  integrationId: z.string(),
@@ -20,9 +20,10 @@ export const IntegrationCredentialsSchema = z.object({
20
20
  createdAt: z.coerce.date(),
21
21
  refreshToken: z.string().optional(),
22
22
  profile: IntegrationCredentialsProfile.optional(),
23
+ customUrl: z.string().optional(),
23
24
  });
24
25
 
25
- export type IntegrationCredentials = z.infer<typeof IntegrationCredentialsSchema>;
26
+ export type IntegrationCredentials = z.infer<typeof IntegrationCredentials>;
26
27
 
27
28
  export const IntegrationType = z.enum(["Figma", "Github", "Gitlab", "Bitbucket", "Azure"]);
28
29
  export type IntegrationType = z.infer<typeof IntegrationType>;
@@ -32,6 +33,39 @@ export const Integration = z.object({
32
33
  workspaceId: z.string(),
33
34
  type: IntegrationType,
34
35
  createdAt: z.coerce.date(),
35
- integrationCredentials: z.array(IntegrationCredentialsSchema).optional(),
36
+ integrationCredentials: z.array(IntegrationCredentials).optional(),
36
37
  });
37
38
  export type Integration = z.infer<typeof Integration>;
39
+
40
+ // Custom URL validation
41
+ const forbiddenCustomUrldomainList = ["github.com", "gitlab.com", "bitbucket.org", "figma.com", "dev.azure.com"];
42
+ // const azureCustomUrlRegex = /dev\.azure\.com\/.*/;
43
+ // const isAzureCustomUrl = (value: string) => azureCustomUrlRegex.test(value);
44
+
45
+ export const IntegrationTokenResponse = z
46
+ .object({
47
+ access_token: z.string(),
48
+ refresh_token: z.string().optional(),
49
+ expires_in: z.number().optional(),
50
+ token_type: z.string().optional(),
51
+ custom_url: z
52
+ .string()
53
+ .optional()
54
+ .refine(value => {
55
+ if (!value) return true;
56
+ if (forbiddenCustomUrldomainList.some(domain => value.includes(domain))) return false;
57
+ // if (isAzureCustomUrl(value)) return true;
58
+ return true;
59
+ }, "Custom URL validation failed"),
60
+ })
61
+ .transform(data => {
62
+ return {
63
+ accessToken: data.access_token,
64
+ refreshToken: data.refresh_token,
65
+ expiresIn: data.expires_in,
66
+ tokenType: data.token_type,
67
+ customUrl: data.custom_url,
68
+ };
69
+ });
70
+
71
+ export type IntegrationTokenResponse = z.infer<typeof IntegrationTokenResponse>;