@upstart.gg/sdk 0.0.95 → 0.0.97
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/node/cli/api.js +2 -2
- package/dist/node/cli/api.js.map +1 -1
- package/dist/node/cli/commands/login/cmd-login.js +6 -6
- package/dist/node/cli/commands/login/cmd-login.js.map +1 -1
- package/dist/node/cli/commands/logout/cmd-logout.js +2 -2
- package/dist/node/cli/commands/publish/cmd-publish.d.ts.map +1 -1
- package/dist/node/cli/commands/publish/cmd-publish.js +18 -18
- package/dist/node/cli/commands/publish/cmd-publish.js.map +1 -1
- package/dist/node/cli/commands/publish/uploader.js +7 -7
- package/dist/node/cli/commands/publish/uploader.js.map +1 -1
- package/dist/node/cli/is-logged-in.js +2 -2
- package/dist/node/cli/is-logged-in.js.map +1 -1
- package/dist/node/cli/program.js +24 -24
- package/dist/node/cli/program.js.map +1 -1
- package/dist/node/shared/config.d.ts +4 -14
- package/dist/node/shared/config.d.ts.map +1 -1
- package/dist/node/shared/config.js +4 -4
- package/dist/node/shared/config.js.map +1 -1
- package/dist/node/shared/logger.d.ts.map +1 -1
- package/dist/node/shared/logger.js +2 -2
- package/dist/node/shared/logger.js.map +1 -1
- package/dist/shared/ajv.d.ts +2 -0
- package/dist/shared/ajv.d.ts.map +1 -1
- package/dist/shared/ajv.js +1 -1
- package/dist/shared/attributes.d.ts +45 -83
- package/dist/shared/attributes.d.ts.map +1 -1
- package/dist/shared/attributes.js +1 -1
- package/dist/shared/brick-manifest.d.ts +7 -17
- 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 +111 -0
- package/dist/shared/bricks/manifests/accordion.manifest.d.ts.map +1 -0
- package/dist/shared/bricks/manifests/accordion.manifest.js +3 -0
- package/dist/shared/bricks/manifests/all-manifests.d.ts +5 -0
- 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/button.manifest.d.ts +22 -13
- 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 +44 -54
- 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 +39 -12
- 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/container.manifest.d.ts +49 -172
- package/dist/shared/bricks/manifests/container.manifest.d.ts.map +1 -1
- package/dist/shared/bricks/manifests/container.manifest.js +1 -1
- package/dist/shared/bricks/manifests/divider.manifest.d.ts +63 -0
- package/dist/shared/bricks/manifests/divider.manifest.d.ts.map +1 -0
- package/dist/shared/bricks/manifests/divider.manifest.js +3 -0
- package/dist/shared/bricks/manifests/footer.manifest.d.ts +30 -35
- 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 +22 -12
- 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 +31 -71
- 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/icon.manifest.d.ts +18 -12
- 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 +36 -50
- 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 +55 -115
- 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 +36 -12
- 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 +160 -0
- package/dist/shared/bricks/manifests/navbar.manifest.d.ts.map +1 -0
- package/dist/shared/bricks/manifests/navbar.manifest.js +3 -0
- package/dist/shared/bricks/manifests/sidebar.manifest.d.ts +83 -12
- 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 +37 -12
- 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/testimonials.manifest.d.ts +94 -0
- package/dist/shared/bricks/manifests/testimonials.manifest.d.ts.map +1 -0
- package/dist/shared/bricks/manifests/testimonials.manifest.js +3 -0
- package/dist/shared/bricks/manifests/text.manifest.d.ts +31 -63
- 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/timeline.manifest.d.ts +122 -0
- package/dist/shared/bricks/manifests/timeline.manifest.d.ts.map +1 -0
- package/dist/shared/bricks/manifests/timeline.manifest.js +3 -0
- package/dist/shared/bricks/manifests/video.manifest.d.ts +38 -12
- 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/_style-presets.d.ts +1 -1
- package/dist/shared/bricks/props/_style-presets.d.ts.map +1 -1
- package/dist/shared/bricks/props/_style-presets.js +1 -1
- package/dist/shared/bricks/props/align.d.ts +7 -3
- 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 +8 -1
- 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/boolean.js +1 -1
- package/dist/shared/bricks/props/border.d.ts +24 -22
- 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.d.ts +5 -0
- package/dist/shared/bricks/props/color.d.ts.map +1 -0
- package/dist/shared/bricks/props/color.js +3 -0
- package/dist/shared/bricks/props/common.d.ts +9 -1
- 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/container.d.ts +37 -45
- package/dist/shared/bricks/props/container.d.ts.map +1 -1
- package/dist/shared/bricks/props/container.js +1 -1
- package/dist/shared/bricks/props/css-length.d.ts +5 -0
- package/dist/shared/bricks/props/css-length.d.ts.map +1 -0
- package/dist/shared/bricks/props/css-length.js +3 -0
- package/dist/shared/bricks/props/datasource.d.ts +9 -13
- package/dist/shared/bricks/props/datasource.d.ts.map +1 -1
- package/dist/shared/bricks/props/datasource.js +1 -1
- package/dist/shared/bricks/props/date.d.ts +4 -0
- package/dist/shared/bricks/props/date.d.ts.map +1 -0
- package/dist/shared/bricks/props/date.js +3 -0
- package/dist/shared/bricks/props/effects.d.ts +4 -21
- 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/enum.d.ts +13 -0
- package/dist/shared/bricks/props/enum.d.ts.map +1 -0
- package/dist/shared/bricks/props/enum.js +3 -0
- package/dist/shared/bricks/props/file.d.ts +2 -0
- package/dist/shared/bricks/props/file.d.ts.map +1 -0
- package/dist/shared/bricks/props/file.js +3 -0
- package/dist/shared/bricks/props/geolocation.d.ts +16 -0
- package/dist/shared/bricks/props/geolocation.d.ts.map +1 -0
- package/dist/shared/bricks/props/geolocation.js +3 -0
- package/dist/shared/bricks/props/helpers.d.ts +8 -4
- package/dist/shared/bricks/props/helpers.d.ts.map +1 -1
- package/dist/shared/bricks/props/helpers.js +1 -1
- package/dist/shared/bricks/props/image.d.ts +7 -1
- 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/number.js +1 -1
- package/dist/shared/bricks/props/padding.d.ts +2 -1
- package/dist/shared/bricks/props/padding.d.ts.map +1 -1
- package/dist/shared/bricks/props/padding.js +1 -1
- 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/preset.d.ts +92 -0
- package/dist/shared/bricks/props/preset.d.ts.map +1 -0
- package/dist/shared/bricks/props/preset.js +3 -0
- package/dist/shared/bricks/props/string.d.ts +8 -3
- package/dist/shared/bricks/props/string.d.ts.map +1 -1
- package/dist/shared/bricks/props/string.js +1 -1
- package/dist/shared/bricks/props/text.d.ts +3 -4
- package/dist/shared/bricks/props/text.d.ts.map +1 -1
- package/dist/shared/bricks/props/text.js +1 -1
- package/dist/shared/bricks/props/types.d.ts +5 -2
- package/dist/shared/bricks/props/types.d.ts.map +1 -1
- package/dist/shared/bricks.d.ts +243 -134
- package/dist/shared/bricks.d.ts.map +1 -1
- package/dist/shared/bricks.js +1 -1
- package/dist/shared/chunk-2AJYHJFG.js +8 -0
- package/dist/shared/chunk-2FHWS73Y.js +6 -0
- package/dist/shared/chunk-3FJVF357.js +3 -0
- package/dist/shared/chunk-3RHYJ6E7.js +5 -0
- package/dist/shared/chunk-3VZACK2Y.js +3 -0
- package/dist/shared/chunk-3XCKZ4JQ.js +3 -0
- package/dist/shared/chunk-4MPRHJWO.js +3 -0
- package/dist/shared/chunk-5EOWW7BX.js +4 -0
- package/dist/shared/chunk-5HYPCOSS.js +3 -0
- package/dist/shared/chunk-5K5C6XFX.js +3 -0
- package/dist/shared/chunk-6QS5PKLA.js +3 -0
- package/dist/shared/chunk-74EL657O.js +3 -0
- package/dist/shared/chunk-AJDYOLKP.js +3 -0
- package/dist/shared/chunk-ALFOZHAH.js +3 -0
- package/dist/shared/{chunk-FGU4BGP4.js → chunk-ATDJCXC2.js} +1 -1
- package/dist/shared/chunk-BJSO43AS.js +3 -0
- package/dist/shared/chunk-BTKLQQZA.js +3 -0
- package/dist/shared/chunk-CAVNF3BU.js +3 -0
- package/dist/shared/chunk-CCNU3J56.js +3 -0
- package/dist/shared/chunk-CTRS76PX.js +3 -0
- package/dist/shared/chunk-DCH2FI6T.js +8 -0
- package/dist/shared/chunk-DFSQR6QC.js +3 -0
- package/dist/shared/chunk-ENU4SEHO.js +3 -0
- package/dist/shared/chunk-G7LX3UKQ.js +3 -0
- package/dist/shared/chunk-GGJBTPGW.js +3 -0
- package/dist/shared/chunk-H24R3IWA.js +3 -0
- package/dist/shared/chunk-HYVQXAK5.js +3 -0
- package/dist/shared/chunk-LKVQQQTI.js +3 -0
- package/dist/shared/chunk-MITJPRGD.js +6 -0
- package/dist/shared/chunk-NLZBY65T.js +3 -0
- package/dist/shared/chunk-OUI2VDNM.js +3 -0
- package/dist/shared/chunk-OYIL5SCU.js +3 -0
- package/dist/shared/chunk-P5DZK4TS.js +3 -0
- package/dist/shared/chunk-PK3R5VOF.js +3 -0
- package/dist/shared/chunk-QPATZM3I.js +3 -0
- package/dist/shared/chunk-RDBEWW4G.js +7 -0
- package/dist/shared/chunk-RPBQZW5I.js +3 -0
- package/dist/shared/chunk-SLSIAUYV.js +3 -0
- package/dist/shared/chunk-SUG225LF.js +3 -0
- package/dist/shared/chunk-U5XOIYSS.js +3 -0
- package/dist/shared/{chunk-HIZPJNEM.js → chunk-UL7L3HYV.js} +1 -1
- package/dist/shared/chunk-V6BCYHZH.js +3 -0
- package/dist/shared/chunk-VA5LFJVE.js +3 -0
- package/dist/shared/chunk-VAC73HJE.js +3 -0
- package/dist/shared/chunk-VBWC36L2.js +3 -0
- package/dist/shared/chunk-VLGLD6GR.js +3 -0
- package/dist/shared/chunk-VTFWVTPI.js +3 -0
- package/dist/shared/chunk-WAAKB6OB.js +3 -0
- package/dist/shared/chunk-Y36SM2AO.js +3 -0
- package/dist/shared/chunk-Y7CEEEVW.js +3 -0
- package/dist/shared/chunk-YZ5Y4WE6.js +3 -0
- package/dist/shared/chunk-Z7SYP6FG.js +3 -0
- package/dist/shared/chunk-ZJNA4QQC.js +3 -0
- package/dist/shared/chunk-ZMDHKAWL.js +3 -0
- package/dist/shared/context.d.ts +38 -0
- package/dist/shared/context.d.ts.map +1 -0
- package/dist/shared/{chunk-WJ5CDDXW.js → context.js} +0 -1
- package/dist/shared/datarecords/types.d.ts +40 -20
- package/dist/shared/datarecords/types.d.ts.map +1 -1
- package/dist/shared/datarecords/types.js +1 -1
- package/dist/shared/datasources/external/http-json/fetcher.d.ts.map +1 -0
- package/dist/shared/datasources/external/http-json/options.d.ts.map +1 -0
- package/dist/shared/datasources/external/{json → http-json}/schema.d.ts +0 -1
- package/dist/shared/datasources/external/http-json/schema.d.ts.map +1 -0
- package/dist/shared/datasources/external/http-json/tests/fetcher.test.d.ts.map +1 -0
- package/dist/shared/datasources/external/rss/fetcher.d.ts.map +1 -1
- package/dist/shared/datasources/external/rss/sample.d.ts.map +1 -1
- package/dist/shared/datasources/external/rss/schema.d.ts +7 -13
- package/dist/shared/datasources/external/rss/schema.d.ts.map +1 -1
- package/dist/shared/datasources/external/youtube/list/sample.d.ts +23 -32
- package/dist/shared/datasources/external/youtube/list/sample.d.ts.map +1 -1
- package/dist/shared/datasources/external/youtube/list/schema.d.ts +24 -33
- package/dist/shared/datasources/external/youtube/list/schema.d.ts.map +1 -1
- package/dist/shared/datasources/internal/blog/schema.d.ts.map +1 -1
- package/dist/shared/datasources/internal/changelog/schema.d.ts.map +1 -1
- package/dist/shared/datasources/internal/recipes/schema.d.ts.map +1 -1
- package/dist/shared/datasources/samples.d.ts +1 -1
- package/dist/shared/datasources/samples.d.ts.map +1 -1
- package/dist/shared/datasources/schemas.d.ts +33 -583
- 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 +75 -1314
- package/dist/shared/datasources/types.d.ts.map +1 -1
- package/dist/shared/datasources/types.js +1 -1
- package/dist/shared/datasources.d.ts +14 -0
- package/dist/shared/datasources.d.ts.map +1 -1
- package/dist/shared/datasources.js +1 -1
- package/dist/shared/images.d.ts +30 -0
- package/dist/shared/images.d.ts.map +1 -0
- package/dist/shared/images.js +3 -0
- package/dist/shared/layout-constants.js +1 -1
- package/dist/shared/page.d.ts +110 -2676
- package/dist/shared/page.d.ts.map +1 -1
- package/dist/shared/page.js +1 -1
- package/dist/shared/prompt.d.ts +4 -0
- package/dist/shared/prompt.d.ts.map +1 -0
- package/dist/shared/prompt.js +3 -0
- package/dist/shared/responsive.d.ts +3 -3
- package/dist/shared/responsive.d.ts.map +1 -1
- package/dist/shared/responsive.js +1 -1
- package/dist/shared/site.d.ts +545 -0
- package/dist/shared/site.d.ts.map +1 -0
- package/dist/shared/site.js +3 -0
- package/dist/shared/sitemap.d.ts +38 -0
- package/dist/shared/sitemap.d.ts.map +1 -0
- package/dist/shared/sitemap.js +3 -0
- package/dist/shared/theme.d.ts +41 -19
- package/dist/shared/theme.d.ts.map +1 -1
- package/dist/shared/theme.js +1 -1
- package/dist/shared/themes/color-system.d.ts +5 -309
- package/dist/shared/themes/color-system.d.ts.map +1 -1
- package/dist/shared/themes/color-system.js +1 -1
- package/dist/shared/utils/invariant.js +1 -1
- package/dist/shared/utils/schema.d.ts +10 -1
- package/dist/shared/utils/schema.d.ts.map +1 -1
- package/dist/shared/utils/schema.js +1 -1
- package/dist/shared/utils/typed-ref.d.ts +32 -0
- package/dist/shared/utils/typed-ref.d.ts.map +1 -0
- package/dist/shared/utils/typed-ref.js +3 -0
- package/package.json +12 -12
- package/src/node/cli/api.ts +101 -0
- package/src/node/cli/commands/cmd-build.ts +64 -0
- package/src/node/cli/commands/login/cmd-login.ts +111 -0
- package/src/node/cli/commands/logout/cmd-logout.ts +11 -0
- package/src/node/cli/commands/publish/cmd-publish.ts +135 -0
- package/src/node/cli/commands/publish/parse-gitignore.ts +278 -0
- package/src/node/cli/commands/publish/uploader.ts +333 -0
- package/src/node/cli/constants.ts +14 -0
- package/src/node/cli/is-logged-in.ts +28 -0
- package/src/node/cli/program.ts +77 -0
- package/src/node/cli/store.ts +64 -0
- package/src/node/cli/tests/api.test.ts +161 -0
- package/src/node/cli/types.ts +34 -0
- package/src/node/cli/utils.ts +20 -0
- package/src/node/shared/config.ts +69 -0
- package/src/node/shared/logger.ts +44 -0
- package/src/shared/ajv.ts +111 -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 +222 -0
- package/src/shared/brick-manifest.ts +110 -0
- package/src/shared/bricks/manifests/accordion.manifest.ts +179 -0
- package/src/shared/bricks/manifests/all-manifests.ts +92 -0
- package/src/shared/bricks/manifests/button.manifest.ts +145 -0
- package/src/shared/bricks/manifests/card.manifest.ts +269 -0
- package/src/shared/bricks/manifests/carousel.manifest.ts +106 -0
- package/src/shared/bricks/manifests/container.manifest.ts +357 -0
- package/src/shared/bricks/manifests/divider.manifest.ts +121 -0
- package/src/shared/bricks/manifests/footer.manifest.ts +487 -0
- package/src/shared/bricks/manifests/form.manifest.ts +112 -0
- package/src/shared/bricks/manifests/hero.manifest.ts +132 -0
- package/src/shared/bricks/manifests/icon.manifest.ts +130 -0
- package/src/shared/bricks/manifests/image.manifest.ts +203 -0
- package/src/shared/bricks/manifests/images-gallery.manifest.ts +227 -0
- package/src/shared/bricks/manifests/map.manifest.ts +75 -0
- package/src/shared/bricks/manifests/navbar.manifest.ts +344 -0
- package/src/shared/bricks/manifests/sidebar.manifest.ts +90 -0
- package/src/shared/bricks/manifests/social-links.manifest.ts +370 -0
- package/src/shared/bricks/manifests/testimonials.manifest.ts +397 -0
- package/src/shared/bricks/manifests/tests/header.manifest.test.ts +10 -0
- package/src/shared/bricks/manifests/text.manifest.ts +164 -0
- package/src/shared/bricks/manifests/timeline.manifest.ts +456 -0
- package/src/shared/bricks/manifests/video.manifest.ts +59 -0
- package/src/shared/bricks/props/_style-presets.ts +352 -0
- package/src/shared/bricks/props/align.ts +59 -0
- package/src/shared/bricks/props/background.ts +118 -0
- package/src/shared/bricks/props/boolean.ts +11 -0
- package/src/shared/bricks/props/border.ts +84 -0
- package/src/shared/bricks/props/color.ts +24 -0
- package/src/shared/bricks/props/common.ts +37 -0
- package/src/shared/bricks/props/container.ts +356 -0
- package/src/shared/bricks/props/css-length.ts +25 -0
- package/src/shared/bricks/props/datasource.ts +60 -0
- package/src/shared/bricks/props/date.ts +24 -0
- package/src/shared/bricks/props/effects.ts +123 -0
- package/src/shared/bricks/props/enum.ts +42 -0
- package/src/shared/bricks/props/file.ts +12 -0
- package/src/shared/bricks/props/geolocation.ts +30 -0
- package/src/shared/bricks/props/helpers.ts +101 -0
- package/src/shared/bricks/props/image.ts +90 -0
- package/src/shared/bricks/props/number.ts +16 -0
- package/src/shared/bricks/props/padding.ts +21 -0
- package/src/shared/bricks/props/position.ts +27 -0
- package/src/shared/bricks/props/preset.ts +136 -0
- package/src/shared/bricks/props/string.ts +60 -0
- package/src/shared/bricks/props/tests/align.test.ts +37 -0
- package/src/shared/bricks/props/tests/background.test.ts +102 -0
- package/src/shared/bricks/props/tests/border.test.ts +38 -0
- package/src/shared/bricks/props/tests/effects.test.ts +37 -0
- package/src/shared/bricks/props/tests/helpers.test.ts +133 -0
- package/src/shared/bricks/props/tests/image.test.ts +71 -0
- package/src/shared/bricks/props/tests/padding.ts +12 -0
- package/src/shared/bricks/props/tests/string.test.ts +79 -0
- package/src/shared/bricks/props/text.ts +66 -0
- package/src/shared/bricks/props/types.ts +57 -0
- package/src/shared/bricks.ts +232 -0
- package/src/shared/context.ts +39 -0
- package/src/shared/datarecords/external/airtable/handler.ts +21 -0
- package/src/shared/datarecords/external/airtable/options.ts +22 -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/handler.ts +26 -0
- package/src/shared/datarecords/external/google/sheets/options.ts +9 -0
- package/src/shared/datarecords/types.ts +120 -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 +62 -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 +91 -0
- package/src/shared/datasources/external/http-json/fetcher.ts +28 -0
- package/src/shared/datasources/external/http-json/options.ts +12 -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 +43 -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 +82 -0
- package/src/shared/datasources/external/mastodon/account/fetcher.ts +33 -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 +65 -0
- package/src/shared/datasources/external/mastodon/options.ts +11 -0
- package/src/shared/datasources/external/mastodon/status/fetcher.ts +45 -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 +130 -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 +11 -0
- package/src/shared/datasources/external/rss/fetcher.ts +30 -0
- package/src/shared/datasources/external/rss/options.ts +11 -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 +63 -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 +49 -0
- package/src/shared/datasources/external/tiktok/video/options.ts +12 -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 +46 -0
- package/src/shared/datasources/external/youtube/list/options.ts +15 -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 +17 -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/provider-options.ts +7 -0
- package/src/shared/datasources/samples.ts +26 -0
- package/src/shared/datasources/schemas.ts +45 -0
- package/src/shared/datasources/types.ts +276 -0
- package/src/shared/datasources/utils.ts +16 -0
- package/src/shared/datasources.ts +42 -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 +25 -0
- package/src/shared/manifest.ts +50 -0
- package/src/shared/oauth.ts +16 -0
- package/src/shared/page.ts +61 -0
- package/src/shared/prompt.ts +9 -0
- package/src/shared/responsive.ts +5 -0
- package/src/shared/site.ts +97 -0
- package/src/shared/sitemap.ts +66 -0
- package/src/shared/social-icons.ts +307 -0
- package/src/shared/tests/attributes.test.ts +37 -0
- package/src/shared/theme.ts +245 -0
- package/src/shared/themes/README.md +34 -0
- package/src/shared/themes/color-system.ts +127 -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/merge.ts +12 -0
- package/src/shared/utils/object-hash.ts +7 -0
- package/src/shared/utils/schema.ts +30 -0
- package/src/shared/utils/try-catch.ts +12 -0
- package/src/shared/utils/typed-ref.ts +41 -0
- package/dist/shared/bricks/manifests/countdown.manifest.d.ts +0 -57
- package/dist/shared/bricks/manifests/countdown.manifest.d.ts.map +0 -1
- package/dist/shared/bricks/manifests/countdown.manifest.js +0 -3
- package/dist/shared/bricks/manifests/generic-component.manifest.d.ts +0 -62
- package/dist/shared/bricks/manifests/generic-component.manifest.d.ts.map +0 -1
- package/dist/shared/bricks/manifests/generic-component.manifest.js +0 -3
- package/dist/shared/bricks/manifests/header.manifest.d.ts +0 -275
- package/dist/shared/bricks/manifests/header.manifest.d.ts.map +0 -1
- package/dist/shared/bricks/manifests/header.manifest.js +0 -3
- package/dist/shared/bricks/props/_docs-common-styles.d.ts +0 -59
- package/dist/shared/bricks/props/_docs-common-styles.d.ts.map +0 -1
- package/dist/shared/bricks/props/_docs-common-styles.js +0 -3
- package/dist/shared/bricks/props/tests/container.test.d.ts +0 -2
- package/dist/shared/bricks/props/tests/container.test.d.ts.map +0 -1
- package/dist/shared/chunk-2ZPY4LCA.js +0 -3
- package/dist/shared/chunk-3CY6AZG7.js +0 -3
- package/dist/shared/chunk-4FLI7C3B.js +0 -3
- package/dist/shared/chunk-64II435T.js +0 -3
- package/dist/shared/chunk-6LDLGZUM.js +0 -3
- package/dist/shared/chunk-6MEWEGNA.js +0 -3
- package/dist/shared/chunk-AZ63RF3K.js +0 -3
- package/dist/shared/chunk-BK6LBWDI.js +0 -3
- package/dist/shared/chunk-BMDB2V7J.js +0 -3
- package/dist/shared/chunk-BXEKJXEP.js +0 -3
- package/dist/shared/chunk-DAPQ4JPP.js +0 -3
- package/dist/shared/chunk-ERSFH7XA.js +0 -3
- package/dist/shared/chunk-F2ZVIFHO.js +0 -3
- package/dist/shared/chunk-H6L4KRCJ.js +0 -3
- package/dist/shared/chunk-IKAMZM4I.js +0 -3
- package/dist/shared/chunk-IWSVY2VC.js +0 -3
- package/dist/shared/chunk-JVDUEZYO.js +0 -3
- package/dist/shared/chunk-KB4HY432.js +0 -3
- package/dist/shared/chunk-LDOM2LJF.js +0 -3
- package/dist/shared/chunk-P5FVZ5PL.js +0 -3
- package/dist/shared/chunk-PD7P5KSV.js +0 -3
- package/dist/shared/chunk-PJ6HA55L.js +0 -3
- package/dist/shared/chunk-PSSJMWGU.js +0 -3
- package/dist/shared/chunk-Q4MXTCE4.js +0 -8
- package/dist/shared/chunk-QCQH5WLN.js +0 -3
- package/dist/shared/chunk-RBYYMUOZ.js +0 -3
- package/dist/shared/chunk-RHRJYPU3.js +0 -3
- package/dist/shared/chunk-S64XUCWM.js +0 -3
- package/dist/shared/chunk-SO5M7CYA.js +0 -3
- package/dist/shared/chunk-SQVL4WSX.js +0 -3
- package/dist/shared/chunk-SWGSHUTE.js +0 -3
- package/dist/shared/chunk-U44NTSIO.js +0 -3
- package/dist/shared/chunk-U4R5EGBK.js +0 -3
- package/dist/shared/chunk-U5WW6K7W.js +0 -3
- package/dist/shared/chunk-V2NS45PF.js +0 -3
- package/dist/shared/chunk-WOEBR25A.js +0 -3
- package/dist/shared/chunk-WPTVLIYS.js +0 -3
- package/dist/shared/chunk-WXKRIUTA.js +0 -3
- package/dist/shared/chunk-XBX6II3M.js +0 -3
- package/dist/shared/chunk-XGCBIXOO.js +0 -3
- package/dist/shared/chunk-YY6DANZF.js +0 -3
- package/dist/shared/chunk-ZWQHIQEQ.js +0 -3
- package/dist/shared/datasources/external/json/fetcher.d.ts.map +0 -1
- package/dist/shared/datasources/external/json/options.d.ts.map +0 -1
- package/dist/shared/datasources/external/json/schema.d.ts.map +0 -1
- package/dist/shared/datasources/external/json/tests/fetcher.test.d.ts.map +0 -1
- package/dist/shared/datasources/external/rss/tests/fetcher.test.d.ts +0 -2
- package/dist/shared/datasources/external/rss/tests/fetcher.test.d.ts.map +0 -1
- package/dist/shared/template.d.ts +0 -898
- package/dist/shared/template.d.ts.map +0 -1
- package/dist/shared/template.js +0 -3
- package/dist/shared/tests/page.test.d.ts +0 -2
- package/dist/shared/tests/page.test.d.ts.map +0 -1
- package/dist/shared/tests/test-config.d.ts +0 -3
- package/dist/shared/tests/test-config.d.ts.map +0 -1
- package/dist/shared/themes/all-themes.d.ts +0 -3
- package/dist/shared/themes/all-themes.d.ts.map +0 -1
- package/dist/shared/themes/all-themes.js +0 -3
- /package/dist/shared/datasources/external/{json → http-json}/fetcher.d.ts +0 -0
- /package/dist/shared/datasources/external/{json → http-json}/options.d.ts +0 -0
- /package/dist/shared/datasources/external/{json → http-json}/tests/fetcher.test.d.ts +0 -0
|
@@ -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,11 @@
|
|
|
1
|
+
import { Type, type Static } from "@sinclair/typebox";
|
|
2
|
+
import { providerOptions } from "../../provider-options";
|
|
3
|
+
|
|
4
|
+
export const metaOptions = Type.Composite([
|
|
5
|
+
providerOptions,
|
|
6
|
+
Type.Object({
|
|
7
|
+
limit: Type.Optional(Type.Number()),
|
|
8
|
+
}),
|
|
9
|
+
]);
|
|
10
|
+
|
|
11
|
+
export type MetaOptions = Static<typeof metaOptions>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { RssOptions } from "./options";
|
|
2
|
+
import { parseFeed } from "htmlparser2";
|
|
3
|
+
import { type RssSchema, rssSchema } from "./schema";
|
|
4
|
+
import { ajv, serializeAjvErrors } from "~/shared/ajv";
|
|
5
|
+
import type { DatasourceFetcher } from "../../fetcher";
|
|
6
|
+
import { createPlaceholderReplacer, placeholderRx } from "../../utils";
|
|
7
|
+
|
|
8
|
+
const fetchRss: DatasourceFetcher<RssSchema, null, RssOptions> = async ({ options, attr }) => {
|
|
9
|
+
const replacer = createPlaceholderReplacer(attr);
|
|
10
|
+
const url = options.url.replace(placeholderRx, replacer);
|
|
11
|
+
const content = await (await fetch(url)).text();
|
|
12
|
+
const feed = parseFeed(content);
|
|
13
|
+
|
|
14
|
+
const newFeed: RssSchema =
|
|
15
|
+
feed?.items.map((item) => ({
|
|
16
|
+
...item,
|
|
17
|
+
pubDate: item.pubDate ? item.pubDate.toISOString() : new Date().toISOString(),
|
|
18
|
+
})) ?? [];
|
|
19
|
+
|
|
20
|
+
const validate = ajv.compile<RssSchema>(rssSchema);
|
|
21
|
+
const isValid = validate(newFeed);
|
|
22
|
+
|
|
23
|
+
if (!isValid) {
|
|
24
|
+
throw new Error(`fetchRss Error: Invalid Feed data (${url}): ${serializeAjvErrors(validate.errors)}`);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return newFeed;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export default fetchRss;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Type, type Static } from "@sinclair/typebox";
|
|
2
|
+
import { providerOptions } from "../../provider-options";
|
|
3
|
+
|
|
4
|
+
export const rssOptions = Type.Composite([
|
|
5
|
+
providerOptions,
|
|
6
|
+
Type.Object({
|
|
7
|
+
url: Type.String({ format: "uri" }),
|
|
8
|
+
}),
|
|
9
|
+
]);
|
|
10
|
+
|
|
11
|
+
export type RssOptions = Static<typeof rssOptions>;
|
|
@@ -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,63 @@
|
|
|
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 { ajv, serializeAjvErrors } from "~/shared/ajv";
|
|
8
|
+
import type { DatasourceFetcher } from "~/shared/datasources/fetcher";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* todo: add a way to retrieve media/posts from Threads for a given user other than "me"
|
|
12
|
+
*/
|
|
13
|
+
const fetchThreadsMediaDatasource: DatasourceFetcher<
|
|
14
|
+
ThreadsMediaSchema,
|
|
15
|
+
MetaFullOAuthConfig,
|
|
16
|
+
MetaOptions
|
|
17
|
+
> = async ({ options, oauth }) => {
|
|
18
|
+
invariant(oauth?.config, "fetchThreadsMediaDatasource Error: OAuth config is required");
|
|
19
|
+
|
|
20
|
+
const params = new URLSearchParams({
|
|
21
|
+
...stringifyObjectValues(options),
|
|
22
|
+
access_token: oauth.config.accessToken,
|
|
23
|
+
fields: [
|
|
24
|
+
"id",
|
|
25
|
+
"media_product_type",
|
|
26
|
+
"media_type",
|
|
27
|
+
"media_url",
|
|
28
|
+
"permalink",
|
|
29
|
+
"owner",
|
|
30
|
+
"username",
|
|
31
|
+
"text",
|
|
32
|
+
"timestamp",
|
|
33
|
+
"shortcode",
|
|
34
|
+
"thumbnail_url",
|
|
35
|
+
"children",
|
|
36
|
+
"is_quote_post",
|
|
37
|
+
].join(","),
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
const response = await fetch(`https://graph.threads.net/v1.0/me/threads?${params.toString()}`);
|
|
41
|
+
|
|
42
|
+
if (!response.ok) {
|
|
43
|
+
if (response.status === 401) {
|
|
44
|
+
throw new UnauthorizedError(`fetchThreadsMediaDatasource Error: Unauthorized.`);
|
|
45
|
+
}
|
|
46
|
+
throw new Error(`fetchThreadsMediaDatasource Error: Response status: ${response.status}`);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const media = (await response.json()) as ThreadsMediaSchema;
|
|
50
|
+
|
|
51
|
+
const validate = ajv.compile<ThreadsMediaSchema>(threadsMediaSchema);
|
|
52
|
+
const isValid = validate(media);
|
|
53
|
+
|
|
54
|
+
if (!isValid) {
|
|
55
|
+
throw new Error(
|
|
56
|
+
`fetchThreadsMediaDatasource Error: Invalid Threads response data: ${serializeAjvErrors(validate.errors)}`,
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return media;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
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,49 @@
|
|
|
1
|
+
import type { TiktokVideoOptions } from "./options";
|
|
2
|
+
import { type TiktokVideoListSchema, tiktokVideoListSchema } from "./schema";
|
|
3
|
+
import { UnauthorizedError } from "~/shared/errors";
|
|
4
|
+
import { ajv, serializeAjvErrors } from "~/shared/ajv";
|
|
5
|
+
import type { TiktokFullOAuthConfig } from "../oauth/config";
|
|
6
|
+
import type { DatasourceFetcher } from "~/shared/datasources/fetcher";
|
|
7
|
+
|
|
8
|
+
const fetchTiktokVideoDatasource: DatasourceFetcher<
|
|
9
|
+
TiktokVideoListSchema,
|
|
10
|
+
TiktokFullOAuthConfig,
|
|
11
|
+
TiktokVideoOptions
|
|
12
|
+
> = async ({ options, oauth }) => {
|
|
13
|
+
const params = new URLSearchParams({
|
|
14
|
+
access_token: oauth.config.accessToken,
|
|
15
|
+
fields: ["id", "title", "video_description", "duration", "cover_image_url", "embed_link"].join(","),
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
const url = `https://open.tiktokapis.com/v2/video/list/?${params.toString()}`;
|
|
19
|
+
const { refreshInterval, ...body } = options;
|
|
20
|
+
const response = await fetch(url, {
|
|
21
|
+
method: "POST",
|
|
22
|
+
headers: {
|
|
23
|
+
"Content-Type": "application/json",
|
|
24
|
+
Authorization: `Bearer ${oauth.config.accessToken}`,
|
|
25
|
+
},
|
|
26
|
+
body: JSON.stringify(body),
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
if (!response.ok) {
|
|
30
|
+
if (response.status === 401) {
|
|
31
|
+
throw new UnauthorizedError(`fetchTiktokVideoDatasource Error: Unauthorized.`);
|
|
32
|
+
}
|
|
33
|
+
throw new Error(`Response status: ${response.status}`);
|
|
34
|
+
}
|
|
35
|
+
const data = (await response.json()) as TiktokVideoListSchema;
|
|
36
|
+
|
|
37
|
+
const validate = ajv.compile<TiktokVideoListSchema>(tiktokVideoListSchema);
|
|
38
|
+
const isValid = validate(data);
|
|
39
|
+
|
|
40
|
+
if (!isValid) {
|
|
41
|
+
throw new Error(
|
|
42
|
+
`fetchTiktokVideoDatasource Error: Invalid TikTok response data: ${serializeAjvErrors(validate.errors)}`,
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return data;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export default fetchTiktokVideoDatasource;
|
|
@@ -0,0 +1,12 @@
|
|
|
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>;
|
|
@@ -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;
|
|
@@ -0,0 +1,27 @@
|
|
|
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>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { YoutubeListOptions } from "./options";
|
|
2
|
+
import { type YoutubeListSchema, youtubeListSchema } from "./schema";
|
|
3
|
+
import { UnauthorizedError } from "~/shared/errors";
|
|
4
|
+
import { stringifyObjectValues } from "~/shared/datasources/utils";
|
|
5
|
+
import { ajv, serializeAjvErrors } from "~/shared/ajv";
|
|
6
|
+
import type { YoutubeFullOAuthConfig } from "../oauth/config";
|
|
7
|
+
import type { DatasourceFetcher } from "~/shared/datasources/fetcher";
|
|
8
|
+
|
|
9
|
+
const fetchYoutubeList: DatasourceFetcher<
|
|
10
|
+
YoutubeListSchema,
|
|
11
|
+
YoutubeFullOAuthConfig,
|
|
12
|
+
YoutubeListOptions
|
|
13
|
+
> = async ({ options, oauth }) => {
|
|
14
|
+
const params = new URLSearchParams({
|
|
15
|
+
...stringifyObjectValues(options),
|
|
16
|
+
part: "snippet,id",
|
|
17
|
+
type: "video",
|
|
18
|
+
videoEmbeddable: "true",
|
|
19
|
+
access_token: oauth.config.accessToken,
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
const url = `https://www.googleapis.com/youtube/v3/search?${params}`;
|
|
23
|
+
|
|
24
|
+
const response = await fetch(url);
|
|
25
|
+
|
|
26
|
+
if (!response.ok) {
|
|
27
|
+
if (response.status === 401) {
|
|
28
|
+
throw new UnauthorizedError(`fetchYoutubeList Error: Unauthorized.`);
|
|
29
|
+
}
|
|
30
|
+
throw new Error(`fetchYoutubeList Error: Response status: ${response.status}`);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const data = (await response.json()) as YoutubeListSchema;
|
|
34
|
+
const validate = ajv.compile<YoutubeListSchema>(youtubeListSchema);
|
|
35
|
+
const isValid = validate(data);
|
|
36
|
+
|
|
37
|
+
if (!isValid) {
|
|
38
|
+
throw new Error(
|
|
39
|
+
`fetchYoutubeList Error: Invalid Youtube response data: ${serializeAjvErrors(validate.errors)}`,
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return data;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export default fetchYoutubeList;
|
|
@@ -0,0 +1,15 @@
|
|
|
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>;
|
|
@@ -0,0 +1,33 @@
|
|
|
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;
|
|
@@ -0,0 +1,38 @@
|
|
|
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>;
|
|
@@ -0,0 +1,15 @@
|
|
|
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>;
|
|
@@ -0,0 +1,17 @@
|
|
|
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>;
|
|
@@ -0,0 +1,69 @@
|
|
|
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>;
|