@upstart.gg/sdk 0.0.130 → 0.0.132
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/shared/ai/schemas.d.ts +13 -0
- package/dist/shared/ai/schemas.d.ts.map +1 -0
- package/dist/shared/ai/schemas.js +3 -0
- package/dist/shared/ai/types.d.ts +170 -0
- package/dist/shared/ai/types.d.ts.map +1 -0
- package/dist/shared/{chunk-EJGNYD4V.js → ai/types.js} +0 -1
- package/dist/shared/ajv.d.ts +2 -1
- package/dist/shared/ajv.d.ts.map +1 -1
- package/dist/shared/ajv.js +1 -1
- package/dist/shared/attributes.d.ts +300 -12
- package/dist/shared/attributes.d.ts.map +1 -1
- package/dist/shared/attributes.js +1 -1
- package/dist/shared/brick-manifest.d.ts +3 -1
- package/dist/shared/brick-manifest.d.ts.map +1 -1
- package/dist/shared/brick-manifest.js +1 -1
- package/dist/shared/bricks/manifests/accordion.manifest.d.ts +4 -3
- package/dist/shared/bricks/manifests/accordion.manifest.d.ts.map +1 -1
- package/dist/shared/bricks/manifests/accordion.manifest.js +1 -1
- package/dist/shared/bricks/manifests/all-manifests.d.ts +4 -1
- package/dist/shared/bricks/manifests/all-manifests.d.ts.map +1 -1
- package/dist/shared/bricks/manifests/all-manifests.js +1 -1
- package/dist/shared/bricks/manifests/box.manifest.d.ts +6 -4
- package/dist/shared/bricks/manifests/box.manifest.d.ts.map +1 -1
- package/dist/shared/bricks/manifests/box.manifest.js +1 -1
- package/dist/shared/bricks/manifests/button.manifest.d.ts +4 -3
- package/dist/shared/bricks/manifests/button.manifest.d.ts.map +1 -1
- package/dist/shared/bricks/manifests/button.manifest.js +1 -1
- package/dist/shared/bricks/manifests/card.manifest.d.ts +6 -5
- package/dist/shared/bricks/manifests/card.manifest.d.ts.map +1 -1
- package/dist/shared/bricks/manifests/card.manifest.js +1 -1
- package/dist/shared/bricks/manifests/carousel.manifest.d.ts +6 -5
- package/dist/shared/bricks/manifests/carousel.manifest.d.ts.map +1 -1
- package/dist/shared/bricks/manifests/carousel.manifest.js +1 -1
- package/dist/shared/bricks/manifests/footer.manifest.d.ts +40 -5
- package/dist/shared/bricks/manifests/footer.manifest.d.ts.map +1 -1
- package/dist/shared/bricks/manifests/footer.manifest.js +1 -1
- package/dist/shared/bricks/manifests/form.manifest.d.ts +6 -5
- package/dist/shared/bricks/manifests/form.manifest.d.ts.map +1 -1
- package/dist/shared/bricks/manifests/form.manifest.js +1 -1
- package/dist/shared/bricks/manifests/hero.manifest.d.ts +4 -3
- package/dist/shared/bricks/manifests/hero.manifest.d.ts.map +1 -1
- package/dist/shared/bricks/manifests/hero.manifest.js +1 -1
- package/dist/shared/bricks/manifests/html.manifest.d.ts +3 -2
- package/dist/shared/bricks/manifests/html.manifest.d.ts.map +1 -1
- package/dist/shared/bricks/manifests/html.manifest.js +1 -1
- package/dist/shared/bricks/manifests/icon.manifest.d.ts +3 -2
- package/dist/shared/bricks/manifests/icon.manifest.d.ts.map +1 -1
- package/dist/shared/bricks/manifests/icon.manifest.js +1 -1
- package/dist/shared/bricks/manifests/image.manifest.d.ts +10 -6
- package/dist/shared/bricks/manifests/image.manifest.d.ts.map +1 -1
- package/dist/shared/bricks/manifests/image.manifest.js +1 -1
- package/dist/shared/bricks/manifests/images-gallery.manifest.d.ts +7 -6
- package/dist/shared/bricks/manifests/images-gallery.manifest.d.ts.map +1 -1
- package/dist/shared/bricks/manifests/images-gallery.manifest.js +1 -1
- package/dist/shared/bricks/manifests/map.manifest.d.ts +5 -4
- package/dist/shared/bricks/manifests/map.manifest.d.ts.map +1 -1
- package/dist/shared/bricks/manifests/map.manifest.js +1 -1
- package/dist/shared/bricks/manifests/navbar.manifest.d.ts +42 -8
- package/dist/shared/bricks/manifests/navbar.manifest.d.ts.map +1 -1
- package/dist/shared/bricks/manifests/navbar.manifest.js +1 -1
- package/dist/shared/bricks/manifests/sidebar.manifest.d.ts +4 -3
- package/dist/shared/bricks/manifests/sidebar.manifest.d.ts.map +1 -1
- package/dist/shared/bricks/manifests/sidebar.manifest.js +1 -1
- package/dist/shared/bricks/manifests/social-links.manifest.d.ts +5 -4
- package/dist/shared/bricks/manifests/social-links.manifest.d.ts.map +1 -1
- package/dist/shared/bricks/manifests/social-links.manifest.js +1 -1
- package/dist/shared/bricks/manifests/spacer.manifest.d.ts +3 -2
- package/dist/shared/bricks/manifests/spacer.manifest.d.ts.map +1 -1
- package/dist/shared/bricks/manifests/spacer.manifest.js +1 -1
- package/dist/shared/bricks/manifests/testimonials.manifest.d.ts +6 -5
- package/dist/shared/bricks/manifests/testimonials.manifest.d.ts.map +1 -1
- package/dist/shared/bricks/manifests/testimonials.manifest.js +1 -1
- package/dist/shared/bricks/manifests/text.manifest.d.ts +4 -3
- package/dist/shared/bricks/manifests/text.manifest.d.ts.map +1 -1
- package/dist/shared/bricks/manifests/text.manifest.js +1 -1
- package/dist/shared/bricks/manifests/video.manifest.d.ts +4 -3
- package/dist/shared/bricks/manifests/video.manifest.d.ts.map +1 -1
- package/dist/shared/bricks/manifests/video.manifest.js +1 -1
- package/dist/shared/bricks/props/align.d.ts.map +1 -1
- package/dist/shared/bricks/props/align.js +1 -1
- package/dist/shared/bricks/props/background.d.ts +6 -9
- package/dist/shared/bricks/props/background.d.ts.map +1 -1
- package/dist/shared/bricks/props/background.js +1 -1
- package/dist/shared/bricks/props/border.d.ts.map +1 -1
- package/dist/shared/bricks/props/border.js +1 -1
- package/dist/shared/bricks/props/color-preset.d.ts +3 -4
- package/dist/shared/bricks/props/color-preset.d.ts.map +1 -1
- package/dist/shared/bricks/props/color-preset.js +1 -1
- package/dist/shared/bricks/props/color.js +1 -1
- package/dist/shared/bricks/props/common.d.ts +6 -6
- package/dist/shared/bricks/props/common.d.ts.map +1 -1
- package/dist/shared/bricks/props/common.js +1 -1
- package/dist/shared/bricks/props/css-length.d.ts.map +1 -1
- package/dist/shared/bricks/props/css-length.js +1 -1
- package/dist/shared/bricks/props/datasource.d.ts +1 -1
- package/dist/shared/bricks/props/datasource.js +1 -1
- package/dist/shared/bricks/props/date.d.ts.map +1 -1
- package/dist/shared/bricks/props/date.js +1 -1
- package/dist/shared/bricks/props/direction.d.ts.map +1 -1
- package/dist/shared/bricks/props/direction.js +1 -1
- package/dist/shared/bricks/props/dynamic.d.ts.map +1 -1
- package/dist/shared/bricks/props/dynamic.js +1 -1
- package/dist/shared/bricks/props/effects.d.ts +0 -1
- package/dist/shared/bricks/props/effects.d.ts.map +1 -1
- package/dist/shared/bricks/props/effects.js +1 -1
- package/dist/shared/bricks/props/file.d.ts.map +1 -1
- package/dist/shared/bricks/props/file.js +1 -1
- package/dist/shared/bricks/props/geolocation.js +1 -1
- package/dist/shared/bricks/props/helpers.d.ts +2 -2
- package/dist/shared/bricks/props/helpers.js +1 -1
- package/dist/shared/bricks/props/image.d.ts +4 -4
- package/dist/shared/bricks/props/image.d.ts.map +1 -1
- package/dist/shared/bricks/props/image.js +1 -1
- package/dist/shared/bricks/props/position.d.ts +0 -2
- package/dist/shared/bricks/props/position.d.ts.map +1 -1
- package/dist/shared/bricks/props/position.js +1 -1
- package/dist/shared/bricks/props/string.js +1 -1
- package/dist/shared/bricks/props/tags.d.ts.map +1 -1
- package/dist/shared/bricks/props/tags.js +1 -1
- package/dist/shared/bricks/props/text.js +1 -1
- package/dist/shared/bricks/props/types.d.ts +1 -2
- package/dist/shared/bricks/props/types.d.ts.map +1 -1
- package/dist/shared/bricks.d.ts +189 -18
- package/dist/shared/bricks.d.ts.map +1 -1
- package/dist/shared/bricks.js +1 -1
- package/dist/shared/chunk-2CYAFF56.js +3 -0
- package/dist/shared/chunk-2NLDX5FG.js +3 -0
- package/dist/shared/chunk-3FPFR5RA.js +3 -0
- package/dist/shared/chunk-3P36LG6T.js +3 -0
- package/dist/shared/chunk-3QOAHMV4.js +5 -0
- package/dist/shared/chunk-46YDGGFF.js +3 -0
- package/dist/shared/chunk-4GIZ6WSG.js +3 -0
- package/dist/shared/chunk-5DZIQGY2.js +3 -0
- package/dist/shared/chunk-5WY7LYXK.js +3 -0
- package/dist/shared/chunk-5X5SX5N7.js +4 -0
- package/dist/shared/chunk-6L3Z5SZQ.js +3 -0
- package/dist/shared/{chunk-UU2MSQXY.js → chunk-6PGAWO4H.js} +1 -1
- package/dist/shared/chunk-6R76KIHZ.js +3 -0
- package/dist/shared/chunk-7UBMXMNJ.js +3 -0
- package/dist/shared/chunk-AB3IMRXZ.js +3 -0
- package/dist/shared/chunk-AMQAGDFH.js +3 -0
- package/dist/shared/chunk-ARMM6B47.js +3 -0
- package/dist/shared/chunk-ARYG4XMX.js +3 -0
- package/dist/shared/chunk-AZHH3XJJ.js +3 -0
- package/dist/shared/chunk-DHSWVVMI.js +3 -0
- package/dist/shared/chunk-DKNOZLA6.js +3 -0
- package/dist/shared/chunk-EVDZ2KND.js +6 -0
- package/dist/shared/chunk-F4JNKU7J.js +3 -0
- package/dist/shared/chunk-GC5OWY2Z.js +3 -0
- package/dist/shared/chunk-HP7CZB2F.js +3 -0
- package/dist/shared/chunk-HSRXUIVM.js +3 -0
- package/dist/shared/chunk-ILIWVWHC.js +8 -0
- package/dist/shared/chunk-JRCVYDCD.js +3 -0
- package/dist/shared/chunk-K5ADUHF4.js +3 -0
- package/dist/shared/chunk-L2HOZVBC.js +3 -0
- package/dist/shared/chunk-LEWKHCRI.js +3 -0
- package/dist/shared/chunk-LT4CW2F7.js +3 -0
- package/dist/shared/chunk-ML4JSDQM.js +34 -0
- package/dist/shared/chunk-MVCVVKBY.js +3 -0
- package/dist/shared/chunk-NKIEDT7V.js +3 -0
- package/dist/shared/chunk-NQKXDMQ5.js +3 -0
- package/dist/shared/chunk-PO6UODZ5.js +8 -0
- package/dist/shared/chunk-PW5HRVMD.js +3 -0
- package/dist/shared/chunk-PZYX3ACO.js +3 -0
- package/dist/shared/chunk-QGFQA7OZ.js +4 -0
- package/dist/shared/chunk-RJZZWCBD.js +3 -0
- package/dist/shared/chunk-SAJY7H6N.js +3 -0
- package/dist/shared/chunk-SFDRAHYP.js +3 -0
- package/dist/shared/chunk-STDCM2KD.js +3 -0
- package/dist/shared/chunk-TH5SONR6.js +3 -0
- package/dist/shared/chunk-UCR2UZOY.js +3 -0
- package/dist/shared/chunk-UDQWYGSO.js +3 -0
- package/dist/shared/{chunk-LSPN22SI.js → chunk-URRCKLAS.js} +3 -3
- package/dist/shared/{chunk-OIOYMECS.js → chunk-US53TNMK.js} +1 -1
- package/dist/shared/chunk-VDX2J22H.js +3 -0
- package/dist/shared/chunk-VK26ZZFR.js +3 -0
- package/dist/shared/chunk-VLXZMESE.js +3 -0
- package/dist/shared/chunk-WAML3IGZ.js +3 -0
- package/dist/shared/chunk-WXKRIUTA.js +3 -0
- package/dist/shared/chunk-X62OEAE6.js +3 -0
- package/dist/shared/chunk-XED6ARVN.js +3 -0
- package/dist/shared/chunk-XZLBM4AX.js +3 -0
- package/dist/shared/chunk-Y3X4F4YJ.js +3 -0
- package/dist/shared/chunk-Z4YKRLOX.js +3 -0
- package/dist/shared/context.d.ts +4 -12
- package/dist/shared/context.d.ts.map +1 -1
- package/dist/shared/datarecords/external/airtable/handler.d.ts +22 -5
- package/dist/shared/datarecords/external/airtable/handler.d.ts.map +1 -1
- package/dist/shared/datarecords/external/airtable/handler.js +1 -1
- package/dist/shared/datarecords/external/airtable/oauth/config.js +3 -0
- package/dist/shared/datarecords/external/airtable/types.d.ts +25 -0
- package/dist/shared/datarecords/external/airtable/types.d.ts.map +1 -1
- package/dist/shared/datarecords/external/airtable/types.js +3 -0
- package/dist/shared/datarecords/external/generic-webhook/handler.js +3 -0
- package/dist/shared/datarecords/external/generic-webhook/options.js +3 -0
- package/dist/shared/datarecords/external/google/sheets/client.js +3 -0
- package/dist/shared/datarecords/external/google/sheets/handler.d.ts +29 -5
- package/dist/shared/datarecords/external/google/sheets/handler.d.ts.map +1 -1
- package/dist/shared/datarecords/external/google/sheets/handler.js +5 -4
- package/dist/shared/datarecords/external/google/sheets/{options.d.ts → types.d.ts} +1 -1
- package/dist/shared/datarecords/external/google/sheets/types.d.ts.map +1 -0
- package/dist/shared/datarecords/external/google/sheets/types.js +3 -0
- package/dist/shared/datarecords/external/notion/handler.d.ts +29 -7
- package/dist/shared/datarecords/external/notion/handler.d.ts.map +1 -1
- package/dist/shared/datarecords/external/notion/handler.js +1 -1
- package/dist/shared/datarecords/external/notion/oauth/config.js +3 -0
- package/dist/shared/datarecords/external/notion/{options.d.ts → types.d.ts} +11 -1
- package/dist/shared/datarecords/external/notion/types.d.ts.map +1 -0
- package/dist/shared/datarecords/external/notion/types.js +3 -0
- package/dist/shared/datarecords/types.d.ts +17 -165
- package/dist/shared/datarecords/types.d.ts.map +1 -1
- package/dist/shared/datarecords/types.js +1 -1
- package/dist/shared/datarecords.d.ts +2 -2
- package/dist/shared/datarecords.d.ts.map +1 -1
- package/dist/shared/datarecords.js +1 -1
- package/dist/shared/datasources/external/facebook/posts/fetcher.js +3 -0
- package/dist/shared/datasources/external/facebook/posts/schema.js +3 -0
- package/dist/shared/datasources/external/http-json/fetcher.js +3 -0
- package/dist/shared/datasources/external/http-json/options.js +3 -0
- package/dist/shared/datasources/external/http-json/schema.js +3 -0
- package/dist/shared/datasources/external/instagram/feed/fetcher.js +3 -0
- package/dist/shared/datasources/external/instagram/feed/schema.js +3 -0
- package/dist/shared/datasources/external/mastodon/account/fetcher.js +3 -0
- package/dist/shared/datasources/external/mastodon/account/schema.js +3 -0
- package/dist/shared/datasources/external/mastodon/options.js +3 -0
- package/dist/shared/datasources/external/mastodon/status/fetcher.js +3 -0
- package/dist/shared/datasources/external/mastodon/status/sample.array.js +3 -0
- package/dist/shared/datasources/external/mastodon/status/sample.single.js +3 -0
- package/dist/shared/datasources/external/mastodon/status/schema.d.ts.map +1 -1
- package/dist/shared/datasources/external/mastodon/status/schema.js +3 -0
- package/dist/shared/datasources/external/meta/options.js +3 -0
- package/dist/shared/datasources/external/rss/fetcher.js +3 -0
- package/dist/shared/datasources/external/rss/options.js +3 -0
- package/dist/shared/datasources/external/rss/schema.js +3 -0
- package/dist/shared/datasources/external/threads/media/fetcher.js +3 -0
- package/dist/shared/datasources/external/threads/media/schema.js +3 -0
- package/dist/shared/datasources/external/tiktok/video/fetcher.js +3 -0
- package/dist/shared/datasources/external/tiktok/video/options.js +3 -0
- package/dist/shared/datasources/external/tiktok/video/schema.js +3 -0
- package/dist/shared/datasources/external/youtube/list/fetcher.js +3 -0
- package/dist/shared/datasources/external/youtube/list/options.js +3 -0
- package/dist/shared/datasources/external/youtube/list/schema.js +3 -0
- package/dist/shared/datasources/fetcher.js +2 -0
- package/dist/shared/datasources/internal/blog/schema.js +3 -0
- package/dist/shared/datasources/internal/changelog/schema.js +3 -0
- package/dist/shared/datasources/internal/contact-info/schema.js +3 -0
- package/dist/shared/datasources/internal/cv/schema.js +3 -0
- package/dist/shared/datasources/internal/faq/schema.js +3 -0
- package/dist/shared/datasources/internal/job-board/schema.js +3 -0
- package/dist/shared/datasources/internal/links/schema.js +3 -0
- package/dist/shared/datasources/internal/recipes/schema.js +3 -0
- package/dist/shared/datasources/internal/restaurant/schema.js +3 -0
- package/dist/shared/datasources/samples.js +3 -0
- package/dist/shared/datasources/schemas.d.ts +0 -49
- package/dist/shared/datasources/schemas.d.ts.map +1 -1
- package/dist/shared/datasources/schemas.js +1 -1
- package/dist/shared/datasources/types.d.ts +53 -130
- package/dist/shared/datasources/types.d.ts.map +1 -1
- package/dist/shared/datasources/types.js +1 -1
- package/dist/shared/datasources/utils.js +3 -0
- package/dist/shared/datasources.d.ts +7 -4
- package/dist/shared/datasources.d.ts.map +1 -1
- package/dist/shared/datasources.js +1 -1
- package/dist/shared/errors.js +1 -1
- package/dist/shared/images.d.ts +1 -12
- package/dist/shared/images.d.ts.map +1 -1
- package/dist/shared/images.js +1 -1
- package/dist/shared/index.js +3 -0
- package/dist/shared/manifest.js +3 -0
- package/dist/shared/page.d.ts +143 -12
- package/dist/shared/page.d.ts.map +1 -1
- package/dist/shared/page.js +1 -1
- package/dist/shared/site.d.ts +224 -114
- package/dist/shared/site.d.ts.map +1 -1
- package/dist/shared/site.js +1 -1
- package/dist/shared/sitemap.d.ts +167 -23
- package/dist/shared/sitemap.d.ts.map +1 -1
- package/dist/shared/sitemap.js +1 -1
- package/dist/shared/social-icons.js +3 -0
- package/dist/shared/theme.d.ts +41 -4
- package/dist/shared/theme.d.ts.map +1 -1
- package/dist/shared/theme.js +1 -1
- package/dist/shared/utils/invariant.js +1 -1
- package/dist/shared/utils/llm.d.ts +19 -0
- package/dist/shared/utils/llm.d.ts.map +1 -0
- package/dist/shared/utils/llm.js +3 -0
- package/dist/shared/utils/schema.d.ts +6 -1
- package/dist/shared/utils/schema.d.ts.map +1 -1
- package/dist/shared/utils/schema.js +1 -1
- package/dist/shared/utils/tests/schema.test.d.ts +2 -0
- package/dist/shared/utils/tests/schema.test.d.ts.map +1 -0
- package/dist/shared/utils/typed-ref.d.ts +1 -6
- package/dist/shared/utils/typed-ref.d.ts.map +1 -1
- package/dist/shared/utils/typed-ref.js +1 -1
- package/package.json +18 -19
- package/src/shared/ai/schemas.ts +33 -0
- package/src/shared/ai/types.ts +155 -0
- package/src/shared/ajv.ts +123 -0
- package/src/shared/analytics/init.ts +14 -0
- package/src/shared/analytics/track.ts +21 -0
- package/src/shared/analytics/types.ts +13 -0
- package/src/shared/attributes.ts +396 -0
- package/src/shared/brick-manifest.ts +119 -0
- package/src/shared/bricks/manifests/accordion.manifest.ts +482 -0
- package/src/shared/bricks/manifests/all-manifests.ts +121 -0
- package/src/shared/bricks/manifests/box.manifest.ts +551 -0
- package/src/shared/bricks/manifests/button.manifest.ts +208 -0
- package/src/shared/bricks/manifests/card.manifest.ts +320 -0
- package/src/shared/bricks/manifests/carousel.manifest.ts +708 -0
- package/src/shared/bricks/manifests/footer.manifest.ts +509 -0
- package/src/shared/bricks/manifests/form.manifest.ts +226 -0
- package/src/shared/bricks/manifests/hero.manifest.ts +365 -0
- package/src/shared/bricks/manifests/html.manifest.ts +127 -0
- package/src/shared/bricks/manifests/icon.manifest.ts +164 -0
- package/src/shared/bricks/manifests/image.manifest.ts +378 -0
- package/src/shared/bricks/manifests/images-gallery.manifest.ts +822 -0
- package/src/shared/bricks/manifests/map.manifest.ts +215 -0
- package/src/shared/bricks/manifests/navbar.manifest.ts +361 -0
- package/src/shared/bricks/manifests/sidebar.manifest.ts +88 -0
- package/src/shared/bricks/manifests/social-links.manifest.ts +497 -0
- package/src/shared/bricks/manifests/spacer.manifest.ts +54 -0
- package/src/shared/bricks/manifests/testimonials.manifest.ts +480 -0
- package/src/shared/bricks/manifests/tests/header.manifest.test.ts +10 -0
- package/src/shared/bricks/manifests/text.manifest.ts +245 -0
- package/src/shared/bricks/manifests/video.manifest.ts +115 -0
- package/src/shared/bricks/props/align.ts +63 -0
- package/src/shared/bricks/props/background.ts +79 -0
- package/src/shared/bricks/props/boolean.ts +7 -0
- package/src/shared/bricks/props/border.ts +86 -0
- package/src/shared/bricks/props/color-preset.ts +390 -0
- package/src/shared/bricks/props/color.ts +40 -0
- package/src/shared/bricks/props/common.ts +64 -0
- package/src/shared/bricks/props/css-length.ts +32 -0
- package/src/shared/bricks/props/datarecord.ts +11 -0
- package/src/shared/bricks/props/datasource.ts +82 -0
- package/src/shared/bricks/props/date.ts +21 -0
- package/src/shared/bricks/props/direction.ts +21 -0
- package/src/shared/bricks/props/dynamic.ts +112 -0
- package/src/shared/bricks/props/effects.ts +71 -0
- package/src/shared/bricks/props/enum.ts +38 -0
- package/src/shared/bricks/props/file.ts +10 -0
- package/src/shared/bricks/props/geolocation.ts +36 -0
- package/src/shared/bricks/props/helpers.ts +73 -0
- package/src/shared/bricks/props/image.ts +96 -0
- package/src/shared/bricks/props/number.ts +8 -0
- package/src/shared/bricks/props/position.ts +11 -0
- package/src/shared/bricks/props/string.ts +72 -0
- package/src/shared/bricks/props/tags.ts +26 -0
- package/src/shared/bricks/props/tests/background.test.ts +90 -0
- package/src/shared/bricks/props/tests/border.test.ts +12 -0
- package/src/shared/bricks/props/tests/effects.test.ts +37 -0
- package/src/shared/bricks/props/tests/helpers.test.ts +98 -0
- package/src/shared/bricks/props/tests/image.test.ts +71 -0
- package/src/shared/bricks/props/tests/string.test.ts +80 -0
- package/src/shared/bricks/props/text.ts +107 -0
- package/src/shared/bricks/props/types.ts +72 -0
- package/src/shared/bricks.ts +1237 -0
- package/src/shared/context.ts +32 -0
- package/src/shared/datarecords/external/airtable/handler.ts +501 -0
- package/src/shared/datarecords/external/airtable/oauth/config.ts +11 -0
- package/src/shared/datarecords/external/airtable/types.ts +63 -0
- package/src/shared/datarecords/external/generic-webhook/handler.ts +10 -0
- package/src/shared/datarecords/external/generic-webhook/options.ts +13 -0
- package/src/shared/datarecords/external/google/oauth/config.ts +30 -0
- package/src/shared/datarecords/external/google/sheets/client.ts +112 -0
- package/src/shared/datarecords/external/google/sheets/handler.ts +253 -0
- package/src/shared/datarecords/external/google/sheets/types.ts +10 -0
- package/src/shared/datarecords/external/notion/handler.ts +469 -0
- package/src/shared/datarecords/external/notion/oauth/config.ts +7 -0
- package/src/shared/datarecords/external/notion/types.ts +28 -0
- package/src/shared/datarecords/types.ts +165 -0
- package/src/shared/datarecords.ts +5 -0
- package/src/shared/datasources/README.md +3 -0
- package/src/shared/datasources/external/facebook/posts/fetcher.ts +52 -0
- package/src/shared/datasources/external/facebook/posts/sample.ts +35 -0
- package/src/shared/datasources/external/facebook/posts/schema.ts +33 -0
- package/src/shared/datasources/external/facebook/posts/tests/fetcher.test.ts +73 -0
- package/src/shared/datasources/external/http-json/fetcher.ts +31 -0
- package/src/shared/datasources/external/http-json/options.ts +8 -0
- package/src/shared/datasources/external/http-json/schema.ts +6 -0
- package/src/shared/datasources/external/http-json/tests/fetcher.test.ts +70 -0
- package/src/shared/datasources/external/instagram/feed/fetcher.ts +33 -0
- package/src/shared/datasources/external/instagram/feed/sample.ts +22 -0
- package/src/shared/datasources/external/instagram/feed/schema.ts +23 -0
- package/src/shared/datasources/external/instagram/feed/tests/fetcher.test.ts +64 -0
- package/src/shared/datasources/external/mastodon/account/fetcher.ts +24 -0
- package/src/shared/datasources/external/mastodon/account/sample.ts +33 -0
- package/src/shared/datasources/external/mastodon/account/schema.ts +45 -0
- package/src/shared/datasources/external/mastodon/account/tests/fetcher.test.ts +47 -0
- package/src/shared/datasources/external/mastodon/options.ts +6 -0
- package/src/shared/datasources/external/mastodon/status/fetcher.ts +35 -0
- package/src/shared/datasources/external/mastodon/status/sample.array.ts +59 -0
- package/src/shared/datasources/external/mastodon/status/sample.single.ts +55 -0
- package/src/shared/datasources/external/mastodon/status/schema.ts +125 -0
- package/src/shared/datasources/external/mastodon/status/tests/fetcher.test.ts +74 -0
- package/src/shared/datasources/external/meta/oauth/config.ts +16 -0
- package/src/shared/datasources/external/meta/options.ts +7 -0
- package/src/shared/datasources/external/rss/fetcher.ts +31 -0
- package/src/shared/datasources/external/rss/options.ts +7 -0
- package/src/shared/datasources/external/rss/sample.ts +22 -0
- package/src/shared/datasources/external/rss/schema.ts +42 -0
- package/src/shared/datasources/external/threads/media/fetcher.ts +53 -0
- package/src/shared/datasources/external/threads/media/sample.ts +44 -0
- package/src/shared/datasources/external/threads/media/schema.ts +37 -0
- package/src/shared/datasources/external/tiktok/oauth/config.ts +17 -0
- package/src/shared/datasources/external/tiktok/video/fetcher.ts +39 -0
- package/src/shared/datasources/external/tiktok/video/options.ts +8 -0
- package/src/shared/datasources/external/tiktok/video/sample.ts +26 -0
- package/src/shared/datasources/external/tiktok/video/schema.ts +27 -0
- package/src/shared/datasources/external/youtube/list/fetcher.ts +37 -0
- package/src/shared/datasources/external/youtube/list/options.ts +11 -0
- package/src/shared/datasources/external/youtube/list/sample.ts +33 -0
- package/src/shared/datasources/external/youtube/list/schema.ts +38 -0
- package/src/shared/datasources/external/youtube/oauth/config.ts +15 -0
- package/src/shared/datasources/fetcher.ts +16 -0
- package/src/shared/datasources/internal/blog/schema.ts +69 -0
- package/src/shared/datasources/internal/changelog/schema.ts +48 -0
- package/src/shared/datasources/internal/contact-info/schema.ts +20 -0
- package/src/shared/datasources/internal/cv/schema.ts +217 -0
- package/src/shared/datasources/internal/faq/schema.ts +27 -0
- package/src/shared/datasources/internal/job-board/schema.ts +228 -0
- package/src/shared/datasources/internal/links/schema.ts +15 -0
- package/src/shared/datasources/internal/recipes/schema.ts +42 -0
- package/src/shared/datasources/internal/restaurant/schema.ts +225 -0
- package/src/shared/datasources/samples.ts +26 -0
- package/src/shared/datasources/schemas.ts +48 -0
- package/src/shared/datasources/types.ts +490 -0
- package/src/shared/datasources/utils.ts +17 -0
- package/src/shared/datasources.ts +57 -0
- package/src/shared/env.ts +23 -0
- package/src/shared/errors.ts +1 -0
- package/src/shared/images.ts +44 -0
- package/src/shared/index.ts +3 -0
- package/src/shared/layout-constants.ts +19 -0
- package/src/shared/manifest.ts +50 -0
- package/src/shared/oauth.ts +16 -0
- package/src/shared/page.ts +36 -0
- package/src/shared/prompt.ts +9 -0
- package/src/shared/responsive.ts +5 -0
- package/src/shared/site.ts +59 -0
- package/src/shared/sitemap.ts +98 -0
- package/src/shared/social-icons.ts +307 -0
- package/src/shared/tests/attributes.test.ts +31 -0
- package/src/shared/theme.ts +244 -0
- package/src/shared/themes/README.md +34 -0
- package/src/shared/themes/color-system.ts +146 -0
- package/src/shared/themes/tests/color-system.test.ts +170 -0
- package/src/shared/utils/canvas-data-uri.ts +2 -0
- package/src/shared/utils/invariant.ts +25 -0
- package/src/shared/utils/json-date.ts +8 -0
- package/src/shared/utils/llm.ts +282 -0
- package/src/shared/utils/merge.ts +12 -0
- package/src/shared/utils/object-hash.ts +7 -0
- package/src/shared/utils/schema.ts +359 -0
- package/src/shared/utils/string-enum.ts +12 -0
- package/src/shared/utils/tests/schema.test.ts +724 -0
- package/src/shared/utils/try-catch.ts +12 -0
- package/src/shared/utils/typed-ref.ts +53 -0
- package/dist/shared/bricks/props/container.d.ts +0 -11
- package/dist/shared/bricks/props/container.d.ts.map +0 -1
- package/dist/shared/bricks/props/container.js +0 -3
- package/dist/shared/bricks/props/gap.d.ts +0 -9
- package/dist/shared/bricks/props/gap.d.ts.map +0 -1
- package/dist/shared/bricks/props/gap.js +0 -3
- package/dist/shared/bricks/props/padding.d.ts +0 -5
- package/dist/shared/bricks/props/padding.d.ts.map +0 -1
- package/dist/shared/bricks/props/padding.js +0 -3
- package/dist/shared/bricks/props/tests/padding.d.ts +0 -2
- package/dist/shared/bricks/props/tests/padding.d.ts.map +0 -1
- package/dist/shared/chunk-2IYSJYNE.js +0 -3
- package/dist/shared/chunk-3EM3B4DX.js +0 -3
- package/dist/shared/chunk-4TH3C76A.js +0 -3
- package/dist/shared/chunk-5N6MBJJ4.js +0 -3
- package/dist/shared/chunk-6FITVVZX.js +0 -3
- package/dist/shared/chunk-6WCGUAQN.js +0 -3
- package/dist/shared/chunk-7DMUDZ4H.js +0 -3
- package/dist/shared/chunk-ACVLF55Q.js +0 -3
- package/dist/shared/chunk-AQPN5SE2.js +0 -3
- package/dist/shared/chunk-BZGNY7LB.js +0 -3
- package/dist/shared/chunk-C3VGP4CA.js +0 -3
- package/dist/shared/chunk-CT3EI7YN.js +0 -3
- package/dist/shared/chunk-DQXDGV67.js +0 -3
- package/dist/shared/chunk-E22E4XWE.js +0 -3
- package/dist/shared/chunk-ETYYRWLK.js +0 -3
- package/dist/shared/chunk-EYPREFMH.js +0 -3
- package/dist/shared/chunk-FKNNTHWX.js +0 -5
- package/dist/shared/chunk-HHO3ONTQ.js +0 -3
- package/dist/shared/chunk-I46VBMLF.js +0 -3
- package/dist/shared/chunk-IIFTGWFZ.js +0 -3
- package/dist/shared/chunk-JS4K5JRM.js +0 -5
- package/dist/shared/chunk-KHFNN4P3.js +0 -3
- package/dist/shared/chunk-L6WHBSRZ.js +0 -8
- package/dist/shared/chunk-LFQZRGHS.js +0 -3
- package/dist/shared/chunk-LGP6GWIY.js +0 -3
- package/dist/shared/chunk-NLEWXPVM.js +0 -3
- package/dist/shared/chunk-NNI225RG.js +0 -3
- package/dist/shared/chunk-QISTDGPP.js +0 -3
- package/dist/shared/chunk-QSZWDE3D.js +0 -3
- package/dist/shared/chunk-RGLVKILY.js +0 -3
- package/dist/shared/chunk-SLRU4CT6.js +0 -4
- package/dist/shared/chunk-T3LIA4YB.js +0 -3
- package/dist/shared/chunk-T4LMBG2G.js +0 -3
- package/dist/shared/chunk-TATG6SFZ.js +0 -3
- package/dist/shared/chunk-TF3JVVRU.js +0 -3
- package/dist/shared/chunk-TTTXV7TJ.js +0 -6
- package/dist/shared/chunk-TWBY2GOR.js +0 -3
- package/dist/shared/chunk-UAQHU6L6.js +0 -3
- package/dist/shared/chunk-UHF6IEKV.js +0 -3
- package/dist/shared/chunk-UMHXXXVP.js +0 -3
- package/dist/shared/chunk-VGRYSAXA.js +0 -3
- package/dist/shared/chunk-VPFCY4DH.js +0 -3
- package/dist/shared/chunk-VZPXXFVX.js +0 -3
- package/dist/shared/chunk-WU6Q4WYD.js +0 -3
- package/dist/shared/chunk-X43MB5WD.js +0 -3
- package/dist/shared/chunk-YBGPPF7T.js +0 -3
- package/dist/shared/chunk-YFFTZ5T6.js +0 -3
- package/dist/shared/chunk-ZQGNYK5I.js +0 -8
- package/dist/shared/chunk-ZTDUXSWH.js +0 -3
- package/dist/shared/datarecords/external/airtable/client.d.ts +0 -8
- package/dist/shared/datarecords/external/airtable/client.d.ts.map +0 -1
- package/dist/shared/datarecords/external/airtable/elements.d.ts +0 -21
- package/dist/shared/datarecords/external/airtable/elements.d.ts.map +0 -1
- package/dist/shared/datarecords/external/airtable/options.d.ts +0 -10
- package/dist/shared/datarecords/external/airtable/options.d.ts.map +0 -1
- package/dist/shared/datarecords/external/google/sheets/options.d.ts.map +0 -1
- package/dist/shared/datarecords/external/notion/client.d.ts +0 -8
- package/dist/shared/datarecords/external/notion/client.d.ts.map +0 -1
- package/dist/shared/datarecords/external/notion/options.d.ts.map +0 -1
- package/dist/shared/datarecords/external/notion/utils.d.ts +0 -5
- package/dist/shared/datarecords/external/notion/utils.d.ts.map +0 -1
- package/dist/shared/utils/schema-resolver.d.ts +0 -3
- package/dist/shared/utils/schema-resolver.d.ts.map +0 -1
- package/dist/shared/utils/schema-resolver.js +0 -3
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { MastodonStatusArraySchema } from "./schema";
|
|
2
|
+
|
|
3
|
+
export const sample = [
|
|
4
|
+
{
|
|
5
|
+
account: {
|
|
6
|
+
acct: "Gargron",
|
|
7
|
+
avatar: "https://files.mastodon.social/accounts/avatars/000/000/001/original/7b7e3c3e3e7e3e3e.png",
|
|
8
|
+
avatar_static:
|
|
9
|
+
"https://files.mastodon.social/accounts/avatars/000/000/001/original/7b7e3c3e3e7e3e3e.png",
|
|
10
|
+
bot: false,
|
|
11
|
+
created_at: "2016-04-04T17:41:54.000Z",
|
|
12
|
+
display_name: "Eugen",
|
|
13
|
+
emojis: [
|
|
14
|
+
{
|
|
15
|
+
category: "custom",
|
|
16
|
+
shortcode: "blobawave",
|
|
17
|
+
static_url: "https://files.mastodon.social/custom_emojis/images/000/000/001/static/1f4a9.png",
|
|
18
|
+
url: "https://files.mastodon.social/custom_emojis/images/000/000/001/original/1f4a9.png",
|
|
19
|
+
visible_in_picker: true,
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
id: "1",
|
|
23
|
+
url: "https://mastodon.social/@Gargron",
|
|
24
|
+
username: "Gargron",
|
|
25
|
+
discoverable: true,
|
|
26
|
+
fields: [],
|
|
27
|
+
followers_count: 100,
|
|
28
|
+
following_count: 100,
|
|
29
|
+
group: false,
|
|
30
|
+
header: "https://files.mastodon.social/accounts/headers/000/000/001/original/7b7e3c3e3e7e3e3e.png",
|
|
31
|
+
header_static:
|
|
32
|
+
"https://files.mastodon.social/accounts/headers/000/000/001/original/7b7e3c3e3e7e3e3e.png",
|
|
33
|
+
last_status_at: "2021-06-26T18:00:00",
|
|
34
|
+
locked: false,
|
|
35
|
+
note: "Admin of mastodon.social",
|
|
36
|
+
noindex: false,
|
|
37
|
+
statuses_count: 100,
|
|
38
|
+
suspended: false,
|
|
39
|
+
},
|
|
40
|
+
content: "Hello, world!",
|
|
41
|
+
created_at: "2021-06-26T18:00:00",
|
|
42
|
+
id: "1",
|
|
43
|
+
media_attachments: [],
|
|
44
|
+
reblogs_count: 0,
|
|
45
|
+
replies_count: 0,
|
|
46
|
+
favourites_count: 0,
|
|
47
|
+
tags: [],
|
|
48
|
+
uri: "https://mastodon.social/@Gargron/1",
|
|
49
|
+
visibility: "public",
|
|
50
|
+
sensitive: false,
|
|
51
|
+
application: {
|
|
52
|
+
name: "Mastodon",
|
|
53
|
+
website: "https://joinmastodon.org",
|
|
54
|
+
},
|
|
55
|
+
mentions: [],
|
|
56
|
+
emojis: [],
|
|
57
|
+
url: "https://mastodon.social/@Gargron/1",
|
|
58
|
+
},
|
|
59
|
+
] satisfies MastodonStatusArraySchema;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { MastodonStatusSchema } from "./schema";
|
|
2
|
+
|
|
3
|
+
export const sample = {
|
|
4
|
+
account: {
|
|
5
|
+
acct: "Gargron",
|
|
6
|
+
avatar: "https://files.mastodon.social/accounts/avatars/000/000/001/original/7b7e3c3e3e7e3e3e.png",
|
|
7
|
+
avatar_static: "https://files.mastodon.social/accounts/avatars/000/000/001/original/7b7e3c3e3e7e3e3e.png",
|
|
8
|
+
bot: false,
|
|
9
|
+
created_at: "2016-04-04T17:41:54.000Z",
|
|
10
|
+
display_name: "Eugen",
|
|
11
|
+
emojis: [
|
|
12
|
+
{
|
|
13
|
+
category: "custom",
|
|
14
|
+
shortcode: "blobawave",
|
|
15
|
+
static_url: "https://files.mastodon.social/custom_emojis/images/000/000/001/static/1f4a9.png",
|
|
16
|
+
url: "https://files.mastodon.social/custom_emojis/images/000/000/001/original/1f4a9.png",
|
|
17
|
+
visible_in_picker: true,
|
|
18
|
+
},
|
|
19
|
+
],
|
|
20
|
+
id: "1",
|
|
21
|
+
url: "https://mastodon.social/@Gargron",
|
|
22
|
+
username: "Gargron",
|
|
23
|
+
discoverable: true,
|
|
24
|
+
fields: [],
|
|
25
|
+
followers_count: 100,
|
|
26
|
+
following_count: 100,
|
|
27
|
+
group: false,
|
|
28
|
+
header: "https://files.mastodon.social/accounts/headers/000/000/001/original/7b7e3c3e3e7e3e3e.png",
|
|
29
|
+
header_static: "https://files.mastodon.social/accounts/headers/000/000/001/original/7b7e3c3e3e7e3e3e.png",
|
|
30
|
+
last_status_at: "2021-06-26T18:00:00",
|
|
31
|
+
locked: false,
|
|
32
|
+
note: "Admin of mastodon.social",
|
|
33
|
+
noindex: false,
|
|
34
|
+
statuses_count: 100,
|
|
35
|
+
suspended: false,
|
|
36
|
+
},
|
|
37
|
+
content: "Hello, world!",
|
|
38
|
+
created_at: "2021-06-26T18:00:00",
|
|
39
|
+
id: "1",
|
|
40
|
+
media_attachments: [],
|
|
41
|
+
reblogs_count: 0,
|
|
42
|
+
replies_count: 0,
|
|
43
|
+
favourites_count: 0,
|
|
44
|
+
tags: [],
|
|
45
|
+
uri: "https://mastodon.social/@Gargron/1",
|
|
46
|
+
visibility: "public",
|
|
47
|
+
sensitive: false,
|
|
48
|
+
application: {
|
|
49
|
+
name: "Mastodon",
|
|
50
|
+
website: "https://joinmastodon.org",
|
|
51
|
+
},
|
|
52
|
+
mentions: [],
|
|
53
|
+
emojis: [],
|
|
54
|
+
url: "https://mastodon.social/@Gargron/1",
|
|
55
|
+
} satisfies MastodonStatusSchema;
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { Type, type Static } from "@sinclair/typebox";
|
|
2
|
+
import { mastodonAccountSchema } from "../account/schema";
|
|
3
|
+
|
|
4
|
+
const mastodonMediaAttachmentSchema = Type.Object({
|
|
5
|
+
id: Type.String(),
|
|
6
|
+
type: Type.Union([
|
|
7
|
+
Type.Literal("audio"),
|
|
8
|
+
Type.Literal("image"),
|
|
9
|
+
Type.Literal("video"),
|
|
10
|
+
Type.Literal("gifv"),
|
|
11
|
+
Type.Literal("unknown"),
|
|
12
|
+
]),
|
|
13
|
+
url: Type.String(),
|
|
14
|
+
preview_url: Type.Optional(Type.String()),
|
|
15
|
+
remote_url: Type.Optional(Type.String()),
|
|
16
|
+
meta: Type.Record(Type.String(), Type.Any()),
|
|
17
|
+
description: Type.Optional(Type.String()),
|
|
18
|
+
blurhash: Type.Optional(Type.String()),
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
const mastodonEmojiSchema = Type.Object({
|
|
22
|
+
shortcode: Type.String(),
|
|
23
|
+
url: Type.String(),
|
|
24
|
+
static_url: Type.String(),
|
|
25
|
+
visible_in_picker: Type.Boolean(),
|
|
26
|
+
category: Type.Optional(Type.String()),
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
const mastodonPreviewCardSchema = Type.Object({
|
|
30
|
+
url: Type.String(),
|
|
31
|
+
title: Type.String(),
|
|
32
|
+
description: Type.String(),
|
|
33
|
+
type: Type.Union([
|
|
34
|
+
Type.Literal("link"),
|
|
35
|
+
Type.Literal("photo"),
|
|
36
|
+
Type.Literal("video"),
|
|
37
|
+
Type.Literal("rich"),
|
|
38
|
+
]),
|
|
39
|
+
author_name: Type.String(),
|
|
40
|
+
author_url: Type.String(),
|
|
41
|
+
provider_name: Type.String(),
|
|
42
|
+
provider_url: Type.String(),
|
|
43
|
+
html: Type.String(),
|
|
44
|
+
width: Type.Number(),
|
|
45
|
+
height: Type.Number(),
|
|
46
|
+
image: Type.Optional(Type.String()),
|
|
47
|
+
embed_url: Type.String(),
|
|
48
|
+
blurhash: Type.Optional(Type.String()),
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
const mastodonPollSchema = Type.Object({
|
|
52
|
+
id: Type.String(),
|
|
53
|
+
expires_at: Type.String(),
|
|
54
|
+
expired: Type.Boolean(),
|
|
55
|
+
multiple: Type.Boolean(),
|
|
56
|
+
votes_count: Type.Number(),
|
|
57
|
+
options: Type.Array(
|
|
58
|
+
Type.Object({
|
|
59
|
+
title: Type.String(),
|
|
60
|
+
votes_count: Type.Number(),
|
|
61
|
+
}),
|
|
62
|
+
),
|
|
63
|
+
voted: Type.Optional(Type.Boolean()),
|
|
64
|
+
own_votes: Type.Optional(Type.Array(Type.Number())),
|
|
65
|
+
emojis: Type.Array(mastodonEmojiSchema),
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
export const mastodonStatusSchema = Type.Object({
|
|
69
|
+
id: Type.String(),
|
|
70
|
+
uri: Type.String(),
|
|
71
|
+
created_at: Type.String(),
|
|
72
|
+
account: mastodonAccountSchema,
|
|
73
|
+
content: Type.String(),
|
|
74
|
+
visibility: Type.Union([
|
|
75
|
+
Type.Literal("public"),
|
|
76
|
+
Type.Literal("unlisted"),
|
|
77
|
+
Type.Literal("private"),
|
|
78
|
+
Type.Literal("direct"),
|
|
79
|
+
]),
|
|
80
|
+
sensitive: Type.Boolean(),
|
|
81
|
+
media_attachments: Type.Array(mastodonMediaAttachmentSchema),
|
|
82
|
+
application: Type.Optional(
|
|
83
|
+
Type.Object({
|
|
84
|
+
name: Type.String(),
|
|
85
|
+
website: Type.Optional(Type.String()),
|
|
86
|
+
}),
|
|
87
|
+
),
|
|
88
|
+
mentions: Type.Array(
|
|
89
|
+
Type.Object({
|
|
90
|
+
id: Type.String(),
|
|
91
|
+
username: Type.String(),
|
|
92
|
+
acct: Type.String(),
|
|
93
|
+
url: Type.String(),
|
|
94
|
+
}),
|
|
95
|
+
),
|
|
96
|
+
tags: Type.Array(
|
|
97
|
+
Type.Object({
|
|
98
|
+
name: Type.String(),
|
|
99
|
+
url: Type.String(),
|
|
100
|
+
}),
|
|
101
|
+
),
|
|
102
|
+
emojis: Type.Array(mastodonEmojiSchema),
|
|
103
|
+
reblogs_count: Type.Number(),
|
|
104
|
+
favourites_count: Type.Number(),
|
|
105
|
+
replies_count: Type.Number(),
|
|
106
|
+
url: Type.String(),
|
|
107
|
+
in_reply_to_id: Type.Optional(Type.String()),
|
|
108
|
+
in_reply_to_account_id: Type.Optional(Type.String()),
|
|
109
|
+
reblog: Type.Optional(Type.Ref("mastodonStatus")),
|
|
110
|
+
poll: Type.Optional(mastodonPollSchema),
|
|
111
|
+
card: Type.Optional(mastodonPreviewCardSchema),
|
|
112
|
+
language: Type.Optional(Type.String()),
|
|
113
|
+
text: Type.Optional(Type.String()),
|
|
114
|
+
edited_at: Type.Optional(Type.String()),
|
|
115
|
+
favourited: Type.Optional(Type.Boolean()),
|
|
116
|
+
reblogged: Type.Optional(Type.Boolean()),
|
|
117
|
+
muted: Type.Optional(Type.Boolean()),
|
|
118
|
+
bookmarked: Type.Optional(Type.Boolean()),
|
|
119
|
+
pinned: Type.Optional(Type.Boolean()),
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
export type MastodonStatusSchema = Static<typeof mastodonStatusSchema>;
|
|
123
|
+
|
|
124
|
+
export const mastodonStatusArraySchema = Type.Array(mastodonStatusSchema);
|
|
125
|
+
export type MastodonStatusArraySchema = Static<typeof mastodonStatusArraySchema>;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { describe, it, expect, vi, beforeEach } from "vitest";
|
|
2
|
+
import fetchMastodonStatus from "../fetcher";
|
|
3
|
+
import { UnauthorizedError } from "~/shared/errors";
|
|
4
|
+
import { sample } from "../sample.array";
|
|
5
|
+
import fetchMastodonAccount from "../../account/fetcher";
|
|
6
|
+
import { sample as accountSample } from "../../account/sample";
|
|
7
|
+
|
|
8
|
+
// Mock the fetch function and fetchMastodonAccount
|
|
9
|
+
global.fetch = vi.fn();
|
|
10
|
+
// Mock the entire module
|
|
11
|
+
vi.mock("../../account/fetcher", () => ({
|
|
12
|
+
default: vi.fn(),
|
|
13
|
+
}));
|
|
14
|
+
|
|
15
|
+
describe("fetchMastodonStatus", () => {
|
|
16
|
+
beforeEach(() => {
|
|
17
|
+
vi.resetAllMocks();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it("should fetch Mastodon statuses successfully", async () => {
|
|
21
|
+
(global.fetch as any).mockResolvedValueOnce({
|
|
22
|
+
ok: true,
|
|
23
|
+
json: () => Promise.resolve(sample),
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
vi.mocked(fetchMastodonAccount).mockResolvedValueOnce(accountSample);
|
|
27
|
+
|
|
28
|
+
const result = await fetchMastodonStatus({
|
|
29
|
+
options: { username: "testuser" },
|
|
30
|
+
env: {},
|
|
31
|
+
pageConfig: {},
|
|
32
|
+
oauth: null,
|
|
33
|
+
} as any);
|
|
34
|
+
|
|
35
|
+
expect(result).toEqual(sample);
|
|
36
|
+
expect(global.fetch).toHaveBeenCalledWith("https://mastodon.social/api/v1/accounts/1/statuses");
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it("should throw UnauthorizedError on unauthorized response", async () => {
|
|
40
|
+
(global.fetch as any).mockResolvedValueOnce({
|
|
41
|
+
ok: false,
|
|
42
|
+
status: 401,
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
vi.mocked(fetchMastodonAccount).mockResolvedValueOnce(accountSample);
|
|
46
|
+
|
|
47
|
+
await expect(
|
|
48
|
+
fetchMastodonStatus({
|
|
49
|
+
options: { username: "testuser" },
|
|
50
|
+
env: {},
|
|
51
|
+
pageConfig: {},
|
|
52
|
+
oauth: null,
|
|
53
|
+
} as any),
|
|
54
|
+
).rejects.toThrow(UnauthorizedError);
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
it("should throw error on invalid response data", async () => {
|
|
58
|
+
const invalidResponse = [{ invalid: "data" }];
|
|
59
|
+
|
|
60
|
+
(global.fetch as any).mockResolvedValueOnce({
|
|
61
|
+
ok: true,
|
|
62
|
+
json: () => Promise.resolve(invalidResponse),
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
await expect(
|
|
66
|
+
fetchMastodonStatus({
|
|
67
|
+
options: { username: "testuser" },
|
|
68
|
+
env: {},
|
|
69
|
+
pageConfig: {},
|
|
70
|
+
oauth: null,
|
|
71
|
+
} as any),
|
|
72
|
+
).rejects.toThrow();
|
|
73
|
+
});
|
|
74
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Type, type Static, type StaticDecode } from "@sinclair/typebox";
|
|
2
|
+
import { buildOAuthConfigSchema } from "~/shared/oauth";
|
|
3
|
+
|
|
4
|
+
const metaOAuthConfig = Type.Object({
|
|
5
|
+
type: Type.Union([Type.Literal("short-lived"), Type.Literal("long-lived")]),
|
|
6
|
+
accessToken: Type.String(),
|
|
7
|
+
userId: Type.String(),
|
|
8
|
+
permissions: Type.Array(Type.String()),
|
|
9
|
+
expiresIn: Type.Number(),
|
|
10
|
+
tokenType: Type.String(),
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export type MetaOAuthConfig = Static<typeof metaOAuthConfig>;
|
|
14
|
+
|
|
15
|
+
const metaFullOAuthConfig = buildOAuthConfigSchema(metaOAuthConfig);
|
|
16
|
+
export type MetaFullOAuthConfig = StaticDecode<typeof metaFullOAuthConfig>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { RssOptions } from "./options";
|
|
2
|
+
import { parseFeed } from "@rowanmanning/feed-parser";
|
|
3
|
+
import type { RssSchema } from "./schema";
|
|
4
|
+
import type { DatasourceFetcher } from "../../fetcher";
|
|
5
|
+
import { createPlaceholderReplacer, placeholderRx } from "../../utils";
|
|
6
|
+
|
|
7
|
+
const fetchRss: DatasourceFetcher<RssSchema, null, RssOptions> = async ({
|
|
8
|
+
options,
|
|
9
|
+
pageAttributes: attr,
|
|
10
|
+
}) => {
|
|
11
|
+
const replacer = createPlaceholderReplacer(attr);
|
|
12
|
+
const url = options.url.replace(placeholderRx, replacer);
|
|
13
|
+
const content = await (await fetch(url)).text();
|
|
14
|
+
const feed = parseFeed(content);
|
|
15
|
+
|
|
16
|
+
const newFeed: RssSchema =
|
|
17
|
+
feed?.items.map((item) => ({
|
|
18
|
+
...item,
|
|
19
|
+
pubDate: item.published ? item.published.toISOString() : new Date().toISOString(),
|
|
20
|
+
})) ?? [];
|
|
21
|
+
|
|
22
|
+
// const isValid = ajv.validate<RssSchema>(rssSchema, newFeed);
|
|
23
|
+
|
|
24
|
+
// if (!isValid) {
|
|
25
|
+
// throw new Error(`fetchRss Error: Invalid Feed data (${url}): ${serializeAjvErrors(ajv.errors)}`);
|
|
26
|
+
// }
|
|
27
|
+
|
|
28
|
+
return newFeed;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export default fetchRss;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { RssSchema } from "./schema";
|
|
2
|
+
|
|
3
|
+
export const sample = [
|
|
4
|
+
{
|
|
5
|
+
title: "Example title",
|
|
6
|
+
link: "https://example.com",
|
|
7
|
+
pubDate: "2022-01-01T00:00:00Z",
|
|
8
|
+
content: "Example content",
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
title: "Another example title",
|
|
12
|
+
link: "https://example.com",
|
|
13
|
+
pubDate: "2022-01-02T00:00:00Z",
|
|
14
|
+
content: "Another example content",
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
title: "Yet another example title",
|
|
18
|
+
link: "https://example.com",
|
|
19
|
+
pubDate: "2022-01-03T00:00:00Z",
|
|
20
|
+
content: "Yet another example content",
|
|
21
|
+
},
|
|
22
|
+
] as RssSchema;
|
|
@@ -0,0 +1,42 @@
|
|
|
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>;
|
|
@@ -0,0 +1,53 @@
|
|
|
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;
|
|
@@ -0,0 +1,44 @@
|
|
|
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;
|
|
@@ -0,0 +1,37 @@
|
|
|
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>;
|
|
@@ -0,0 +1,17 @@
|
|
|
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>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { TiktokVideoOptions } from "./options";
|
|
2
|
+
import type { 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 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;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Type, type Static } from "@sinclair/typebox";
|
|
2
|
+
|
|
3
|
+
export const tiktokVideoOptions = Type.Object({
|
|
4
|
+
maxCount: Type.Optional(Type.Number()),
|
|
5
|
+
refreshInterval: Type.Optional(Type.Number()),
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
export type TiktokVideoOptions = Static<typeof tiktokVideoOptions>;
|
|
@@ -0,0 +1,26 @@
|
|
|
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;
|