@upstart.gg/sdk 0.0.104 → 0.0.105

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.
Files changed (225) hide show
  1. package/dist/shared/ajv.js +1 -1
  2. package/dist/shared/attributes.js +1 -1
  3. package/dist/shared/bricks/manifests/accordion.manifest.js +1 -1
  4. package/dist/shared/bricks/manifests/all-manifests.js +1 -1
  5. package/dist/shared/bricks/manifests/button.manifest.js +1 -1
  6. package/dist/shared/bricks/manifests/card.manifest.js +1 -1
  7. package/dist/shared/bricks/manifests/carousel.manifest.js +1 -1
  8. package/dist/shared/bricks/manifests/container.manifest.js +1 -1
  9. package/dist/shared/bricks/manifests/divider.manifest.js +1 -1
  10. package/dist/shared/bricks/manifests/footer.manifest.js +1 -1
  11. package/dist/shared/bricks/manifests/form.manifest.js +1 -1
  12. package/dist/shared/bricks/manifests/hero.manifest.js +1 -1
  13. package/dist/shared/bricks/manifests/icon.manifest.js +1 -1
  14. package/dist/shared/bricks/manifests/image.manifest.js +1 -1
  15. package/dist/shared/bricks/manifests/images-gallery.manifest.js +1 -1
  16. package/dist/shared/bricks/manifests/map.manifest.js +1 -1
  17. package/dist/shared/bricks/manifests/navbar.manifest.js +1 -1
  18. package/dist/shared/bricks/manifests/sidebar.manifest.js +1 -1
  19. package/dist/shared/bricks/manifests/social-links.manifest.js +1 -1
  20. package/dist/shared/bricks/manifests/testimonials.manifest.js +1 -1
  21. package/dist/shared/bricks/manifests/text.manifest.js +1 -1
  22. package/dist/shared/bricks/manifests/timeline.manifest.js +1 -1
  23. package/dist/shared/bricks/manifests/video.manifest.js +1 -1
  24. package/dist/shared/bricks.js +1 -1
  25. package/dist/shared/chunk-245ZLDVB.js +3 -0
  26. package/dist/shared/{chunk-QALNFBY7.js → chunk-2D6ZEIDX.js} +1 -1
  27. package/dist/shared/{chunk-CW5FWW5W.js → chunk-4BLCQRF5.js} +1 -1
  28. package/dist/shared/{chunk-TEPFFY32.js → chunk-5MGYT6FI.js} +1 -1
  29. package/dist/shared/{chunk-HQQYIKTE.js → chunk-CS5N4UQU.js} +1 -1
  30. package/dist/shared/{chunk-5IEGQ7YT.js → chunk-FRWB3BF3.js} +1 -1
  31. package/dist/shared/{chunk-I5S2MPPR.js → chunk-HYXCHFS5.js} +1 -1
  32. package/dist/shared/{chunk-TCZBR3ZU.js → chunk-IKSRCRZZ.js} +1 -1
  33. package/dist/shared/{chunk-LJQXN32B.js → chunk-ISF6EBPX.js} +1 -1
  34. package/dist/shared/{chunk-UK6H3FDX.js → chunk-JDBVMPSI.js} +1 -1
  35. package/dist/shared/{chunk-UISES3HA.js → chunk-M3Z3XDUC.js} +1 -1
  36. package/dist/shared/{chunk-22KRCQK5.js → chunk-MWP5IU33.js} +1 -1
  37. package/dist/shared/{chunk-7L3UOEMR.js → chunk-NCSLTHKN.js} +1 -1
  38. package/dist/shared/{chunk-O22VV7YR.js → chunk-OWON727Q.js} +1 -1
  39. package/dist/shared/{chunk-CEXHD4BO.js → chunk-P5RC56CL.js} +2 -2
  40. package/dist/shared/{chunk-ZFTWLZ3G.js → chunk-QI3BZDXL.js} +1 -1
  41. package/dist/shared/{chunk-F6MLW6DO.js → chunk-RDSK2G6V.js} +1 -1
  42. package/dist/shared/{chunk-I43NIQ2K.js → chunk-RXRPFXDF.js} +1 -1
  43. package/dist/shared/{chunk-POYVTV5F.js → chunk-VFGMOA4M.js} +1 -1
  44. package/dist/shared/{chunk-VDHLON5R.js → chunk-VPD626ML.js} +1 -1
  45. package/dist/shared/{chunk-WCNVFVDK.js → chunk-VROOAFFW.js} +1 -1
  46. package/dist/shared/{chunk-E2EBTWJI.js → chunk-WB4PGCZQ.js} +1 -1
  47. package/dist/shared/chunk-X2RJL33B.js +3 -0
  48. package/dist/shared/{chunk-OQIFFJ7I.js → chunk-X4ZBUWUL.js} +1 -1
  49. package/dist/shared/datasources/external/rss/fetcher.d.ts +1 -1
  50. package/dist/shared/datasources/external/rss/fetcher.d.ts.map +1 -1
  51. package/dist/shared/page.js +1 -1
  52. package/dist/shared/site.js +1 -1
  53. package/package.json +5 -9
  54. package/dist/shared/chunk-GPKRRX3D.js +0 -3
  55. package/dist/shared/chunk-JFDOR3UH.js +0 -3
  56. package/src/node/cli/api.ts +0 -101
  57. package/src/node/cli/commands/cmd-build.ts +0 -64
  58. package/src/node/cli/commands/login/cmd-login.ts +0 -111
  59. package/src/node/cli/commands/logout/cmd-logout.ts +0 -11
  60. package/src/node/cli/commands/publish/cmd-publish.ts +0 -135
  61. package/src/node/cli/commands/publish/parse-gitignore.ts +0 -278
  62. package/src/node/cli/commands/publish/uploader.ts +0 -333
  63. package/src/node/cli/constants.ts +0 -14
  64. package/src/node/cli/is-logged-in.ts +0 -28
  65. package/src/node/cli/program.ts +0 -77
  66. package/src/node/cli/store.ts +0 -64
  67. package/src/node/cli/tests/api.test.ts +0 -161
  68. package/src/node/cli/types.ts +0 -34
  69. package/src/node/cli/utils.ts +0 -20
  70. package/src/node/shared/config.ts +0 -69
  71. package/src/node/shared/logger.ts +0 -44
  72. package/src/shared/ajv.ts +0 -103
  73. package/src/shared/analytics/init.ts +0 -14
  74. package/src/shared/analytics/track.ts +0 -21
  75. package/src/shared/analytics/types.ts +0 -13
  76. package/src/shared/attributes.ts +0 -211
  77. package/src/shared/brick-manifest.ts +0 -110
  78. package/src/shared/bricks/manifests/accordion.manifest.ts +0 -179
  79. package/src/shared/bricks/manifests/all-manifests.ts +0 -92
  80. package/src/shared/bricks/manifests/button.manifest.ts +0 -145
  81. package/src/shared/bricks/manifests/card.manifest.ts +0 -269
  82. package/src/shared/bricks/manifests/carousel.manifest.ts +0 -106
  83. package/src/shared/bricks/manifests/container.manifest.ts +0 -357
  84. package/src/shared/bricks/manifests/divider.manifest.ts +0 -121
  85. package/src/shared/bricks/manifests/footer.manifest.ts +0 -487
  86. package/src/shared/bricks/manifests/form.manifest.ts +0 -112
  87. package/src/shared/bricks/manifests/hero.manifest.ts +0 -132
  88. package/src/shared/bricks/manifests/icon.manifest.ts +0 -130
  89. package/src/shared/bricks/manifests/image.manifest.ts +0 -203
  90. package/src/shared/bricks/manifests/images-gallery.manifest.ts +0 -227
  91. package/src/shared/bricks/manifests/map.manifest.ts +0 -75
  92. package/src/shared/bricks/manifests/navbar.manifest.ts +0 -344
  93. package/src/shared/bricks/manifests/sidebar.manifest.ts +0 -90
  94. package/src/shared/bricks/manifests/social-links.manifest.ts +0 -370
  95. package/src/shared/bricks/manifests/testimonials.manifest.ts +0 -397
  96. package/src/shared/bricks/manifests/tests/header.manifest.test.ts +0 -10
  97. package/src/shared/bricks/manifests/text.manifest.ts +0 -164
  98. package/src/shared/bricks/manifests/timeline.manifest.ts +0 -456
  99. package/src/shared/bricks/manifests/video.manifest.ts +0 -59
  100. package/src/shared/bricks/props/_style-presets.ts +0 -352
  101. package/src/shared/bricks/props/align.ts +0 -59
  102. package/src/shared/bricks/props/background.ts +0 -118
  103. package/src/shared/bricks/props/boolean.ts +0 -11
  104. package/src/shared/bricks/props/border.ts +0 -84
  105. package/src/shared/bricks/props/color.ts +0 -24
  106. package/src/shared/bricks/props/common.ts +0 -37
  107. package/src/shared/bricks/props/container.ts +0 -356
  108. package/src/shared/bricks/props/css-length.ts +0 -25
  109. package/src/shared/bricks/props/datasource.ts +0 -60
  110. package/src/shared/bricks/props/date.ts +0 -24
  111. package/src/shared/bricks/props/effects.ts +0 -123
  112. package/src/shared/bricks/props/enum.ts +0 -42
  113. package/src/shared/bricks/props/file.ts +0 -12
  114. package/src/shared/bricks/props/geolocation.ts +0 -30
  115. package/src/shared/bricks/props/helpers.ts +0 -101
  116. package/src/shared/bricks/props/image.ts +0 -90
  117. package/src/shared/bricks/props/number.ts +0 -16
  118. package/src/shared/bricks/props/padding.ts +0 -21
  119. package/src/shared/bricks/props/position.ts +0 -27
  120. package/src/shared/bricks/props/preset.ts +0 -136
  121. package/src/shared/bricks/props/string.ts +0 -56
  122. package/src/shared/bricks/props/tests/align.test.ts +0 -37
  123. package/src/shared/bricks/props/tests/background.test.ts +0 -102
  124. package/src/shared/bricks/props/tests/border.test.ts +0 -38
  125. package/src/shared/bricks/props/tests/effects.test.ts +0 -37
  126. package/src/shared/bricks/props/tests/helpers.test.ts +0 -133
  127. package/src/shared/bricks/props/tests/image.test.ts +0 -71
  128. package/src/shared/bricks/props/tests/padding.ts +0 -12
  129. package/src/shared/bricks/props/tests/string.test.ts +0 -79
  130. package/src/shared/bricks/props/text.ts +0 -66
  131. package/src/shared/bricks/props/types.ts +0 -57
  132. package/src/shared/bricks.ts +0 -232
  133. package/src/shared/context.ts +0 -39
  134. package/src/shared/datarecords/external/airtable/handler.ts +0 -21
  135. package/src/shared/datarecords/external/airtable/options.ts +0 -22
  136. package/src/shared/datarecords/external/generic-webhook/handler.ts +0 -10
  137. package/src/shared/datarecords/external/generic-webhook/options.ts +0 -13
  138. package/src/shared/datarecords/external/google/oauth/config.ts +0 -30
  139. package/src/shared/datarecords/external/google/sheets/handler.ts +0 -26
  140. package/src/shared/datarecords/external/google/sheets/options.ts +0 -9
  141. package/src/shared/datarecords/types.ts +0 -120
  142. package/src/shared/datarecords.ts +0 -5
  143. package/src/shared/datasources/README.md +0 -3
  144. package/src/shared/datasources/external/facebook/posts/fetcher.ts +0 -52
  145. package/src/shared/datasources/external/facebook/posts/sample.ts +0 -35
  146. package/src/shared/datasources/external/facebook/posts/schema.ts +0 -33
  147. package/src/shared/datasources/external/facebook/posts/tests/fetcher.test.ts +0 -73
  148. package/src/shared/datasources/external/http-json/fetcher.ts +0 -28
  149. package/src/shared/datasources/external/http-json/options.ts +0 -12
  150. package/src/shared/datasources/external/http-json/schema.ts +0 -6
  151. package/src/shared/datasources/external/http-json/tests/fetcher.test.ts +0 -70
  152. package/src/shared/datasources/external/instagram/feed/fetcher.ts +0 -33
  153. package/src/shared/datasources/external/instagram/feed/sample.ts +0 -22
  154. package/src/shared/datasources/external/instagram/feed/schema.ts +0 -23
  155. package/src/shared/datasources/external/instagram/feed/tests/fetcher.test.ts +0 -64
  156. package/src/shared/datasources/external/mastodon/account/fetcher.ts +0 -24
  157. package/src/shared/datasources/external/mastodon/account/sample.ts +0 -33
  158. package/src/shared/datasources/external/mastodon/account/schema.ts +0 -45
  159. package/src/shared/datasources/external/mastodon/account/tests/fetcher.test.ts +0 -47
  160. package/src/shared/datasources/external/mastodon/options.ts +0 -11
  161. package/src/shared/datasources/external/mastodon/status/fetcher.ts +0 -35
  162. package/src/shared/datasources/external/mastodon/status/sample.array.ts +0 -59
  163. package/src/shared/datasources/external/mastodon/status/sample.single.ts +0 -55
  164. package/src/shared/datasources/external/mastodon/status/schema.ts +0 -130
  165. package/src/shared/datasources/external/mastodon/status/tests/fetcher.test.ts +0 -74
  166. package/src/shared/datasources/external/meta/oauth/config.ts +0 -16
  167. package/src/shared/datasources/external/meta/options.ts +0 -11
  168. package/src/shared/datasources/external/rss/fetcher.ts +0 -29
  169. package/src/shared/datasources/external/rss/options.ts +0 -11
  170. package/src/shared/datasources/external/rss/sample.ts +0 -22
  171. package/src/shared/datasources/external/rss/schema.ts +0 -42
  172. package/src/shared/datasources/external/threads/media/fetcher.ts +0 -53
  173. package/src/shared/datasources/external/threads/media/sample.ts +0 -44
  174. package/src/shared/datasources/external/threads/media/schema.ts +0 -37
  175. package/src/shared/datasources/external/tiktok/oauth/config.ts +0 -17
  176. package/src/shared/datasources/external/tiktok/video/fetcher.ts +0 -39
  177. package/src/shared/datasources/external/tiktok/video/options.ts +0 -12
  178. package/src/shared/datasources/external/tiktok/video/sample.ts +0 -26
  179. package/src/shared/datasources/external/tiktok/video/schema.ts +0 -27
  180. package/src/shared/datasources/external/youtube/list/fetcher.ts +0 -37
  181. package/src/shared/datasources/external/youtube/list/options.ts +0 -15
  182. package/src/shared/datasources/external/youtube/list/sample.ts +0 -33
  183. package/src/shared/datasources/external/youtube/list/schema.ts +0 -38
  184. package/src/shared/datasources/external/youtube/oauth/config.ts +0 -15
  185. package/src/shared/datasources/fetcher.ts +0 -17
  186. package/src/shared/datasources/internal/blog/schema.ts +0 -69
  187. package/src/shared/datasources/internal/changelog/schema.ts +0 -48
  188. package/src/shared/datasources/internal/contact-info/schema.ts +0 -20
  189. package/src/shared/datasources/internal/cv/schema.ts +0 -217
  190. package/src/shared/datasources/internal/faq/schema.ts +0 -27
  191. package/src/shared/datasources/internal/job-board/schema.ts +0 -228
  192. package/src/shared/datasources/internal/links/schema.ts +0 -15
  193. package/src/shared/datasources/internal/recipes/schema.ts +0 -42
  194. package/src/shared/datasources/internal/restaurant/schema.ts +0 -225
  195. package/src/shared/datasources/provider-options.ts +0 -7
  196. package/src/shared/datasources/samples.ts +0 -26
  197. package/src/shared/datasources/schemas.ts +0 -45
  198. package/src/shared/datasources/types.ts +0 -276
  199. package/src/shared/datasources/utils.ts +0 -16
  200. package/src/shared/datasources.ts +0 -42
  201. package/src/shared/env.ts +0 -23
  202. package/src/shared/errors.ts +0 -1
  203. package/src/shared/images.ts +0 -44
  204. package/src/shared/index.ts +0 -3
  205. package/src/shared/layout-constants.ts +0 -25
  206. package/src/shared/manifest.ts +0 -50
  207. package/src/shared/oauth.ts +0 -16
  208. package/src/shared/page.ts +0 -61
  209. package/src/shared/prompt.ts +0 -9
  210. package/src/shared/responsive.ts +0 -5
  211. package/src/shared/site.ts +0 -97
  212. package/src/shared/sitemap.ts +0 -66
  213. package/src/shared/social-icons.ts +0 -307
  214. package/src/shared/tests/attributes.test.ts +0 -37
  215. package/src/shared/theme.ts +0 -245
  216. package/src/shared/themes/README.md +0 -34
  217. package/src/shared/themes/color-system.ts +0 -127
  218. package/src/shared/utils/canvas-data-uri.ts +0 -2
  219. package/src/shared/utils/invariant.ts +0 -25
  220. package/src/shared/utils/json-date.ts +0 -8
  221. package/src/shared/utils/merge.ts +0 -12
  222. package/src/shared/utils/object-hash.ts +0 -7
  223. package/src/shared/utils/schema.ts +0 -35
  224. package/src/shared/utils/try-catch.ts +0 -12
  225. package/src/shared/utils/typed-ref.ts +0 -41
@@ -1,44 +0,0 @@
1
- import { type Static, Type } from "@sinclair/typebox";
2
- import { StringEnum } from "./utils/schema";
3
-
4
- export const imageSearchSchema = Type.Object({
5
- query: Type.String({
6
- description: 'The search query for finding images (e.g. "mountain landscape", "coffee shop")',
7
- }),
8
- orientation: Type.Optional(
9
- StringEnum(["landscape", "portrait", "squarish"], {
10
- description: "Filter by photo orientation",
11
- }),
12
- ),
13
- });
14
-
15
- // Derive TypeScript type from the schema
16
- export type ImageSearchParams = Static<typeof imageSearchSchema>;
17
-
18
- export const imageResultsSchema = Type.Array(
19
- Type.Object(
20
- {
21
- provider: Type.String(),
22
- description: Type.String(),
23
- url: Type.String(),
24
- blurHash: Type.String(),
25
- user: Type.Object(
26
- {
27
- name: Type.String(),
28
- profile_url: Type.String(),
29
- },
30
- { additionalProperties: false },
31
- ),
32
- },
33
- { additionalProperties: false },
34
- ),
35
- );
36
-
37
- export const imagesMapSchema = Type.Record(Type.String({ title: "Page id" }), imageResultsSchema);
38
- export type ImagesMap = Static<typeof imagesMapSchema>;
39
-
40
- export type ImageSearchResultsType = Static<typeof imageResultsSchema>;
41
- export type SimpleImageMetadata = Pick<
42
- ImageSearchResultsType[number],
43
- "description" | "blurHash" | "user" | "url"
44
- >;
@@ -1,3 +0,0 @@
1
- export default {
2
- name: "upstart-sdk",
3
- };
@@ -1,25 +0,0 @@
1
- /**
2
- * The grid on mobile is 18 columns wide, on desktop it's 36 columns wide.
3
- */
4
- export const LAYOUT_COLS = {
5
- desktop: 48,
6
- mobile: 24,
7
- };
8
-
9
- export const LAYOUT_BREAKPOINTS = {
10
- desktop: 1024,
11
- mobile: 1,
12
- };
13
-
14
- /**
15
- * Important: keep the same pdding for x and y.
16
- */
17
- // export const LAYOUT_PADDING: Record<string, [number, number]> = {
18
- // desktop: [20, 20],
19
- // mobile: [8, 8],
20
- // };
21
-
22
- /**
23
- * This is the height of a row in the layout grid.
24
- */
25
- export const LAYOUT_ROW_HEIGHT = 20;
@@ -1,50 +0,0 @@
1
- import { Type, type Static } from "@sinclair/typebox";
2
-
3
- export const manifestSchema = Type.Object({
4
- id: Type.Optional(
5
- Type.String({
6
- title: "Template ID",
7
- description: "A unique identifier for the template. Can be any string, but should be unique.",
8
- }),
9
- ),
10
- name: Type.String({
11
- title: "Template Name",
12
- }),
13
- description: Type.Optional(
14
- Type.String({
15
- title: "Show template description",
16
- }),
17
- ),
18
- readme: Type.Optional(
19
- Type.Record(
20
- Type.RegExp(/^[a-z]{2}$/), // language code
21
- Type.String(),
22
- {
23
- title: "Readme texts.",
24
- description:
25
- "A dictionary of readme files for different languages (iso 2 letters code). Currently on supported for 'en' and 'fr'.",
26
- },
27
- ),
28
- ),
29
- tags: Type.Optional(Type.Array(Type.String(), { title: "Tags" })),
30
- author: Type.Optional(
31
- Type.String({
32
- title: "Author name",
33
- }),
34
- ),
35
- thumbnail: Type.Optional(
36
- Type.String({
37
- title: "Thumbnail",
38
- description: "A URL to the thumbnail image for the template.",
39
- }),
40
- ),
41
- homepage: Type.Optional(
42
- Type.String({
43
- title: "Homepage",
44
- description: "A URL to the homepage of the template.",
45
- }),
46
- ),
47
- });
48
-
49
- export type TemplateManifest = Static<typeof manifestSchema>;
50
- export type PublishedTemplateManifest = TemplateManifest & Required<Pick<TemplateManifest, "id">>;
@@ -1,16 +0,0 @@
1
- import { Type, type TSchema, type StaticDecode } from "@sinclair/typebox";
2
- import { jsonDate } from "./utils/json-date";
3
-
4
- export const buildOAuthConfigSchema = <T extends TSchema>(T: T) =>
5
- Type.Object({
6
- siteId: Type.String(),
7
- siteDatasourceId: Type.String(),
8
- config: T,
9
- oauthTokenExpireAt: jsonDate,
10
- oauthRefreshTokenExpireAt: Type.Optional(jsonDate),
11
- nextRefreshTokenAt: Type.Optional(jsonDate),
12
- });
13
-
14
- export type OAuthConfig<T extends TSchema = TSchema> = StaticDecode<
15
- ReturnType<typeof buildOAuthConfigSchema<T>>
16
- >;
@@ -1,61 +0,0 @@
1
- import { type Attributes, defaultAttributesSchema, type AttributesSchema } from "./attributes";
2
- import { type Section, sectionSchema } from "./bricks";
3
- import invariant from "./utils/invariant";
4
- import type { Theme } from "./theme";
5
- import { Type, type Static } from "@sinclair/typebox";
6
- import type { DatasourcesMap, DatasourcesResolved } from "./datasources/types";
7
- import type { PageInfo, Sitemap } from "./sitemap";
8
-
9
- /**
10
- * The Page config represents the page configuration (datasources, attributes, etc)
11
- */
12
- export type PageConfig<D extends DatasourcesMap> = PageInfo & {
13
- /**
14
- * Data sources manifests for the page. Undefined if no data sources are defined.
15
- */
16
- datasources?: D;
17
- /**
18
- * Resolved static data sources for the page.
19
- * Undefined if no data sources are defined.
20
- */
21
- data?: D extends DatasourcesMap ? DatasourcesResolved<D> : undefined;
22
- /**
23
- * Page attributes. (can override site attributes)
24
- */
25
- attributes?: AttributesSchema;
26
- /**
27
- * Resolved attributes for the page.
28
- */
29
- attr?: Attributes;
30
- sections: Section[];
31
- tags: string[];
32
- };
33
-
34
- export type GenericPageConfig = PageConfig<DatasourcesMap>;
35
-
36
- /**
37
- * Page context has attr (possibly inherited from site) but not attributes declaration, as they are not needed to render the page.
38
- * It alwso have the sitemap and theme.
39
- */
40
- export type GenericPageContext = Omit<GenericPageConfig, "attr" | "attributes"> & {
41
- siteId: string;
42
- hostname: string;
43
- theme: Theme;
44
- sitemap: Sitemap;
45
- attr: Attributes;
46
- };
47
-
48
- export const pageSchema = Type.Object({
49
- id: Type.String({ description: "The unique ID of the page. Use a human readable url-safe slug" }),
50
- label: Type.String({ description: "The label (name) of the page" }),
51
- path: Type.String({ description: "The path of the page in the URL. Should be unique" }),
52
- sections: Type.Array(sectionSchema, {
53
- description: "The sections of the page. See the Section schema",
54
- }),
55
- tags: Type.Array(Type.String(), {
56
- description: "The tags of the page, used for organizating and filtering pages",
57
- }),
58
- attr: Type.Optional(defaultAttributesSchema),
59
- });
60
-
61
- export type Page = Static<typeof pageSchema>;
@@ -1,9 +0,0 @@
1
- import { type Static, Type } from "@sinclair/typebox";
2
-
3
- export const sitePrompt = Type.String({
4
- minLength: 30,
5
- maxLength: 500,
6
- description: "User prompt for the site, describing the purpose and main features of the site.",
7
- });
8
-
9
- export type SitePrompt = Static<typeof sitePrompt>;
@@ -1,5 +0,0 @@
1
- import type { Static } from "@sinclair/typebox";
2
- import { StringEnum } from "./utils/schema";
3
-
4
- export const resolution = StringEnum(["mobile", "desktop"]);
5
- export type Resolution = Static<typeof resolution>;
@@ -1,97 +0,0 @@
1
- import { Type, type Static } from "@sinclair/typebox";
2
- import { pageSchema } from "./page";
3
- import { pageInfoSchema, sitemapSchema } from "./sitemap";
4
- import { defaultAttributesSchema, type AttributesSchema, resolveAttributes } from "./attributes";
5
- import { datasourcesMap } from "./datasources/types";
6
- import { datarecordsMap } from "./datarecords/types";
7
- import { defaultTheme, themeSchema } from "./theme";
8
- import { sitePrompt } from "./prompt";
9
- import { nanoid } from "nanoid";
10
-
11
- export const siteSchema = Type.Object({
12
- id: Type.String(),
13
- label: Type.String(),
14
- hostname: Type.String(),
15
- attributes: defaultAttributesSchema,
16
- attr: defaultAttributesSchema,
17
- datasources: Type.Optional(datasourcesMap),
18
- datarecords: Type.Optional(datarecordsMap),
19
- themes: Type.Array(themeSchema),
20
- theme: themeSchema,
21
- sitemap: sitemapSchema,
22
- sitePrompt: sitePrompt,
23
- });
24
-
25
- /**
26
- * Site config has always attributes and attr.
27
- */
28
- export type Site = Omit<Static<typeof siteSchema>, "attributes"> & {
29
- attributes: AttributesSchema;
30
- };
31
-
32
- const partialSiteAndPagesSchema = Type.Object({
33
- site: Type.Omit(siteSchema, ["attributes"]),
34
- pages: Type.Array(Type.Composite([Type.Omit(pageSchema, ["attributes"]), pageInfoSchema])),
35
- });
36
-
37
- type PartialSiteAndPagesSchema = Static<typeof partialSiteAndPagesSchema>;
38
-
39
- export type SiteAndPagesConfig = {
40
- site: PartialSiteAndPagesSchema["site"] & {
41
- attributes: AttributesSchema;
42
- };
43
- pages: Array<
44
- Omit<PartialSiteAndPagesSchema["pages"][number], "attributes"> & {
45
- attributes?: AttributesSchema;
46
- }
47
- >;
48
- };
49
-
50
- export function createEmptyConfig(sitePrompt: string): SiteAndPagesConfig {
51
- return {
52
- site: {
53
- id: crypto.randomUUID(),
54
- label: "New site",
55
- hostname: "example.com",
56
- sitePrompt,
57
- theme: defaultTheme,
58
- themes: [],
59
- sitemap: [],
60
- attributes: defaultAttributesSchema,
61
- attr: resolveAttributes(),
62
- },
63
- // we need a fake page
64
- pages: [
65
- {
66
- id: "_default_",
67
- label: "First page",
68
- path: "/",
69
- sections: [
70
- // {
71
- // id: nanoid(),
72
- // label: "Hero Section",
73
- // order: 1,
74
- // props: {},
75
- // bricks: [
76
- // {
77
- // id: crypto.randomUUID(),
78
- // type: "navbar",
79
- // props: {
80
- // brand: {
81
- // name: "My Site",
82
- // },
83
- // navigation: {
84
- // staticItems: [{ urlOrPageId: "/about" }, { urlOrPageId: "/contact" }],
85
- // },
86
- // },
87
- // },
88
- // ],
89
- // },
90
- ],
91
- tags: [],
92
- attributes: defaultAttributesSchema,
93
- attr: resolveAttributes(),
94
- },
95
- ],
96
- };
97
- }
@@ -1,66 +0,0 @@
1
- import { Type, type Static } from "@sinclair/typebox";
2
- import { StringEnum } from "./utils/schema";
3
-
4
- export const pageInfoSchema = Type.Object(
5
- {
6
- id: Type.String({ title: "Page ID" }),
7
- label: Type.String(),
8
- path: Type.String(),
9
- },
10
- { additionalProperties: false },
11
- );
12
-
13
- export type PageInfo = Static<typeof pageInfoSchema>;
14
-
15
- export const sectionsPlanSchema = Type.Array(
16
- Type.Object(
17
- {
18
- id: Type.String({ title: "Section ID (slug format)" }),
19
- name: Type.String({ title: "Section name" }),
20
- description: Type.String({
21
- title: "A long description of the section",
22
- description: `You must elaborate a clear and detailled plan that describes:
23
- - The section purpose in the page, in detail.
24
- - The section structure, look & feel, and structural/design organization, in detail
25
- - the types of bricks (e.g. "container", "text", "video", "carousel", etc) that will be used and their purpose, in detail
26
-
27
- IMPORTANT: be very descriptive and precise in your plan. The more details you provide, the better the generated page will be.`,
28
- }),
29
- },
30
- { additionalProperties: false },
31
- ),
32
- {
33
- title: "Sections plan",
34
- description: "A plan for the sections of the page. Used to generate the page content.",
35
- },
36
- );
37
-
38
- export const sitemapEntry = Type.Composite(
39
- [
40
- pageInfoSchema,
41
- Type.Object({
42
- tags: Type.Array(Type.String(), {
43
- default: [],
44
- description:
45
- "Tags for the page. Use the tag 'main-nav' for pages that should appear in the main navbar",
46
- }),
47
- status: Type.Optional(
48
- StringEnum(["draft", "published"], {
49
- title: "Page status",
50
- enumNames: ["Draft", "Published"],
51
- description:
52
- "The status of the page. Can be draft or published. [AI instructions: Dont generate this.]",
53
- "ai:instructions": "Do not generate this.",
54
- }),
55
- ),
56
- sectionsPlan: sectionsPlanSchema,
57
- }),
58
- ],
59
- {
60
- description: "Pages map. The complete list of site pages, their metadata and their sections summary",
61
- additionalProperties: false,
62
- },
63
- );
64
- export const sitemapSchema = Type.Array(sitemapEntry);
65
-
66
- export type Sitemap = Static<typeof sitemapSchema>;