@upstart.gg/sdk 0.0.96 → 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/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 +20 -93
- 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 +104 -2670
- 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 -2
- 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 +11 -11
- 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-4K5NN4CN.js +0 -3
- package/dist/shared/chunk-4NCCSLBW.js +0 -3
- package/dist/shared/chunk-6I4PY5WS.js +0 -3
- package/dist/shared/chunk-6LDLGZUM.js +0 -3
- package/dist/shared/chunk-AZ63RF3K.js +0 -3
- package/dist/shared/chunk-BH4HTAAC.js +0 -3
- package/dist/shared/chunk-BK6LBWDI.js +0 -3
- package/dist/shared/chunk-BMDB2V7J.js +0 -3
- package/dist/shared/chunk-DAPQ4JPP.js +0 -3
- package/dist/shared/chunk-ECZ6FGZM.js +0 -3
- package/dist/shared/chunk-EFJQECVB.js +0 -3
- package/dist/shared/chunk-F2ZVIFHO.js +0 -3
- package/dist/shared/chunk-H6L4KRCJ.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-KOTGMAXH.js +0 -3
- package/dist/shared/chunk-LDOM2LJF.js +0 -3
- package/dist/shared/chunk-NFU5BF6G.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-PSNFBHPU.js +0 -3
- package/dist/shared/chunk-PSSJMWGU.js +0 -3
- package/dist/shared/chunk-PU2FOOTY.js +0 -3
- package/dist/shared/chunk-Q4MXTCE4.js +0 -8
- package/dist/shared/chunk-RBYYMUOZ.js +0 -3
- package/dist/shared/chunk-S2RQWOG2.js +0 -3
- package/dist/shared/chunk-SO5M7CYA.js +0 -3
- package/dist/shared/chunk-THRRILTW.js +0 -3
- package/dist/shared/chunk-TQ23UATQ.js +0 -3
- package/dist/shared/chunk-U44NTSIO.js +0 -3
- package/dist/shared/chunk-U4R5EGBK.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-XEQ2XZLQ.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,21 @@
|
|
|
1
|
+
import type { AirtableOptions } from "./options";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* WARNING: not tested yet!!
|
|
5
|
+
*
|
|
6
|
+
* @todo test this function in a real environment
|
|
7
|
+
*/
|
|
8
|
+
export default async function airtableHandler(formData: FormData, options: AirtableOptions) {
|
|
9
|
+
const result = await fetch(
|
|
10
|
+
`https://api.airtable.com/v0/${options.baseId}/${encodeURIComponent(options.tableIdOrName)}`,
|
|
11
|
+
{
|
|
12
|
+
method: "POST",
|
|
13
|
+
body: JSON.stringify(formData),
|
|
14
|
+
headers: {
|
|
15
|
+
Authorization: `Bearer ${options.accessToken}`,
|
|
16
|
+
"Content-Type": "application/json",
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
);
|
|
20
|
+
return result.ok;
|
|
21
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Type, type Static } from "@sinclair/typebox";
|
|
2
|
+
|
|
3
|
+
export const airtableOptions = Type.Object({
|
|
4
|
+
accessToken: Type.String({
|
|
5
|
+
description: "Airtable Personal Token or OAuth Access Token",
|
|
6
|
+
}),
|
|
7
|
+
baseId: Type.String({
|
|
8
|
+
pattern: "^app[A-Za-z0-9]+$",
|
|
9
|
+
description: 'Airtable Base ID starting with "app"',
|
|
10
|
+
}),
|
|
11
|
+
tableIdOrName: Type.Union([
|
|
12
|
+
Type.String({
|
|
13
|
+
pattern: "^tbl[A-Za-z0-9]+$",
|
|
14
|
+
description: 'Airtable Table ID starting with "tbl"',
|
|
15
|
+
}),
|
|
16
|
+
Type.String({
|
|
17
|
+
description: "Table name as shown in Airtable interface",
|
|
18
|
+
}),
|
|
19
|
+
]),
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
export type AirtableOptions = Static<typeof airtableOptions>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { GenericWebhookOptions } from "./options";
|
|
2
|
+
|
|
3
|
+
export default async function genericWebhookHandler(formData: FormData, options: GenericWebhookOptions) {
|
|
4
|
+
const result = await fetch(options.url, {
|
|
5
|
+
method: "POST",
|
|
6
|
+
body: JSON.stringify(formData),
|
|
7
|
+
headers: options.headers,
|
|
8
|
+
});
|
|
9
|
+
return result.ok;
|
|
10
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Type, type Static } from "@sinclair/typebox";
|
|
2
|
+
|
|
3
|
+
export const genericWebhookOptions = Type.Object({
|
|
4
|
+
url: Type.String({ format: "uri", title: "Webhook URL" }),
|
|
5
|
+
headers: Type.Optional(
|
|
6
|
+
Type.Record(Type.String(), Type.String(), {
|
|
7
|
+
title: "Headers",
|
|
8
|
+
description: "Additional headers to include in the webhook request",
|
|
9
|
+
}),
|
|
10
|
+
),
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export type GenericWebhookOptions = Static<typeof genericWebhookOptions>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Type, type Static } from "@sinclair/typebox";
|
|
2
|
+
|
|
3
|
+
const googleOAuthTokenSchema = Type.Object({
|
|
4
|
+
access_token: Type.String(),
|
|
5
|
+
token_type: Type.String(), // Usually "Bearer"
|
|
6
|
+
expires_in: Type.Number(), // Seconds until token expires, typically 3600 (1 hour)
|
|
7
|
+
refresh_token: Type.Optional(Type.String()), // Only present in first OAuth exchange
|
|
8
|
+
scope: Type.String(), // Space-separated list of granted scopes
|
|
9
|
+
id_token: Type.Optional(Type.String()), // JWT token containing user info, if requested
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export type GoogleOAuthToken = Static<typeof googleOAuthTokenSchema>;
|
|
13
|
+
|
|
14
|
+
// You might also want to define the decoded id_token structure:
|
|
15
|
+
const googleIdTokenSchema = Type.Object({
|
|
16
|
+
iss: Type.String(), // Issuer (usually 'https://accounts.google.com')
|
|
17
|
+
sub: Type.String(), // Unique Google ID for the user
|
|
18
|
+
aud: Type.String(), // Your client ID
|
|
19
|
+
iat: Type.Number(), // Issued at (timestamp)
|
|
20
|
+
exp: Type.Number(), // Expiration time (timestamp)
|
|
21
|
+
email: Type.Optional(Type.String()),
|
|
22
|
+
email_verified: Type.Optional(Type.Boolean()),
|
|
23
|
+
name: Type.Optional(Type.String()),
|
|
24
|
+
picture: Type.Optional(Type.String()),
|
|
25
|
+
given_name: Type.Optional(Type.String()),
|
|
26
|
+
family_name: Type.Optional(Type.String()),
|
|
27
|
+
locale: Type.Optional(Type.String()),
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
export type GoogleIdToken = Static<typeof googleIdTokenSchema>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { GoogleSheetsOptions } from "./options";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* WARNING: not tested yet!!
|
|
5
|
+
*
|
|
6
|
+
* @todo test this function in a real environment
|
|
7
|
+
*/
|
|
8
|
+
export default async function googleSheetsHandler(
|
|
9
|
+
formData: FormData,
|
|
10
|
+
options: GoogleSheetsOptions,
|
|
11
|
+
accessToken: string,
|
|
12
|
+
) {
|
|
13
|
+
const url = `https://sheets.googleapis.com/v4/spreadsheets/${options.spreadsheetId}/values/A:Z:append?valueInputOption=RAW`;
|
|
14
|
+
|
|
15
|
+
const result = await fetch(url, {
|
|
16
|
+
method: "POST",
|
|
17
|
+
body: JSON.stringify({
|
|
18
|
+
values: [formData], // Wrap the row values in an array since API expects 2D array
|
|
19
|
+
}),
|
|
20
|
+
headers: {
|
|
21
|
+
Authorization: `Bearer ${accessToken}`,
|
|
22
|
+
"Content-Type": "application/json",
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
return result.ok;
|
|
26
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Type, type Static } from "@sinclair/typebox";
|
|
2
|
+
|
|
3
|
+
export const googleSheetsOptions = Type.Object({
|
|
4
|
+
spreadsheetId: Type.String(),
|
|
5
|
+
// If targeting specific sheet
|
|
6
|
+
sheetName: Type.Optional(Type.String()),
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export type GoogleSheetsOptions = Static<typeof googleSheetsOptions>;
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { Type, type Static } from "@sinclair/typebox";
|
|
2
|
+
import { airtableOptions } from "./external/airtable/options";
|
|
3
|
+
import { googleSheetsOptions } from "./external/google/sheets/options";
|
|
4
|
+
import { genericWebhookOptions } from "./external/generic-webhook/options";
|
|
5
|
+
|
|
6
|
+
export const connectorSchema = Type.Union([
|
|
7
|
+
Type.Literal("airtable"),
|
|
8
|
+
Type.Literal("google-sheets"),
|
|
9
|
+
// a generic webhook
|
|
10
|
+
Type.Literal("generic-webhook"),
|
|
11
|
+
// saved to Upstart platform
|
|
12
|
+
Type.Literal("internal"),
|
|
13
|
+
]);
|
|
14
|
+
|
|
15
|
+
export type DatarecordConnector = Static<typeof connectorSchema>;
|
|
16
|
+
|
|
17
|
+
const internalDatarecord = Type.Object(
|
|
18
|
+
{
|
|
19
|
+
provider: Type.Literal("internal"),
|
|
20
|
+
// options: Type.Optional(Type.Any()),
|
|
21
|
+
schema: Type.Any({
|
|
22
|
+
title: "Schema",
|
|
23
|
+
description:
|
|
24
|
+
"JSON Schema of the datarecord. Always of type 'object' and representing a row that will be saved.",
|
|
25
|
+
examples: [
|
|
26
|
+
{
|
|
27
|
+
type: "object",
|
|
28
|
+
properties: {
|
|
29
|
+
firstname: { type: "string", title: "Firstname" },
|
|
30
|
+
lastname: { type: "string", title: "Lastname" },
|
|
31
|
+
email: { type: "string", format: "email", title: "Email" },
|
|
32
|
+
},
|
|
33
|
+
required: ["email"],
|
|
34
|
+
title: "Newsletter Subscription",
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
}),
|
|
38
|
+
indexes: Type.Array(
|
|
39
|
+
Type.Object({
|
|
40
|
+
name: Type.String({ title: "Index name" }),
|
|
41
|
+
fields: Type.Array(Type.String(), { title: "Fields to index" }),
|
|
42
|
+
unique: Type.Optional(Type.Boolean({ title: "Unique index", default: false })),
|
|
43
|
+
}),
|
|
44
|
+
{
|
|
45
|
+
title: "Indexes",
|
|
46
|
+
description:
|
|
47
|
+
"IMPORTANT: Indexes to create on the datarecord. use it to enforce uniqueness or improve query performance.",
|
|
48
|
+
},
|
|
49
|
+
),
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
examples: [
|
|
53
|
+
{
|
|
54
|
+
provider: "internal",
|
|
55
|
+
schema: {
|
|
56
|
+
type: "object",
|
|
57
|
+
properties: {
|
|
58
|
+
firstname: { type: "string", title: "Firstname" },
|
|
59
|
+
lastname: { type: "string", title: "Lastname" },
|
|
60
|
+
email: { type: "string", format: "email", title: "Email" },
|
|
61
|
+
},
|
|
62
|
+
required: ["email"],
|
|
63
|
+
title: "Newsletter Subscription",
|
|
64
|
+
},
|
|
65
|
+
indexes: [
|
|
66
|
+
{
|
|
67
|
+
name: "email_index",
|
|
68
|
+
fields: ["email"],
|
|
69
|
+
unique: true,
|
|
70
|
+
},
|
|
71
|
+
],
|
|
72
|
+
},
|
|
73
|
+
],
|
|
74
|
+
},
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
export const datarecordsConnectors = Type.Union([
|
|
78
|
+
Type.Object({
|
|
79
|
+
provider: Type.Literal("airtable"),
|
|
80
|
+
options: airtableOptions,
|
|
81
|
+
}),
|
|
82
|
+
Type.Object({
|
|
83
|
+
provider: Type.Literal("google-sheets"),
|
|
84
|
+
options: googleSheetsOptions,
|
|
85
|
+
}),
|
|
86
|
+
Type.Object({
|
|
87
|
+
provider: Type.Literal("generic-webhook"),
|
|
88
|
+
options: genericWebhookOptions,
|
|
89
|
+
}),
|
|
90
|
+
internalDatarecord,
|
|
91
|
+
]);
|
|
92
|
+
|
|
93
|
+
const datarecordMetadata = Type.Object({
|
|
94
|
+
id: Type.String({
|
|
95
|
+
title: "Datarecord ID",
|
|
96
|
+
comment: "A unique identifier for the datarecord, e.g., 'newsletter_subscriptions'",
|
|
97
|
+
}),
|
|
98
|
+
label: Type.String({
|
|
99
|
+
title: "Name of the datarecord",
|
|
100
|
+
comment: "For example, 'Newsletter Subscriptions'",
|
|
101
|
+
}),
|
|
102
|
+
description: Type.Optional(Type.String({ title: "Description of the datarecord" })),
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
const datarecordManifest = Type.Composite([datarecordsConnectors, datarecordMetadata]);
|
|
106
|
+
|
|
107
|
+
export const internalDatarecordManifest = Type.Composite([datarecordMetadata, internalDatarecord]);
|
|
108
|
+
|
|
109
|
+
export type DatarecordManifest = Static<typeof datarecordManifest>;
|
|
110
|
+
|
|
111
|
+
export const datarecordsMap = Type.Record(Type.String(), datarecordManifest, {
|
|
112
|
+
title: "Datarecords map",
|
|
113
|
+
description: "The map of Datarecords available",
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
export type DatarecordsMap = Static<typeof datarecordsMap>;
|
|
117
|
+
|
|
118
|
+
export type DatarecordResolved<T extends DatarecordsMap> = {
|
|
119
|
+
[K in keyof T]: unknown;
|
|
120
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { facebookPostSchema, type FacebookPostSchema } from "./schema";
|
|
2
|
+
import type { MetaFullOAuthConfig } from "../../meta/oauth/config";
|
|
3
|
+
import { UnauthorizedError } from "~/shared/errors";
|
|
4
|
+
import type { MetaOptions } from "../../meta/options";
|
|
5
|
+
import { stringifyObjectValues } from "../../../utils";
|
|
6
|
+
import { ajv, serializeAjvErrors } from "~/shared/ajv";
|
|
7
|
+
import type { DatasourceFetcher } from "~/shared/datasources/fetcher";
|
|
8
|
+
|
|
9
|
+
const fetchFacebookPostDatasource: DatasourceFetcher<
|
|
10
|
+
FacebookPostSchema,
|
|
11
|
+
MetaFullOAuthConfig,
|
|
12
|
+
MetaOptions
|
|
13
|
+
> = async ({ options, oauth }) => {
|
|
14
|
+
const params = new URLSearchParams({
|
|
15
|
+
...stringifyObjectValues(options),
|
|
16
|
+
fields: [
|
|
17
|
+
"from",
|
|
18
|
+
"permalink_url",
|
|
19
|
+
"name",
|
|
20
|
+
"description",
|
|
21
|
+
"caption",
|
|
22
|
+
"id",
|
|
23
|
+
"is_hidden",
|
|
24
|
+
"message",
|
|
25
|
+
"application",
|
|
26
|
+
"object_id",
|
|
27
|
+
"link",
|
|
28
|
+
"is_published",
|
|
29
|
+
"properties",
|
|
30
|
+
"status_type",
|
|
31
|
+
"story",
|
|
32
|
+
"type",
|
|
33
|
+
"actions",
|
|
34
|
+
"call_to_action",
|
|
35
|
+
"child_attachments",
|
|
36
|
+
].join(","),
|
|
37
|
+
access_token: oauth.config.accessToken,
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
const response = await fetch(`https://graph.facebook.com/me/posts?${params}`);
|
|
41
|
+
|
|
42
|
+
if (!response.ok) {
|
|
43
|
+
if (response.status === 401) {
|
|
44
|
+
throw new UnauthorizedError(`fetchFacebookPostDatasource Error: Unauthorized.`);
|
|
45
|
+
}
|
|
46
|
+
throw new Error(`fetchFacebookPostDatasource Error: Response status: ${response.status}`);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const post = (await response.json()) as FacebookPostSchema;
|
|
50
|
+
|
|
51
|
+
const validate = ajv.compile<FacebookPostSchema>(facebookPostSchema);
|
|
52
|
+
|
|
53
|
+
if (!validate(post)) {
|
|
54
|
+
throw new Error(
|
|
55
|
+
`fetchFacebookPostDatasource Error: Invalid JSON object: ${serializeAjvErrors(validate.errors)}`,
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return post;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export default fetchFacebookPostDatasource;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { FacebookPostSchema } from "./schema";
|
|
2
|
+
|
|
3
|
+
export const sample = {
|
|
4
|
+
data: [
|
|
5
|
+
{
|
|
6
|
+
from: {
|
|
7
|
+
name: "Facebook",
|
|
8
|
+
id: "20531316728",
|
|
9
|
+
},
|
|
10
|
+
id: "20531316728_10154052815206729",
|
|
11
|
+
permalink_url: "https://www.facebook.com/facebook/posts/10154052815206729",
|
|
12
|
+
is_hidden: false,
|
|
13
|
+
message: "Great photo!",
|
|
14
|
+
object_id: "10154052815196729",
|
|
15
|
+
link: "https://www.facebook.com/photo.php?fbid=10154052815196729&set=a.10150278999681729.345701.20531316728&type=3",
|
|
16
|
+
is_published: true,
|
|
17
|
+
status_type: "added_photos",
|
|
18
|
+
type: "photo",
|
|
19
|
+
actions: [
|
|
20
|
+
{
|
|
21
|
+
name: "Comment",
|
|
22
|
+
link: "https://www.facebook.com/20531316728/posts/10154052815206729",
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
name: "Like",
|
|
26
|
+
link: "https://www.facebook.com/20531316728/posts/10154052815206729",
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
paging: {
|
|
32
|
+
next: "url",
|
|
33
|
+
previous: "url",
|
|
34
|
+
},
|
|
35
|
+
} satisfies FacebookPostSchema;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Type, type Static } from "@sinclair/typebox";
|
|
2
|
+
|
|
3
|
+
export const facebookPostSchema = Type.Object({
|
|
4
|
+
data: Type.Array(
|
|
5
|
+
Type.Object({
|
|
6
|
+
from: Type.Object({
|
|
7
|
+
name: Type.String(),
|
|
8
|
+
id: Type.String(),
|
|
9
|
+
}),
|
|
10
|
+
id: Type.String(),
|
|
11
|
+
permalink_url: Type.String(),
|
|
12
|
+
is_hidden: Type.Boolean(),
|
|
13
|
+
message: Type.Optional(Type.String()),
|
|
14
|
+
object_id: Type.String(),
|
|
15
|
+
link: Type.String(),
|
|
16
|
+
is_published: Type.Boolean(),
|
|
17
|
+
status_type: Type.String(),
|
|
18
|
+
type: Type.String(),
|
|
19
|
+
actions: Type.Array(
|
|
20
|
+
Type.Object({
|
|
21
|
+
name: Type.String(),
|
|
22
|
+
link: Type.String(),
|
|
23
|
+
}),
|
|
24
|
+
),
|
|
25
|
+
}),
|
|
26
|
+
),
|
|
27
|
+
paging: Type.Object({
|
|
28
|
+
previous: Type.Optional(Type.String()),
|
|
29
|
+
next: Type.Optional(Type.String()),
|
|
30
|
+
}),
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
export type FacebookPostSchema = Static<typeof facebookPostSchema>;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { describe, it, expect, vi, beforeEach } from "vitest";
|
|
2
|
+
import fetchFacebookPostDatasource from "../fetcher";
|
|
3
|
+
import { UnauthorizedError } from "~/shared/errors";
|
|
4
|
+
import type { MetaOAuthConfig } from "~/shared/datasources/external/meta/oauth/config";
|
|
5
|
+
import type { MetaOptions } from "~/shared/datasources/external/meta/options";
|
|
6
|
+
import type { DatasourceFetcherParams } from "~/shared/datasources/fetcher";
|
|
7
|
+
|
|
8
|
+
// Mock the fetch function
|
|
9
|
+
global.fetch = vi.fn();
|
|
10
|
+
|
|
11
|
+
describe("fetchFacebookPostDatasource", () => {
|
|
12
|
+
beforeEach(() => {
|
|
13
|
+
vi.resetAllMocks();
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it("should fetch Facebook posts successfully", async () => {
|
|
17
|
+
const mockResponse = {
|
|
18
|
+
data: [
|
|
19
|
+
{
|
|
20
|
+
object_id: "123",
|
|
21
|
+
id: "123",
|
|
22
|
+
message: "Test post",
|
|
23
|
+
from: { name: "Test User", id: "456" },
|
|
24
|
+
permalink_url: "https://facebook.com/post/123",
|
|
25
|
+
link: "https://facebook.com/post/123",
|
|
26
|
+
is_hidden: false,
|
|
27
|
+
is_published: true,
|
|
28
|
+
type: "status",
|
|
29
|
+
status_type: "mobile_status_update",
|
|
30
|
+
actions: [{ name: "Comment", link: "https://facebook.com/post/123" }],
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
paging: { next: "https://graph.facebook.com/me/posts?after=123" },
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
(global.fetch as any).mockResolvedValueOnce({
|
|
37
|
+
ok: true,
|
|
38
|
+
json: () => Promise.resolve(mockResponse),
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
// @ts-ignore
|
|
42
|
+
const result = await fetchFacebookPostDatasource({
|
|
43
|
+
options: { limit: 10 },
|
|
44
|
+
oauth: { config: { accessToken: "test-token" } },
|
|
45
|
+
// @ts-ignore
|
|
46
|
+
attr: {
|
|
47
|
+
id: "me",
|
|
48
|
+
siteId: "123",
|
|
49
|
+
},
|
|
50
|
+
} as DatasourceFetcherParams<MetaOAuthConfig, MetaOptions>);
|
|
51
|
+
|
|
52
|
+
expect(result).toEqual(mockResponse);
|
|
53
|
+
expect(global.fetch).toHaveBeenCalledWith(
|
|
54
|
+
expect.stringContaining("https://graph.facebook.com/me/posts?"),
|
|
55
|
+
);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it("should throw UnauthorizedError on unauthorized response", async () => {
|
|
59
|
+
(global.fetch as any).mockResolvedValueOnce({
|
|
60
|
+
ok: false,
|
|
61
|
+
status: 401,
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
await expect(
|
|
65
|
+
// @ts-ignore
|
|
66
|
+
fetchFacebookPostDatasource({
|
|
67
|
+
options: { limit: 10 },
|
|
68
|
+
oauth: { config: { accessToken: "invalid-token" } },
|
|
69
|
+
attr: {},
|
|
70
|
+
} as DatasourceFetcherParams<MetaOAuthConfig, MetaOptions>),
|
|
71
|
+
).rejects.toThrow(UnauthorizedError);
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
it("should throw error on invalid response data", async () => {
|
|
75
|
+
const invalidResponse = { invalid: "data" };
|
|
76
|
+
|
|
77
|
+
(global.fetch as any).mockResolvedValueOnce({
|
|
78
|
+
ok: true,
|
|
79
|
+
json: () => Promise.resolve(invalidResponse),
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
await expect(
|
|
83
|
+
// @ts-ignore
|
|
84
|
+
fetchFacebookPostDatasource({
|
|
85
|
+
options: { limit: 10 },
|
|
86
|
+
oauth: { config: { accessToken: "test-token" } },
|
|
87
|
+
attr: {},
|
|
88
|
+
} as DatasourceFetcherParams<MetaOAuthConfig, MetaOptions>),
|
|
89
|
+
).rejects.toThrow();
|
|
90
|
+
});
|
|
91
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { DatasourceFetcher } from "../../fetcher";
|
|
2
|
+
import { createPlaceholderReplacer, placeholderRx } from "../../utils";
|
|
3
|
+
import type { HttpJsonOptions } from "./options";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* For this fetcher, validation is done outside of the fetcher.
|
|
7
|
+
*/
|
|
8
|
+
const fetchHttpJSON: DatasourceFetcher<unknown, null, HttpJsonOptions> = async ({ options, attr }) => {
|
|
9
|
+
const replacer = createPlaceholderReplacer(attr);
|
|
10
|
+
const url = options.url.replace(placeholderRx, replacer);
|
|
11
|
+
const headers: Record<string, string> = {};
|
|
12
|
+
|
|
13
|
+
if (options.headers) {
|
|
14
|
+
for (const [key, value] of Object.entries(options.headers ?? {})) {
|
|
15
|
+
headers[key] = (value as string).replace(placeholderRx, replacer);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const response = await fetch(url, { headers });
|
|
20
|
+
|
|
21
|
+
if (!response.ok) {
|
|
22
|
+
throw new Error(`fetchHttpJSON Error: Response status: ${response.status}`);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return response.json();
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export default fetchHttpJSON;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Type, type Static } from "@sinclair/typebox";
|
|
2
|
+
import { providerOptions } from "../../provider-options";
|
|
3
|
+
|
|
4
|
+
export const httpJsonOptions = Type.Composite([
|
|
5
|
+
providerOptions,
|
|
6
|
+
Type.Object({
|
|
7
|
+
url: Type.String({ format: "uri" }),
|
|
8
|
+
headers: Type.Optional(Type.Record(Type.String(), Type.String())),
|
|
9
|
+
}),
|
|
10
|
+
]);
|
|
11
|
+
|
|
12
|
+
export type HttpJsonOptions = Static<typeof httpJsonOptions>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Type, type Static } from "@sinclair/typebox";
|
|
2
|
+
|
|
3
|
+
export const jsonObjectSchema = Type.Object({}, { additionalProperties: true });
|
|
4
|
+
export const jsonArraySchema = Type.Array(jsonObjectSchema, { title: "Http JSON" });
|
|
5
|
+
|
|
6
|
+
export type JSONArraySchema = Static<typeof jsonArraySchema>;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { describe, it, expect, vi, beforeEach } from "vitest";
|
|
2
|
+
import fetchHttpJSON from "../fetcher";
|
|
3
|
+
import type { HttpJsonOptions } from "../options";
|
|
4
|
+
import type { DatasourceFetcherParams } from "~/shared/datasources/fetcher";
|
|
5
|
+
|
|
6
|
+
// Mock the fetch function
|
|
7
|
+
global.fetch = vi.fn();
|
|
8
|
+
|
|
9
|
+
describe("fetchHttpJSON", () => {
|
|
10
|
+
beforeEach(() => {
|
|
11
|
+
vi.resetAllMocks();
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it("should fetch JSON data successfully", async () => {
|
|
15
|
+
const mockResponse = { data: "test" };
|
|
16
|
+
|
|
17
|
+
(global.fetch as any).mockResolvedValueOnce({
|
|
18
|
+
ok: true,
|
|
19
|
+
json: () => Promise.resolve(mockResponse),
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
const result = await fetchHttpJSON({
|
|
23
|
+
options: { url: "https://api.example.com/data" },
|
|
24
|
+
attr: {},
|
|
25
|
+
oauth: null,
|
|
26
|
+
} as DatasourceFetcherParams<null, HttpJsonOptions>);
|
|
27
|
+
|
|
28
|
+
expect(result).toEqual(mockResponse);
|
|
29
|
+
expect(global.fetch).toHaveBeenCalledWith("https://api.example.com/data", { headers: {} });
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it("should replace placeholders in URL and headers", async () => {
|
|
33
|
+
const mockResponse = { data: "test" };
|
|
34
|
+
|
|
35
|
+
(global.fetch as any).mockResolvedValueOnce({
|
|
36
|
+
ok: true,
|
|
37
|
+
json: () => Promise.resolve(mockResponse),
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
const result = await fetchHttpJSON({
|
|
41
|
+
options: {
|
|
42
|
+
url: "https://api.example.com/{{dataType}}",
|
|
43
|
+
headers: { "X-API-Key": "{{apiKey}}" },
|
|
44
|
+
},
|
|
45
|
+
attr: { dataType: "users", apiKey: "secret-key" },
|
|
46
|
+
env: {},
|
|
47
|
+
oauth: null,
|
|
48
|
+
} as unknown as DatasourceFetcherParams<null, HttpJsonOptions>);
|
|
49
|
+
|
|
50
|
+
expect(result).toEqual(mockResponse);
|
|
51
|
+
expect(global.fetch).toHaveBeenCalledWith("https://api.example.com/users", {
|
|
52
|
+
headers: { "X-API-Key": "secret-key" },
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it("should throw error on non-OK response", async () => {
|
|
57
|
+
(global.fetch as any).mockResolvedValueOnce({
|
|
58
|
+
ok: false,
|
|
59
|
+
status: 404,
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
await expect(
|
|
63
|
+
fetchHttpJSON({
|
|
64
|
+
options: { url: "https://api.example.com/notfound" },
|
|
65
|
+
attr: {},
|
|
66
|
+
oauth: null,
|
|
67
|
+
} as DatasourceFetcherParams<null, HttpJsonOptions>),
|
|
68
|
+
).rejects.toThrow("fetchHttpJSON Error: Response status: 404");
|
|
69
|
+
});
|
|
70
|
+
});
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { instagramFeedSchema, type InstagramFeedSchema } from "./schema";
|
|
2
|
+
import type { MetaFullOAuthConfig } from "~/shared/datasources/external/meta/oauth/config";
|
|
3
|
+
import { UnauthorizedError } from "~/shared/errors";
|
|
4
|
+
import type { MetaOptions } from "~/shared/datasources/external/meta/options";
|
|
5
|
+
import { stringifyObjectValues } from "~/shared/datasources/utils";
|
|
6
|
+
import { ajv, serializeAjvErrors } from "~/shared/ajv";
|
|
7
|
+
import type { DatasourceFetcher } from "~/shared/datasources/fetcher";
|
|
8
|
+
|
|
9
|
+
const fetchInstagramFeedDatasource: DatasourceFetcher<
|
|
10
|
+
InstagramFeedSchema,
|
|
11
|
+
MetaFullOAuthConfig,
|
|
12
|
+
MetaOptions
|
|
13
|
+
> = async ({ options, oauth }) => {
|
|
14
|
+
const params = new URLSearchParams({
|
|
15
|
+
...stringifyObjectValues(options),
|
|
16
|
+
access_token: oauth.config.accessToken,
|
|
17
|
+
fields: ["id", "caption", "timestamp", "thumbnail_url", "media_url", "permalink", "media_type"].join(","),
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const response = await fetch(`https://graph.instagram.com/me/media?${params.toString()}`);
|
|
21
|
+
|
|
22
|
+
if (!response.ok) {
|
|
23
|
+
if (response.status === 401) {
|
|
24
|
+
throw new UnauthorizedError(`fetchInstagramFeedDatasource Error: Unauthorized.`);
|
|
25
|
+
}
|
|
26
|
+
throw new Error(`fetchInstagramFeedDatasource Error: Response status: ${response.status}`);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const feed = (await response.json()) as InstagramFeedSchema;
|
|
30
|
+
|
|
31
|
+
const validate = ajv.compile<InstagramFeedSchema>(instagramFeedSchema);
|
|
32
|
+
const isValid = validate(feed);
|
|
33
|
+
|
|
34
|
+
if (!isValid) {
|
|
35
|
+
throw new Error(
|
|
36
|
+
`fetchInstagramFeedDatasource Error: Invalid Instagram response data: ${serializeAjvErrors(validate.errors)}`,
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return feed;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export default fetchInstagramFeedDatasource;
|