@supernova-studio/model 0.45.0 → 0.45.1
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.d.mts +389 -261
- package/dist/index.d.ts +389 -261
- package/dist/index.js +32 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +32 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/dsm/elements/data/documentation-block-v1.ts +1 -0
- package/src/dsm/elements/data/documentation-v2.ts +4 -4
- package/src/integrations/integration.ts +38 -4
package/package.json
CHANGED
|
@@ -143,6 +143,7 @@ export const PageBlockShortcut = z.object({
|
|
|
143
143
|
description: nullishToOptional(z.string()),
|
|
144
144
|
asset: nullishToOptional(PageBlockAsset),
|
|
145
145
|
documentationItemId: nullishToOptional(z.string()),
|
|
146
|
+
pageHeadingId: nullishToOptional(z.string()),
|
|
146
147
|
url: nullishToOptional(z.string()),
|
|
147
148
|
openInNewTab: nullishToOptional(z.boolean()),
|
|
148
149
|
urlPreview: nullishToOptional(PageBlockUrlPreview),
|
|
@@ -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
|
|
13
|
+
export const defaultDocumentationItemConfigurationV2 = {
|
|
14
14
|
header: defaultDocumentationItemHeaderV2,
|
|
15
15
|
isHidden: false,
|
|
16
16
|
isPrivate: false,
|
|
17
17
|
showSidebar: true,
|
|
18
|
-
};
|
|
18
|
+
} as const;
|
|
@@ -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
|
|
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
|
|
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(
|
|
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>;
|