Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Public API/SDK update for /me route to handle extension blacklisted domains. #9688

Merged
merged 4 commits into from
Jan 2, 2025

Conversation

PopDaph
Copy link
Contributor

@PopDaph PopDaph commented Jan 2, 2025

Description

Changes on Front:

  • WorkspaceType can take an extensionBlacklistedDomains string array.
  • UserTypeWithWorkspace returns an attached WorkspaceType instead of LightWorkspaceType.
  • /me route accepts a header "X-Request-Origin", if set to extension it will populate extensionBlacklistedDomains in the response.

Changes on Node SDK:

  • Schema update for MeResponseSchema and WorkspaceSchema to match the changes made on front API.
  • Bump version.

Risk

Should be safe as I'm only adding an optional attribute to an existing type.

Deploy Plan

  • Deploy front.
  • Publish a new version of the SDK.

Next

=> Then I can use the updated SDK on the extension to disable the share buttons if the current domain is from a blacklisted domain.

types/src/front/user.ts Outdated Show resolved Hide resolved
@PopDaph PopDaph requested a review from tdraier January 2, 2025 09:57
@PopDaph PopDaph force-pushed the extension-blacklist-domains-api branch from a7e70da to 2f833cb Compare January 2, 2025 10:02
@PopDaph PopDaph force-pushed the extension-blacklist-domains-api branch 2 times, most recently from 5c1a305 to 545a1a4 Compare January 2, 2025 11:35
@PopDaph PopDaph requested review from flvndvd and tdraier January 2, 2025 12:33
front/lib/api/user.ts Show resolved Hide resolved
segmentation: w.segmentation || null,
whiteListedProviders: w.whiteListedProviders,
defaultEmbeddingProvider: w.defaultEmbeddingProvider,
...(populateExtensionConfig && {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a toJSON (to align with other resources) on the ExtensionConfigurationResource and return it instead of accessing property manually?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a toJson() but here I'd rather get the resources since I need to access workspaceId that I don't necessarily want to expose in the type. Also, here I only want to display the blacklistedDomains attribute, I don't want the full type. I can't just spread the type because it also has an id and sId and we don't want to conflict with the workspace.

I could put all that in a sub object with a config key but since the relation is 0-1 I like it flat with the workspace!

@PopDaph PopDaph merged commit c4d4733 into main Jan 2, 2025
3 checks passed
@PopDaph PopDaph deleted the extension-blacklist-domains-api branch January 2, 2025 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants