@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,42 +0,0 @@
1
- import { Type, type Static } from "@sinclair/typebox";
2
-
3
- export const rssSchema = Type.Array(
4
- Type.Object({
5
- title: Type.Optional(
6
- Type.String({
7
- title: "Title",
8
- description: "The title of the RSS feed item",
9
- }),
10
- ),
11
- link: Type.Optional(
12
- Type.String({
13
- title: "Link",
14
- description: "The link to the RSS feed item",
15
- }),
16
- ),
17
- creator: Type.Optional(
18
- Type.String({
19
- title: "Creator",
20
- description: "The creator of the RSS feed item",
21
- }),
22
- ),
23
- content: Type.Optional(
24
- Type.String({
25
- title: "Content",
26
- description: "The content of the RSS feed item",
27
- }),
28
- ),
29
- pubDate: Type.Optional(
30
- Type.String({
31
- title: "Pub Date",
32
- description: "The publication date of the RSS feed item",
33
- }),
34
- ),
35
- }),
36
- {
37
- title: "RSS Feed",
38
- description: "RSS feed items",
39
- },
40
- );
41
-
42
- export type RssSchema = Static<typeof rssSchema>;
@@ -1,53 +0,0 @@
1
- import { type ThreadsMediaSchema, threadsMediaSchema } from "./schema";
2
- import type { MetaFullOAuthConfig } from "~/shared/datasources/external/meta/oauth/config";
3
- import invariant from "~/shared/utils/invariant";
4
- import { UnauthorizedError } from "~/shared/errors";
5
- import type { MetaOptions } from "~/shared/datasources/external/meta/options";
6
- import { stringifyObjectValues } from "~/shared/datasources/utils";
7
- import type { DatasourceFetcher } from "~/shared/datasources/fetcher";
8
-
9
- /**
10
- * todo: add a way to retrieve media/posts from Threads for a given user other than "me"
11
- */
12
- const fetchThreadsMediaDatasource: DatasourceFetcher<
13
- ThreadsMediaSchema,
14
- MetaFullOAuthConfig,
15
- MetaOptions
16
- > = async ({ options, oauth }) => {
17
- invariant(oauth?.config, "fetchThreadsMediaDatasource Error: OAuth config is required");
18
-
19
- const params = new URLSearchParams({
20
- ...stringifyObjectValues(options),
21
- access_token: oauth.config.accessToken,
22
- fields: [
23
- "id",
24
- "media_product_type",
25
- "media_type",
26
- "media_url",
27
- "permalink",
28
- "owner",
29
- "username",
30
- "text",
31
- "timestamp",
32
- "shortcode",
33
- "thumbnail_url",
34
- "children",
35
- "is_quote_post",
36
- ].join(","),
37
- });
38
-
39
- const response = await fetch(`https://graph.threads.net/v1.0/me/threads?${params.toString()}`);
40
-
41
- if (!response.ok) {
42
- if (response.status === 401) {
43
- throw new UnauthorizedError(`fetchThreadsMediaDatasource Error: Unauthorized.`);
44
- }
45
- throw new Error(`fetchThreadsMediaDatasource Error: Response status: ${response.status}`);
46
- }
47
-
48
- const media = (await response.json()) as ThreadsMediaSchema;
49
-
50
- return media;
51
- };
52
-
53
- export default fetchThreadsMediaDatasource;
@@ -1,44 +0,0 @@
1
- import type { ThreadsMediaSchema } from "./schema";
2
-
3
- export const sample = {
4
- data: [
5
- {
6
- id: "1",
7
- is_quote_post: false,
8
- media_product_type: "THREADS",
9
- media_type: "IMAGE",
10
- media_url: "https://example.com/image.jpg",
11
- owner: {
12
- id: "1",
13
- },
14
- permalink: "https://example.com/post",
15
- shortcode: "123456",
16
- text: "Hello, world!",
17
- thumbnail_url: "https://example.com/thumbnail.jpg",
18
- timestamp: "2022-01-01T00:00:00Z",
19
- username: "example",
20
- },
21
- {
22
- id: "2",
23
- is_quote_post: false,
24
- media_product_type: "THREADS",
25
- media_type: "VIDEO",
26
- media_url: "https://example.com/video.mp4",
27
- owner: {
28
- id: "2",
29
- },
30
- permalink: "https://example.com/post",
31
- shortcode: "654321",
32
- text: "Goodbye, world!",
33
- thumbnail_url: "https://example.com/thumbnail.jpg",
34
- timestamp: "2022-01-02T00:00:00Z",
35
- username: "example",
36
- },
37
- ],
38
- paging: {
39
- cursors: {
40
- before: "",
41
- after: "",
42
- },
43
- },
44
- } satisfies ThreadsMediaSchema;
@@ -1,37 +0,0 @@
1
- import { Type, type Static } from "@sinclair/typebox";
2
-
3
- export const threadsMediaSchema = Type.Object({
4
- data: Type.Array(
5
- Type.Object({
6
- id: Type.String(),
7
- media_product_type: Type.Literal("THREADS"),
8
- media_type: Type.Union([
9
- Type.Literal("TEXT_POST"),
10
- Type.Literal("IMAGE"),
11
- Type.Literal("VIDEO"),
12
- Type.Literal("CAROUSEL_ALBUM"),
13
- Type.Literal("AUDIO"),
14
- Type.Literal("REPOST_FACADE"),
15
- ]),
16
- media_url: Type.String(),
17
- permalink: Type.String(),
18
- owner: Type.Object({
19
- id: Type.String(),
20
- }),
21
- username: Type.String(),
22
- text: Type.String(),
23
- timestamp: Type.String(),
24
- thumbnail_url: Type.String(),
25
- shortcode: Type.String(),
26
- is_quote_post: Type.Boolean(),
27
- }),
28
- ),
29
- paging: Type.Object({
30
- cursors: Type.Object({
31
- before: Type.String(),
32
- after: Type.String(),
33
- }),
34
- }),
35
- });
36
-
37
- export type ThreadsMediaSchema = Static<typeof threadsMediaSchema>;
@@ -1,17 +0,0 @@
1
- import { Type, type StaticDecode, type Static } from "@sinclair/typebox";
2
- import { buildOAuthConfigSchema } from "~/shared/oauth";
3
-
4
- const tiktokOAuthConfig = Type.Object({
5
- accessToken: Type.String(),
6
- expiresIn: Type.Number(),
7
- openId: Type.String(),
8
- refreshExpiresIn: Type.Number(),
9
- refreshToken: Type.String(),
10
- scope: Type.String(),
11
- tokenType: Type.String(),
12
- });
13
-
14
- export type TiktokOAuthConfig = Static<typeof tiktokOAuthConfig>;
15
-
16
- const tiktokFullOAuthConfig = buildOAuthConfigSchema(tiktokOAuthConfig);
17
- export type TiktokFullOAuthConfig = StaticDecode<typeof tiktokFullOAuthConfig>;
@@ -1,39 +0,0 @@
1
- import type { TiktokVideoOptions } from "./options";
2
- import { type TiktokVideoListSchema, tiktokVideoListSchema } from "./schema";
3
- import { UnauthorizedError } from "~/shared/errors";
4
- import type { TiktokFullOAuthConfig } from "../oauth/config";
5
- import type { DatasourceFetcher } from "~/shared/datasources/fetcher";
6
-
7
- const fetchTiktokVideoDatasource: DatasourceFetcher<
8
- TiktokVideoListSchema,
9
- TiktokFullOAuthConfig,
10
- TiktokVideoOptions
11
- > = async ({ options, oauth }) => {
12
- const params = new URLSearchParams({
13
- access_token: oauth.config.accessToken,
14
- fields: ["id", "title", "video_description", "duration", "cover_image_url", "embed_link"].join(","),
15
- });
16
-
17
- const url = `https://open.tiktokapis.com/v2/video/list/?${params.toString()}`;
18
- const { refreshInterval, ...body } = options;
19
- const response = await fetch(url, {
20
- method: "POST",
21
- headers: {
22
- "Content-Type": "application/json",
23
- Authorization: `Bearer ${oauth.config.accessToken}`,
24
- },
25
- body: JSON.stringify(body),
26
- });
27
-
28
- if (!response.ok) {
29
- if (response.status === 401) {
30
- throw new UnauthorizedError(`fetchTiktokVideoDatasource Error: Unauthorized.`);
31
- }
32
- throw new Error(`Response status: ${response.status}`);
33
- }
34
- const data = (await response.json()) as TiktokVideoListSchema;
35
-
36
- return data;
37
- };
38
-
39
- export default fetchTiktokVideoDatasource;
@@ -1,12 +0,0 @@
1
- import { Type, type Static } from "@sinclair/typebox";
2
- import { providerOptions } from "~/shared/datasources/provider-options";
3
-
4
- export const tiktokVideoOptions = Type.Composite([
5
- providerOptions,
6
- Type.Object({
7
- maxCount: Type.Optional(Type.Number()),
8
- refreshInterval: Type.Optional(Type.Number()),
9
- }),
10
- ]);
11
-
12
- export type TiktokVideoOptions = Static<typeof tiktokVideoOptions>;
@@ -1,26 +0,0 @@
1
- import type { TiktokVideoListSchema } from "./schema";
2
-
3
- export const sample = {
4
- data: {
5
- has_more: true,
6
- cursor: 1,
7
- videos: [
8
- {
9
- title: "Example title",
10
- video_description: "Example description",
11
- cover_image_url: "https://example.com/image.jpg",
12
- duration: 60,
13
- embed_link: "https://example.com/embed",
14
- id: "1",
15
- },
16
- {
17
- title: "Another example title",
18
- video_description: "Another example description",
19
- cover_image_url: "https://example.com/image.jpg",
20
- duration: 60,
21
- embed_link: "https://example.com/embed",
22
- id: "2",
23
- },
24
- ],
25
- },
26
- } satisfies TiktokVideoListSchema;
@@ -1,27 +0,0 @@
1
- import { Type, type Static } from "@sinclair/typebox";
2
-
3
- export const tiktokVideoListSchema = Type.Object({
4
- data: Type.Object({
5
- has_more: Type.Boolean(),
6
- cursor: Type.Number(),
7
- videos: Type.Array(
8
- Type.Object({
9
- title: Type.String(),
10
- video_description: Type.String(),
11
- cover_image_url: Type.String(),
12
- duration: Type.Number(),
13
- embed_link: Type.String(),
14
- id: Type.String(),
15
- }),
16
- ),
17
- }),
18
- error: Type.Optional(
19
- Type.Object({
20
- code: Type.String(),
21
- message: Type.String(),
22
- log_id: Type.String(),
23
- }),
24
- ),
25
- });
26
-
27
- export type TiktokVideoListSchema = Static<typeof tiktokVideoListSchema>;
@@ -1,37 +0,0 @@
1
- import type { YoutubeListOptions } from "./options";
2
- import type { YoutubeListSchema } from "./schema";
3
- import { UnauthorizedError } from "~/shared/errors";
4
- import { stringifyObjectValues } from "~/shared/datasources/utils";
5
- import type { YoutubeFullOAuthConfig } from "../oauth/config";
6
- import type { DatasourceFetcher } from "~/shared/datasources/fetcher";
7
-
8
- const fetchYoutubeList: DatasourceFetcher<
9
- YoutubeListSchema,
10
- YoutubeFullOAuthConfig,
11
- YoutubeListOptions
12
- > = async ({ options, oauth }) => {
13
- const params = new URLSearchParams({
14
- ...stringifyObjectValues(options),
15
- part: "snippet,id",
16
- type: "video",
17
- videoEmbeddable: "true",
18
- access_token: oauth.config.accessToken,
19
- });
20
-
21
- const url = `https://www.googleapis.com/youtube/v3/search?${params}`;
22
-
23
- const response = await fetch(url);
24
-
25
- if (!response.ok) {
26
- if (response.status === 401) {
27
- throw new UnauthorizedError(`fetchYoutubeList Error: Unauthorized.`);
28
- }
29
- throw new Error(`fetchYoutubeList Error: Response status: ${response.status}`);
30
- }
31
-
32
- const data = (await response.json()) as YoutubeListSchema;
33
-
34
- return data;
35
- };
36
-
37
- export default fetchYoutubeList;
@@ -1,15 +0,0 @@
1
- import { Type, type Static } from "@sinclair/typebox";
2
- import { providerOptions } from "~/shared/datasources/provider-options";
3
-
4
- export const youtubeListOptions = Type.Composite([
5
- providerOptions,
6
- Type.Object({
7
- channelId: Type.String(),
8
- order: Type.Optional(Type.String()),
9
- maxResults: Type.Optional(Type.Number()),
10
- regionCode: Type.Optional(Type.String()),
11
- relevanceLanguage: Type.Optional(Type.String()),
12
- }),
13
- ]);
14
-
15
- export type YoutubeListOptions = Static<typeof youtubeListOptions>;
@@ -1,33 +0,0 @@
1
- import type { YoutubeListSchema } from "./schema";
2
-
3
- export const sample = [
4
- {
5
- etag: "123456789",
6
- id: {
7
- videoId: "dQw4w9WgXcQ",
8
- channelId: "UCXuqSBlHAE6Xw-yeJA0Tunw",
9
- playlistId: "PLFgquLnL59alCl_2TQvOiD5Vgm1hCaGSI",
10
- },
11
- snippet: {
12
- channelId: "UCXuqSBlHAE6Xw-yeJA0Tunw",
13
- channelTitle: "RickAstleyVEVO",
14
- description:
15
- "Rick Astley's official music video for “Never Gonna Give You Up” Listen to Rick Astley: https://RickAstley.lnk.to/_listenYD Subscribe to the official Rick Astley YouTube channel: https://RickAstley.lnk.to/_subscribeYD Follow Rick Astley: Facebook: https://RickAstley.lnk.to/_followYD Twitter: https://RickAstley.lnk.to/_followYD Instagram: https://RickAstley.lnk.to/_followYD Website: https://RickAstley.lnk.to/_followYD Spotify: https://RickAstley.lnk.to/_followYD Lyrics: We're no strangers to love You know the rules and so do I A full commitment's what I'm thinking of You wouldn't get this from any other guy I just wanna tell you how I'm feeling Gotta make you understand Never gonna give you up Never gonna let you down Never gonna run around and desert you Never gonna make you cry Never gonna say goodbye Never gonna tell a lie and hurt you #RickAstley #NeverGonnaGiveYouUp #DancePop",
16
- liveBroadcastContent: "none",
17
- publishedAt: "2009-10-25",
18
- thumbnails: {
19
- default: {
20
- height: 90,
21
- url: "https://i.ytimg.com/vi/dQw4w9WgXcQ/default.jpg",
22
- width: 120,
23
- },
24
- standard: {
25
- height: 480,
26
- url: "https://i.ytimg.com/vi/dQw4w9WgXcQ/sddefault.jpg",
27
- width: 640,
28
- },
29
- },
30
- title: "Rick Astley - Never Gonna Give You Up (Official Music Video)",
31
- },
32
- },
33
- ] satisfies YoutubeListSchema;
@@ -1,38 +0,0 @@
1
- import { Type, type Static } from "@sinclair/typebox";
2
-
3
- export const youtubeListSchema = Type.Array(
4
- Type.Object({
5
- etag: Type.String(),
6
- id: Type.Object({
7
- videoId: Type.String(),
8
- channelId: Type.String(),
9
- playlistId: Type.String(),
10
- }),
11
- snippet: Type.Object({
12
- publishedAt: Type.String(),
13
- channelId: Type.String(),
14
- title: Type.String(),
15
- description: Type.String(),
16
- thumbnails: Type.Object({
17
- default: Type.Object({
18
- url: Type.String(),
19
- width: Type.Number(),
20
- height: Type.Number(),
21
- }),
22
- standard: Type.Object({
23
- url: Type.String(),
24
- width: Type.Number(),
25
- height: Type.Number(),
26
- }),
27
- }),
28
- channelTitle: Type.String(),
29
- liveBroadcastContent: Type.String(),
30
- }),
31
- }),
32
- {
33
- title: "Youtube list schema",
34
- description: "Schema for a list of Youtube videos",
35
- },
36
- );
37
-
38
- export type YoutubeListSchema = Static<typeof youtubeListSchema>;
@@ -1,15 +0,0 @@
1
- import { Type, type Static } from "@sinclair/typebox";
2
- import { buildOAuthConfigSchema } from "~/shared/oauth";
3
-
4
- const youtubeOAuthConfig = Type.Object({
5
- accessToken: Type.String(),
6
- expiresIn: Type.Number(),
7
- openId: Type.String(),
8
- refreshExpiresIn: Type.Number(),
9
- refreshToken: Type.String(),
10
- scope: Type.String(),
11
- tokenType: Type.String(),
12
- });
13
-
14
- const youtubeFullOAuthConfig = buildOAuthConfigSchema(youtubeOAuthConfig);
15
- export type YoutubeFullOAuthConfig = Static<typeof youtubeFullOAuthConfig>;
@@ -1,17 +0,0 @@
1
- import type { Attributes } from "../attributes";
2
- import type { ProviderOptions } from "./provider-options";
3
-
4
- export type DatasourceFetcherParams<
5
- OAuthProps = unknown,
6
- Opts extends Record<string, unknown> = ProviderOptions,
7
- > = {
8
- options: Opts;
9
- attr: Attributes;
10
- oauth: OAuthProps;
11
- };
12
-
13
- export type DatasourceFetcher<
14
- T = unknown,
15
- OAuthOpts = unknown,
16
- Opts extends Record<string, unknown> = ProviderOptions,
17
- > = (params: DatasourceFetcherParams<OAuthOpts, Opts>) => Promise<T>;
@@ -1,69 +0,0 @@
1
- import { Type, type Static } from "@sinclair/typebox";
2
-
3
- export const blogSchema = Type.Array(
4
- Type.Object({
5
- title: Type.String({
6
- title: "Title",
7
- description: "Blog post title",
8
- }),
9
- excerpt: Type.String({
10
- title: "Excerpt",
11
- description: "Short summary of the blog post",
12
- format: "markdown",
13
- }),
14
- image: Type.Optional(
15
- Type.String({
16
- title: "Image URL",
17
- format: "uri",
18
- description: "Blog post image",
19
- }),
20
- ),
21
- content: Type.String({
22
- title: "Content",
23
- description: "Blog post content",
24
- format: "markdown",
25
- }),
26
- author: Type.Object({
27
- name: Type.String({
28
- title: "Author Name",
29
- description: "Author's name",
30
- }),
31
- }),
32
- publishedAt: Type.String({
33
- title: "Published Date",
34
- format: "date",
35
- description: "Publication date in ISO format",
36
- }),
37
- slug: Type.String({
38
- title: "Slug",
39
- pattern: "^[a-z0-9]+(?:-[a-z0-9]+)*$",
40
- description: "URL-friendly version of the title",
41
- }),
42
- status: Type.Union([Type.Literal("draft"), Type.Literal("published"), Type.Literal("archived")], {
43
- title: "Status",
44
- description: "Publication status of the blog post",
45
- }),
46
- categories: Type.Optional(
47
- Type.Array(
48
- Type.String({
49
- title: "Categories",
50
- description: "Blog post categories",
51
- }),
52
- ),
53
- ),
54
- tags: Type.Optional(
55
- Type.Array(
56
- Type.String({
57
- title: "Tags",
58
- description: "Blog post tags",
59
- }),
60
- ),
61
- ),
62
- }),
63
- {
64
- title: "Blog Posts",
65
- description: "List of blog posts",
66
- },
67
- );
68
-
69
- export type BlogSchema = Static<typeof blogSchema>;
@@ -1,48 +0,0 @@
1
- import { Type, type Static } from "@sinclair/typebox";
2
-
3
- export const changelogSchema = Type.Array(
4
- Type.Object({
5
- title: Type.String({
6
- title: "Release Title",
7
- description: "Title of the release",
8
- }),
9
- version: Type.Optional(
10
- Type.String({
11
- title: "Version",
12
- description: "Version number",
13
- }),
14
- ),
15
- date: Type.String({
16
- title: "Release Date",
17
- format: "date",
18
- description: "Release date in ISO format",
19
- }),
20
- changes: Type.Array(
21
- Type.Object({
22
- type: Type.Union(
23
- [
24
- Type.Literal("added"),
25
- Type.Literal("changed"),
26
- Type.Literal("fixed"),
27
- Type.Literal("improved"),
28
- Type.Literal("deprecated"),
29
- Type.Literal("removed"),
30
- ],
31
- {
32
- title: "Change Type",
33
- },
34
- ),
35
- description: Type.String({
36
- title: "Description",
37
- format: "markdown",
38
- }),
39
- }),
40
- ),
41
- }),
42
- {
43
- title: "Changelog",
44
- description: "Changelog items",
45
- },
46
- );
47
-
48
- export type ChangelogSchema = Static<typeof changelogSchema>;
@@ -1,20 +0,0 @@
1
- import { Type, type Static } from "@sinclair/typebox";
2
- import { linksSchema } from "../links/schema";
3
-
4
- export const contactInfoSchema = Type.Object(
5
- {
6
- email: Type.String({ format: "email", title: "Email" }),
7
- phone: Type.Optional(Type.String({ title: "Phone" })),
8
- companyName: Type.Optional(Type.String({ title: "Company Name" })),
9
- firstName: Type.Optional(Type.String({ title: "First Name" })),
10
- lastName: Type.Optional(Type.String({ title: "Last Name" })),
11
- url: Type.Optional(Type.String({ format: "uri", title: "Website URL" })),
12
- address: Type.Optional(Type.String({ title: "Address" })),
13
- socialLinks: linksSchema,
14
- },
15
- {
16
- description: "A generic schema representing a person or company contact information",
17
- },
18
- );
19
-
20
- export type ContactInfo = Static<typeof contactInfoSchema>;