From 6a12822829e823e371c800fbbeb70bf04230a229 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Wed, 23 Apr 2025 08:21:44 -0400 Subject: [PATCH 01/64] fix: Embeds not enabled on collection overview (#9034) fix: Disabled embeds show unusable resize handle --- app/components/CollectionDescription.tsx | 1 - shared/editor/components/Embed.tsx | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/app/components/CollectionDescription.tsx b/app/components/CollectionDescription.tsx index be2ba2fb4f..4b16a3b4fe 100644 --- a/app/components/CollectionDescription.tsx +++ b/app/components/CollectionDescription.tsx @@ -69,7 +69,6 @@ function CollectionDescription({ collection }: Props) { readOnly={!can.update} userId={user.id} editorStyle={editorStyle} - embedsDisabled />
diff --git a/shared/editor/components/Embed.tsx b/shared/editor/components/Embed.tsx index 31f80c68ec..af0ef35aeb 100644 --- a/shared/editor/components/Embed.tsx +++ b/shared/editor/components/Embed.tsx @@ -17,10 +17,10 @@ type Props = ComponentProps & { const Embed = (props: Props) => { const ref = React.useRef(null); - const { node, isEditable, onChangeSize } = props; + const { node, isEditable, embedsDisabled, onChangeSize } = props; const naturalWidth = 0; const naturalHeight = 400; - const isResizable = !!onChangeSize; + const isResizable = !!onChangeSize && !embedsDisabled; const { width, height, setSize, handlePointerDown, dragging } = useDragResize( { From 18bc93c9c207329244c6909606a2393e863892a3 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Wed, 23 Apr 2025 21:53:54 -0400 Subject: [PATCH 02/64] Add additional CSP protection to files.get endpoint (#9039) --- plugins/storage/server/api/files.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/storage/server/api/files.ts b/plugins/storage/server/api/files.ts index b70aadca27..53d15c48c7 100644 --- a/plugins/storage/server/api/files.ts +++ b/plugins/storage/server/api/files.ts @@ -96,6 +96,7 @@ router.get( ctx.set("Accept-Ranges", "bytes"); ctx.set("Cache-Control", cacheHeader); ctx.set("Content-Type", contentType); + ctx.set("Content-Security-Policy", "sandbox"); ctx.attachment(fileName, { type: forceDownload ? "attachment" From 21f37c0d14e9130044d6af8358a5e66f8c18f936 Mon Sep 17 00:00:00 2001 From: YKDZ <69898831+YKDZ@users.noreply.github.com> Date: Thu, 24 Apr 2025 10:12:27 +0800 Subject: [PATCH 03/64] Display breadcrumb instead of collection name when link and mention document (#8938) * feat: Display breadcrumb instead of collection name when link and mention document * feat: Use maxDepth instead of reversedLength in DocumentBreadcrumb * fix: Category will never display in DocumentBreadcrumb * fix: Wrong output when maxDepth <= 0 * fix: Wrong hook denpendency * fix: eslint issues * Update DocumentBreadcrumb.tsx --------- Co-authored-by: Tom Moor --- app/components/DocumentBreadcrumb.tsx | 55 +++++++++++++++++++++------ app/editor/components/LinkEditor.tsx | 10 ++++- app/editor/components/MentionMenu.tsx | 14 +++++-- shared/editor/types/index.ts | 2 +- 4 files changed, 65 insertions(+), 16 deletions(-) diff --git a/app/components/DocumentBreadcrumb.tsx b/app/components/DocumentBreadcrumb.tsx index b5b3e7ca1c..5b1da8b897 100644 --- a/app/components/DocumentBreadcrumb.tsx +++ b/app/components/DocumentBreadcrumb.tsx @@ -18,6 +18,13 @@ type Props = { children?: React.ReactNode; document: Document; onlyText?: boolean; + reverse?: boolean; + /** + * Maximum number of items to show in the breadcrumb. + * If value is less than or equals to 0, no items will be shown. + * If value is undefined, all items will be shown. + */ + maxDepth?: number; }; function useCategory(document: Document): MenuInternalLink | null { @@ -54,7 +61,7 @@ function useCategory(document: Document): MenuInternalLink | null { } function DocumentBreadcrumb( - { document, children, onlyText }: Props, + { document, children, onlyText, reverse = false, maxDepth }: Props, ref: React.RefObject | null ) { const { collections } = useStores(); @@ -65,6 +72,7 @@ function DocumentBreadcrumb( ? collections.get(document.collectionId) : undefined; const can = usePolicy(collection); + const depth = maxDepth === undefined ? undefined : Math.max(0, maxDepth); React.useEffect(() => { void document.loadRelations({ withoutPolicies: true }); @@ -91,20 +99,23 @@ function DocumentBreadcrumb( }; } - const path = document.pathTo; + const path = document.pathTo.slice(0, -1); const items = React.useMemo(() => { - const output = []; + const output: MenuInternalLink[] = []; + + if (depth === 0) { + return output; + } if (category) { output.push(category); } - if (collectionNode) { output.push(collectionNode); } - path.slice(0, -1).forEach((node: NavigationNode) => { + path.forEach((node: NavigationNode) => { const title = node.title || t("Untitled"); output.push({ type: "route", @@ -121,21 +132,43 @@ function DocumentBreadcrumb( }, }); }); - return output; - }, [t, path, category, sidebarContext, collectionNode]); + + return reverse + ? depth !== undefined + ? output.slice(-depth) + : output + : depth !== undefined + ? output.slice(0, depth) + : output; + }, [t, path, category, sidebarContext, collectionNode, reverse, depth]); if (!collections.isLoaded) { return null; } - if (onlyText === true) { + if (onlyText) { + if (depth === 0) { + return <>; + } + + const slicedPath = reverse + ? path.slice(depth && -depth) + : path.slice(0, depth); + + const showCollection = + collection && + (!reverse || depth === undefined || slicedPath.length < depth); + return ( <> - {collection?.name} - {path.slice(0, -1).map((node: NavigationNode) => ( + {showCollection && collection.name} + {slicedPath.map((node: NavigationNode, index: number) => ( - + {showCollection && } {node.title || t("Untitled")} + {!showCollection && index !== slicedPath.length - 1 && ( + + )} ))} diff --git a/app/editor/components/LinkEditor.tsx b/app/editor/components/LinkEditor.tsx index baed135a00..6bb0fa1fae 100644 --- a/app/editor/components/LinkEditor.tsx +++ b/app/editor/components/LinkEditor.tsx @@ -10,6 +10,7 @@ import styled from "styled-components"; import Icon from "@shared/components/Icon"; import { hideScrollbars, s } from "@shared/styles"; import { isInternalUrl, sanitizeUrl } from "@shared/utils/urls"; +import DocumentBreadcrumb from "~/components/DocumentBreadcrumb"; import Flex from "~/components/Flex"; import { ResizingHeightContainer } from "~/components/ResizingHeightContainer"; import Scrollable from "~/components/Scrollable"; @@ -253,7 +254,14 @@ const LinkEditor: React.FC = ({ onPointerMove={() => setSelectedIndex(index)} selected={index === selectedIndex} key={doc.id} - subtitle={doc.collection?.name} + subtitle={ + + } title={doc.title} icon={ doc.icon ? ( diff --git a/app/editor/components/MentionMenu.tsx b/app/editor/components/MentionMenu.tsx index 192668bbe4..ca1b81eb2d 100644 --- a/app/editor/components/MentionMenu.tsx +++ b/app/editor/components/MentionMenu.tsx @@ -11,6 +11,7 @@ import { MenuItem } from "@shared/editor/types"; import { MentionType } from "@shared/types"; import parseDocumentSlug from "@shared/utils/parseDocumentSlug"; import { Avatar, AvatarSize } from "~/components/Avatar"; +import DocumentBreadcrumb from "~/components/DocumentBreadcrumb"; import Flex from "~/components/Flex"; import { DocumentsSection, @@ -57,7 +58,7 @@ function MentionMenu({ search, isActive, ...rest }: Props) { res.data.documents.map(documents.add); res.data.users.map(users.add); res.data.collections.map(collections.add); - }, [search, documents, users]) + }, [search, documents, users, collections]) ); React.useEffect(() => { @@ -68,7 +69,7 @@ function MentionMenu({ search, isActive, ...rest }: Props) { React.useEffect(() => { if (actorId && !loading) { - const items = users + const items: MentionItem[] = users .findByQuery(search, { maxResults: maxResultsInSection }) .map( (user) => @@ -112,7 +113,14 @@ function MentionMenu({ search, isActive, ...rest }: Props) { ), title: doc.title, - subtitle: doc.collection?.name, + subtitle: ( + + ), section: DocumentsSection, appendSpace: true, attrs: { diff --git a/shared/editor/types/index.ts b/shared/editor/types/index.ts index ef4b90d806..26d57dd38b 100644 --- a/shared/editor/types/index.ts +++ b/shared/editor/types/index.ts @@ -24,7 +24,7 @@ export type MenuItem = { name?: string; title?: string; section?: Section; - subtitle?: string; + subtitle?: React.ReactNode; shortcut?: string; keywords?: string; tooltip?: string; From 298298223bd93510572088c11b072bed187839c6 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Thu, 24 Apr 2025 07:02:57 -0400 Subject: [PATCH 04/64] fix: Allow viewers to read templates (#9042) --- server/policies/team.test.ts | 2 +- server/policies/team.ts | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/server/policies/team.test.ts b/server/policies/team.test.ts index d1e9914657..f3d99689b5 100644 --- a/server/policies/team.test.ts +++ b/server/policies/team.test.ts @@ -57,7 +57,7 @@ describe("policies/team", () => { const permissions = new Map([ [UserRole.Admin, true], [UserRole.Member, true], - [UserRole.Viewer, false], + [UserRole.Viewer, true], [UserRole.Guest, true], ]); for (const [role, permission] of permissions.entries()) { diff --git a/server/policies/team.ts b/server/policies/team.ts index eefd3802a5..1afdb611d2 100644 --- a/server/policies/team.ts +++ b/server/policies/team.ts @@ -9,7 +9,7 @@ import { or, } from "./utils"; -allow(User, "read", Team, isTeamModel); +allow(User, ["read", "readTemplate"], Team, isTeamModel); allow(User, "share", Team, (actor, team) => and( @@ -50,10 +50,6 @@ allow(User, "createTemplate", Team, (actor, team) => ) ); -allow(User, "readTemplate", Team, (actor, team) => - and(!actor.isViewer, isTeamModel(actor, team)) -); - allow(User, "updateTemplate", Team, (actor, team) => and( // From b7c13f092bc8535bc276c35ae7017d0dfa883d95 Mon Sep 17 00:00:00 2001 From: "codegen-sh[bot]" <131295404+codegen-sh[bot]@users.noreply.github.com> Date: Thu, 24 Apr 2025 07:03:18 -0400 Subject: [PATCH 05/64] refactor: Convert PaginatedList component to functional style (#9030) * refactor: Convert PaginatedList component to functional style * tsc --------- Co-authored-by: codegen-sh[bot] <131295404+codegen-sh[bot]@users.noreply.github.com> Co-authored-by: Tom Moor --- app/components/DocumentViews.tsx | 4 +- app/components/FilterOptions.tsx | 4 +- .../Notifications/Notifications.tsx | 4 +- app/components/PaginatedDocumentList.tsx | 6 +- app/components/PaginatedEventList.tsx | 2 +- app/components/PaginatedList.test.tsx | 38 +- app/components/PaginatedList.tsx | 432 ++++++++++-------- app/components/SearchPopover.tsx | 4 +- .../Sidebar/components/ArchiveLink.tsx | 4 +- .../Sidebar/components/Collections.tsx | 4 +- app/scenes/Document/components/Insights.tsx | 4 +- app/scenes/Settings/ApiKeys.tsx | 4 +- app/scenes/Settings/Export.tsx | 4 +- app/scenes/Settings/Import.tsx | 4 +- app/scenes/Settings/PersonalApiKeys.tsx | 4 +- .../Settings/components/GroupDialogs.tsx | 8 +- plugins/webhooks/client/Settings.tsx | 8 +- 17 files changed, 295 insertions(+), 243 deletions(-) diff --git a/app/components/DocumentViews.tsx b/app/components/DocumentViews.tsx index 6c6eb29bd8..b8aa85a43e 100644 --- a/app/components/DocumentViews.tsx +++ b/app/components/DocumentViews.tsx @@ -46,10 +46,10 @@ function DocumentViews({ document, isOpen }: Props) { return ( <> {isOpen && ( - aria-label={t("Viewers")} items={users} - renderItem={(model: User) => { + renderItem={(model) => { const view = documentViews.find((v) => v.userId === model.id); const isPresent = presentIds.includes(model.id); const isEditing = editingIds.includes(model.id); diff --git a/app/components/FilterOptions.tsx b/app/components/FilterOptions.tsx index 34a4da1517..b48912f9c9 100644 --- a/app/components/FilterOptions.tsx +++ b/app/components/FilterOptions.tsx @@ -56,7 +56,7 @@ const FilterOptions = ({ : ""; const renderItem = React.useCallback( - (option: TFilterOption) => ( + (option) => ( { @@ -174,7 +174,7 @@ const FilterOptions = ({ )} - listRef={listRef} options={{ query, ...fetchQueryOptions }} items={filteredOptions} diff --git a/app/components/Notifications/Notifications.tsx b/app/components/Notifications/Notifications.tsx index e297041cca..481255133a 100644 --- a/app/components/Notifications/Notifications.tsx +++ b/app/components/Notifications/Notifications.tsx @@ -79,11 +79,11 @@ function Notifications( - fetch={notifications.fetchPage} options={{ archived: false }} items={isOpen ? notifications.orderedData : undefined} - renderItem={(item: Notification) => ( + renderItem={(item) => ( Promise; options?: Record; heading?: React.ReactNode; - empty?: React.ReactNode; + empty?: JSX.Element; showParentDocuments?: boolean; showCollection?: boolean; showPublished?: boolean; @@ -34,7 +34,7 @@ const PaginatedDocumentList = React.memo(function PaginatedDocumentList({ const { t } = useTranslation(); return ( - aria-label={t("Documents")} items={documents} empty={empty} @@ -42,7 +42,7 @@ const PaginatedDocumentList = React.memo(function PaginatedDocumentList({ fetch={fetch} options={options} renderError={(props) => } - renderItem={(item: Document, _index) => ( + renderItem={(item, _index) => ( | undefined) => Promise; options?: Record; heading?: React.ReactNode; - empty?: React.ReactNode; + empty?: JSX.Element; }; const PaginatedEventList = React.memo(function PaginatedEventList({ diff --git a/app/components/PaginatedList.test.tsx b/app/components/PaginatedList.test.tsx index 2a04ca2c96..3adb9b5c9b 100644 --- a/app/components/PaginatedList.test.tsx +++ b/app/components/PaginatedList.test.tsx @@ -1,13 +1,15 @@ import "../stores"; import { render } from "@testing-library/react"; import { TFunction } from "i18next"; +import { Provider } from "mobx-react"; import * as React from "react"; import { getI18n } from "react-i18next"; import { Pagination } from "@shared/constants"; -import { Component as PaginatedList } from "./PaginatedList"; +import PaginatedList from "./PaginatedList"; describe("PaginatedList", () => { const i18n = getI18n(); + const authStore = {}; const props = { i18n, @@ -17,19 +19,23 @@ describe("PaginatedList", () => { it("with no items renders nothing", () => { const result = render( - + + + ); expect(result.container.innerHTML).toEqual(""); }); it("with no items renders empty prop", async () => { const result = render( - Sorry, no results

} - renderItem={render} - {...props} - /> + + Sorry, no results

} + renderItem={render} + {...props} + />{" "} +
); await expect( result.findAllByText("Sorry, no results") @@ -42,13 +48,15 @@ describe("PaginatedList", () => { id: "one", }; render( - + + {" "} + ); expect(fetch).toHaveBeenCalledWith({ ...options, diff --git a/app/components/PaginatedList.tsx b/app/components/PaginatedList.tsx index ea7b9f86eb..b289db622e 100644 --- a/app/components/PaginatedList.tsx +++ b/app/components/PaginatedList.tsx @@ -1,265 +1,309 @@ import isEqual from "lodash/isEqual"; -import { observable, action, computed } from "mobx"; -import { observer } from "mobx-react"; import * as React from "react"; -import { withTranslation, WithTranslation } from "react-i18next"; +import { useTranslation } from "react-i18next"; import { Waypoint } from "react-waypoint"; import { Pagination } from "@shared/constants"; -import RootStore from "~/stores/RootStore"; import ArrowKeyNavigation from "~/components/ArrowKeyNavigation"; import DelayedMount from "~/components/DelayedMount"; import PlaceholderList from "~/components/List/Placeholder"; -import withStores from "~/components/withStores"; +import useCurrentUser from "~/hooks/useCurrentUser"; +import usePrevious from "~/hooks/usePrevious"; import { dateToHeading } from "~/utils/date"; +/** + * Base interface for items that can be paginated + * @interface PaginatedItem + */ export interface PaginatedItem { + /** Unique identifier for the item */ id?: string; + /** Last update timestamp of the item */ updatedAt?: string; + /** Creation timestamp of the item */ createdAt?: string; } -type Props = WithTranslation & - RootStore & - React.HTMLAttributes & { - fetch?: ( - options: Record | undefined - ) => Promise | undefined; - options?: Record; - heading?: React.ReactNode; - empty?: React.ReactNode; - loading?: React.ReactElement; - items?: T[]; - className?: string; - renderItem: (item: T, index: number) => React.ReactNode; - renderError?: (options: { - error: Error; - retry: () => void; - }) => React.ReactNode; - renderHeading?: (name: React.ReactElement | string) => React.ReactNode; - onEscape?: (ev: React.KeyboardEvent) => void; - listRef?: React.RefObject; - }; +/** + * Props for the PaginatedList component + * @template T Type of items in the list, must extend PaginatedItem + */ +interface Props + extends React.HTMLAttributes { + /** + * Function to fetch paginated data. Should return a promise resolving to an array of items + * @param options Pagination and other query options + */ + fetch?: ( + options: Record | undefined + ) => Promise | undefined; -@observer -class PaginatedList extends React.PureComponent< - Props -> { - @observable - error?: Error; + /** Additional options to pass to the fetch function */ + options?: Record; - @observable - isFetchingMore = false; + /** Optional header content to display above the list */ + heading?: React.ReactNode; - @observable - isFetching = false; + /** Content to display when the list is empty */ + empty?: JSX.Element | null; - @observable - isFetchingInitial = !this.props.items?.length; + /** Optional loading state content */ + loading?: JSX.Element | null; - @observable - fetchCounter = 0; + /** Array of items to display in the list */ + items?: T[]; - @observable - renderCount = Pagination.defaultLimit; + /** CSS class name to apply to the list container */ + className?: string; - @observable - offset = 0; + /** + * Function to render each individual item in the list + * @param item The item to render + * @param index The index of the item in the list + */ + renderItem: (item: T, index: number) => React.ReactNode; - @observable - allowLoadMore = true; + /** + * Function to render error state + * @param options Object containing error details and retry function + */ + renderError?: (options: { + /** Details of the error */ + error: Error; + /** Function to retry the fetch operation */ + retry: () => void; + }) => JSX.Element; - componentDidMount() { - void this.fetchResults(); - } + /** + * Function to render section headings (typically date-based) + * @param name The heading text or element to render + */ + renderHeading?: (name: React.ReactElement | string) => React.ReactNode; - componentDidUpdate(prevProps: Props) { - if ( - prevProps.fetch !== this.props.fetch || - !isEqual(prevProps.options, this.props.options) - ) { - this.reset(); - void this.fetchResults(); - } - } + /** + * Handler for escape key press + * @param ev Keyboard event object + */ + onEscape?: (ev: React.KeyboardEvent) => void; - reset = () => { - this.offset = 0; - this.allowLoadMore = true; - this.renderCount = Pagination.defaultLimit; - this.isFetching = false; - this.isFetchingInitial = false; - this.isFetchingMore = false; - }; + /** Reference to the list container element */ + listRef?: React.RefObject; +} - @action - fetchResults = async () => { - if (!this.props.fetch) { +/** + * A reusable component that renders a paginated list with infinite scrolling + * and optional date-based section headings. + * + * @template T Type of the list items, must extend PaginatedItem + */ +const PaginatedList = ({ + fetch, + options, + heading, + empty = null, + loading = null, + items = [], + className, + renderItem, + renderError, + renderHeading, + onEscape, + listRef, + ...rest +}: Props): JSX.Element | null => { + const user = useCurrentUser({ rejectOnEmpty: false }); + const { t } = useTranslation(); + + const [error, setError] = React.useState(); + const [isFetchingMore, setIsFetchingMore] = React.useState(false); + const [isFetching, setIsFetching] = React.useState(false); + const [isFetchingInitial, setIsFetchingInitial] = React.useState( + !items?.length + ); + const [fetchCounter, setFetchCounter] = React.useState(0); + const [renderCount, setRenderCount] = React.useState(Pagination.defaultLimit); + const [offset, setOffset] = React.useState(0); + const [allowLoadMore, setAllowLoadMore] = React.useState(true); + + const reset = React.useCallback(() => { + setOffset(0); + setAllowLoadMore(true); + setRenderCount(Pagination.defaultLimit); + setIsFetching(false); + setIsFetchingInitial(false); + setIsFetchingMore(false); + }, []); + + const fetchResults = React.useCallback(async () => { + if (!fetch) { return; } - this.isFetching = true; - const counter = ++this.fetchCounter; - const limit = this.props.options?.limit ?? Pagination.defaultLimit; - this.error = undefined; + + setIsFetching(true); + const counter = fetchCounter + 1; + setFetchCounter(counter); + const limit = options?.limit ?? Pagination.defaultLimit; + setError(undefined); try { - const results = await this.props.fetch({ + const results = await fetch({ limit, - offset: this.offset, - ...this.props.options, + offset, + ...options, }); - if (this.offset !== 0) { - this.renderCount += limit; + if (offset !== 0) { + setRenderCount((prevCount) => prevCount + limit); } if (results && (results.length === 0 || results.length < limit)) { - this.allowLoadMore = false; + setAllowLoadMore(false); } else { - this.offset += limit; + setOffset((prevOffset) => prevOffset + limit); } - this.isFetchingInitial = false; + setIsFetchingInitial(false); } catch (err) { - this.error = err; + setError(err); } finally { // only the most recent fetch should end the loading state - if (counter >= this.fetchCounter) { - this.isFetching = false; - this.isFetchingMore = false; + if (counter >= fetchCounter) { + setIsFetching(false); + setIsFetchingMore(false); } } - }; + }, [fetch, fetchCounter, offset, options]); - @action - loadMoreResults = async () => { - // Don't paginate if there aren't more results or we’re currently fetching - if (!this.allowLoadMore || this.isFetching) { + const loadMoreResults = React.useCallback(async () => { + // Don't paginate if there aren't more results or we're currently fetching + if (!allowLoadMore || isFetching) { return; } + // If there are already cached results that we haven't yet rendered because // of lazy rendering then show another page. - const leftToRender = (this.props.items?.length ?? 0) - this.renderCount; + const leftToRender = (items?.length ?? 0) - renderCount; if (leftToRender > 0) { - this.renderCount += Pagination.defaultLimit; + setRenderCount((prevCount) => prevCount + Pagination.defaultLimit); } // If there are less than a pages results in the cache go ahead and fetch // another page from the server if (leftToRender <= Pagination.defaultLimit) { - this.isFetchingMore = true; - await this.fetchResults(); + setIsFetchingMore(true); + await fetchResults(); } - }; + }, [allowLoadMore, isFetching, items?.length, renderCount, fetchResults]); - @computed - get itemsToRender() { - return this.props.items?.slice(0, this.renderCount) ?? []; - } + React.useEffect(() => { + void fetchResults(); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, []); - render() { - const { - items = [], - heading, - auth, - empty = null, - renderHeading, - renderError, - onEscape, - } = this.props; + const prevFetch = usePrevious(fetch); + const prevOptions = usePrevious(options); - const showLoading = - this.isFetching && - !this.isFetchingMore && - (!items?.length || (this.fetchCounter <= 1 && this.isFetchingInitial)); - - if (showLoading) { - return ( - this.props.loading || ( - -
- -
-
- ) - ); + // Equivalent to componentDidUpdate + React.useEffect(() => { + if (prevFetch !== fetch || !isEqual(prevOptions, options)) { + reset(); + void fetchResults(); } + }, [fetch, options, reset, prevFetch, prevOptions, fetchResults]); - if (items?.length === 0) { - if (this.error && renderError) { - return renderError({ error: this.error, retry: this.fetchResults }); - } + // Computed property equivalent + const itemsToRender = React.useMemo( + () => items?.slice(0, renderCount) ?? [], + [items, renderCount] + ); - return empty; - } + const showLoading = + isFetching && + !isFetchingMore && + (!items?.length || (fetchCounter <= 1 && isFetchingInitial)); + if (showLoading) { return ( - <> - {heading} - - {() => { - let previousHeading = ""; - return this.itemsToRender.map((item, index) => { - const children = this.props.renderItem(item, index); - - // If there is no renderHeading method passed then no date - // headings are rendered - if (!renderHeading) { - return children; - } - - // Our models have standard date fields, updatedAt > createdAt. - // Get what a heading would look like for this item - const currentDate = - "updatedAt" in item && item.updatedAt - ? item.updatedAt - : "createdAt" in item && item.createdAt - ? item.createdAt - : previousHeading; - const currentHeading = dateToHeading( - currentDate, - this.props.t, - auth.user?.language - ); - - // If the heading is different to any previous heading then we - // should render it, otherwise the item can go under the previous - // heading - if ( - children && - (!previousHeading || currentHeading !== previousHeading) - ) { - previousHeading = currentHeading; - return ( - - {renderHeading(currentHeading)} - {children} - - ); - } - - return children; - }); - }} - - {this.allowLoadMore && ( -
- + loading || ( + +
+
- )} - +
+ ) ); } -} -export const Component = PaginatedList; + if (items?.length === 0) { + if (error && renderError) { + return renderError({ error, retry: fetchResults }); + } -export default withTranslation()(withStores(PaginatedList)); + return empty; + } + + return ( + + {heading} + + {() => { + let previousHeading = ""; + return itemsToRender.map((item, index) => { + const children = renderItem(item, index); + + // If there is no renderHeading method passed then no date + // headings are rendered + if (!renderHeading) { + return children; + } + + // Our models have standard date fields, updatedAt > createdAt. + // Get what a heading would look like for this item + const currentDate = + "updatedAt" in item && item.updatedAt + ? item.updatedAt + : "createdAt" in item && item.createdAt + ? item.createdAt + : previousHeading; + const currentHeading = dateToHeading( + currentDate, + t, + user?.language + ); + + // If the heading is different to any previous heading then we + // should render it, otherwise the item can go under the previous + // heading + if ( + children && + (!previousHeading || currentHeading !== previousHeading) + ) { + previousHeading = currentHeading; + return ( + + {renderHeading(currentHeading)} + {children} + + ); + } + + return children; + }); + }} + + {allowLoadMore && ( +
+ +
+ )} +
+ ); +}; + +export default PaginatedList; diff --git a/app/components/SearchPopover.tsx b/app/components/SearchPopover.tsx index 4ac2bcc523..2390a7604a 100644 --- a/app/components/SearchPopover.tsx +++ b/app/components/SearchPopover.tsx @@ -200,7 +200,7 @@ function SearchPopover({ shareId, className }: Props) { style={{ zIndex: depths.sidebar + 1 }} shrink > - options={{ query, snippetMinWords: 10, snippetMaxWords: 11 }} items={cachedSearchResults} fetch={performSearch} @@ -209,7 +209,7 @@ function SearchPopover({ shareId, className }: Props) { {t("No results for {{query}}", { query })} } loading={} - renderItem={(item: SearchResult, index) => ( + renderItem={(item, index) => ( {expanded === true ? ( - aria-label={t("Archived collections")} items={collections.archived} loading={} renderError={(props) => } - renderItem={(item: Collection) => ( + renderItem={(item) => (
- options={params} aria-label={t("Collections")} items={collections.allActive} @@ -69,7 +69,7 @@ function Collections() { ) : undefined } renderError={(props) => } - renderItem={(item: Collection, index) => ( + renderItem={(item, index) => ( )} - aria-label={t("Contributors")} items={document.collaborators} - renderItem={(model: User) => ( + renderItem={(model) => ( - fetch={apiKeys.fetchPage} items={apiKeys.orderedData} heading={

{t("All")}

} - renderItem={(apiKey: ApiKey) => ( + renderItem={(apiKey) => ( )} /> diff --git a/app/scenes/Settings/Export.tsx b/app/scenes/Settings/Export.tsx index ad1652f971..4cf83553f6 100644 --- a/app/scenes/Settings/Export.tsx +++ b/app/scenes/Settings/Export.tsx @@ -48,7 +48,7 @@ function Export() { {t("Export data")}…
- items={fileOperations.exports} fetch={fileOperations.fetchPage} options={{ @@ -59,7 +59,7 @@ function Export() { Recent exports } - renderItem={(item: FileOperation) => ( + renderItem={(item) => ( )} /> diff --git a/app/scenes/Settings/Import.tsx b/app/scenes/Settings/Import.tsx index 7de0063880..838644b96f 100644 --- a/app/scenes/Settings/Import.tsx +++ b/app/scenes/Settings/Import.tsx @@ -183,7 +183,7 @@ function Import() { ))}

- items={allImports} fetch={fetchImports} heading={ @@ -191,7 +191,7 @@ function Import() { Recent imports } - renderItem={(item: ImportModel | FileOperation) => + renderItem={(item) => item instanceof ImportModel ? ( ) : ( diff --git a/app/scenes/Settings/PersonalApiKeys.tsx b/app/scenes/Settings/PersonalApiKeys.tsx index b0bfaf6c62..32bb83d0c6 100644 --- a/app/scenes/Settings/PersonalApiKeys.tsx +++ b/app/scenes/Settings/PersonalApiKeys.tsx @@ -61,12 +61,12 @@ function PersonalApiKeys() { }} /> - fetch={apiKeys.fetchPage} items={apiKeys.personalApiKeys} options={{ userId: user.id }} heading={

{t("Personal keys")}

} - renderItem={(apiKey: ApiKey) => ( + renderItem={(apiKey) => ( )} /> diff --git a/app/scenes/Settings/components/GroupDialogs.tsx b/app/scenes/Settings/components/GroupDialogs.tsx index 6941cf78e8..7ca290e0b2 100644 --- a/app/scenes/Settings/components/GroupDialogs.tsx +++ b/app/scenes/Settings/components/GroupDialogs.tsx @@ -268,14 +268,14 @@ export const ViewGroupMembersDialog = observer(function ({ Members - items={users.inGroup(group.id)} fetch={groupUsers.fetchPage} options={{ id: group.id, }} empty={{t("This group has no members.")}} - renderItem={(user: User) => ( + renderItem={(user) => ( ) : ( - empty={ query ? ( {t("No people matching your search")} @@ -392,7 +392,7 @@ const AddPeopleToGroupDialog = observer(function ({ } items={users.notInGroup(group.id, query)} fetch={query ? undefined : users.fetchPage} - renderItem={(item: User) => ( + renderItem={(item) => ( - fetch={webhookSubscriptions.fetchPage} items={webhookSubscriptions.enabled} heading={

{t("Active")}

} - renderItem={(webhook: WebhookSubscription) => ( + renderItem={(webhook) => ( )} /> - items={webhookSubscriptions.disabled} heading={

{t("Inactive")}

} - renderItem={(webhook: WebhookSubscription) => ( + renderItem={(webhook) => ( )} /> From de6c1735d95fbadba24047015b27edaf649756b1 Mon Sep 17 00:00:00 2001 From: Hemachandar <132386067+hmacr@users.noreply.github.com> Date: Thu, 24 Apr 2025 17:20:48 +0530 Subject: [PATCH 06/64] feat: Linear integration (#9037) * linear settings and oauth * unfurl * unfurl impl fix for recent merge from main * fetch labels * state icon * linear icon * uninstall hook * lint * i18n * cleanup * use workspace key, reduce icon size * determine completion percentage * extract completionPercentage to separate method --- .env.sample | 4 + .../HoverPreview/HoverPreviewIssue.tsx | 13 +- app/stores/IntegrationsStore.ts | 7 + app/utils/mention.ts | 15 ++ package.json | 1 + plugins/linear/client/Icon.tsx | 41 ++++ plugins/linear/client/Settings.tsx | 140 ++++++++++++ .../linear/client/components/LinearButton.tsx | 23 ++ plugins/linear/client/index.tsx | 16 ++ plugins/linear/plugin.json | 7 + plugins/linear/server/api/linear.ts | 110 ++++++++++ plugins/linear/server/api/schema.ts | 17 ++ plugins/linear/server/env.ts | 25 +++ plugins/linear/server/index.ts | 27 +++ plugins/linear/server/linear.ts | 204 ++++++++++++++++++ plugins/linear/server/uninstall.ts | 25 +++ plugins/linear/shared/LinearUtils.ts | 53 +++++ .../GitHubIssueStatusIcon.tsx} | 47 +--- .../IssueStatusIcon/LinearIssueStatusIcon.tsx | 75 +++++++ shared/components/IssueStatusIcon/index.tsx | 42 ++++ shared/editor/components/Mentions.tsx | 21 +- shared/i18n/locales/en_US/translation.json | 4 + shared/types.ts | 16 +- shared/utils/browser.ts | 12 ++ yarn.lock | 32 +++ 25 files changed, 927 insertions(+), 50 deletions(-) create mode 100644 plugins/linear/client/Icon.tsx create mode 100644 plugins/linear/client/Settings.tsx create mode 100644 plugins/linear/client/components/LinearButton.tsx create mode 100644 plugins/linear/client/index.tsx create mode 100644 plugins/linear/plugin.json create mode 100644 plugins/linear/server/api/linear.ts create mode 100644 plugins/linear/server/api/schema.ts create mode 100644 plugins/linear/server/env.ts create mode 100644 plugins/linear/server/index.ts create mode 100644 plugins/linear/server/linear.ts create mode 100644 plugins/linear/server/uninstall.ts create mode 100644 plugins/linear/shared/LinearUtils.ts rename shared/components/{IssueStatusIcon.tsx => IssueStatusIcon/GitHubIssueStatusIcon.tsx} (55%) create mode 100644 shared/components/IssueStatusIcon/LinearIssueStatusIcon.tsx create mode 100644 shared/components/IssueStatusIcon/index.tsx diff --git a/.env.sample b/.env.sample index 6478fe6fe6..10a99c497d 100644 --- a/.env.sample +++ b/.env.sample @@ -127,6 +127,10 @@ GITHUB_APP_NAME= GITHUB_APP_ID= GITHUB_APP_PRIVATE_KEY= +# Linear +LINEAR_CLIENT_ID= +LINEAR_CLIENT_SECRET= + # To configure Discord auth, you'll need to create a Discord Application at # => https://discord.com/developers/applications/ # diff --git a/app/components/HoverPreview/HoverPreviewIssue.tsx b/app/components/HoverPreview/HoverPreviewIssue.tsx index bf71e62ac4..4eee531ef0 100644 --- a/app/components/HoverPreview/HoverPreviewIssue.tsx +++ b/app/components/HoverPreview/HoverPreviewIssue.tsx @@ -1,7 +1,11 @@ import * as React from "react"; import { Trans } from "react-i18next"; import { IssueStatusIcon } from "@shared/components/IssueStatusIcon"; -import { UnfurlResourceType, UnfurlResponse } from "@shared/types"; +import { + IntegrationService, + UnfurlResourceType, + UnfurlResponse, +} from "@shared/types"; import { Avatar } from "~/components/Avatar"; import Flex from "~/components/Flex"; import Text from "../Text"; @@ -23,6 +27,11 @@ const HoverPreviewIssue = React.forwardRef(function _HoverPreviewIssue( ref: React.Ref ) { const authorName = author.name; + const urlObj = new URL(url); + const service = + urlObj.hostname === "github.com" + ? IntegrationService.GitHub + : IntegrationService.Linear; return ( @@ -31,7 +40,7 @@ const HoverPreviewIssue = React.forwardRef(function _HoverPreviewIssue( - <IssueStatusIcon status={state.name} color={state.color} /> + <IssueStatusIcon service={service} state={state} /> <span> {title} <Text type="tertiary">{id}</Text> </span> diff --git a/app/stores/IntegrationsStore.ts b/app/stores/IntegrationsStore.ts index 051971734a..98350cb751 100644 --- a/app/stores/IntegrationsStore.ts +++ b/app/stores/IntegrationsStore.ts @@ -21,6 +21,13 @@ class IntegrationsStore extends Store<Integration> { (integration) => integration.service === IntegrationService.GitHub ); } + + @computed + get linear(): Integration<IntegrationType.Embed>[] { + return this.orderedData.filter( + (integration) => integration.service === IntegrationService.Linear + ); + } } export default IntegrationsStore; diff --git a/app/utils/mention.ts b/app/utils/mention.ts index 303573e22d..5bf62c460a 100644 --- a/app/utils/mention.ts +++ b/app/utils/mention.ts @@ -27,6 +27,16 @@ export const isURLMentionable = ({ ); } + case IntegrationService.Linear: { + const settings = + integration.settings as IntegrationSettings<IntegrationType.Embed>; + + return ( + hostname === "linear.app" && + settings.linear?.workspace.key === pathParts[1] // ensure installed workspace key matches with the provided url. + ); + } + default: return false; } @@ -52,6 +62,11 @@ export const determineMentionType = ({ : undefined; } + case IntegrationService.Linear: { + const type = pathParts[2]; + return type === "issue" ? MentionType.Issue : undefined; + } + default: return; } diff --git a/package.json b/package.json index 37acd2e9e6..a18e682872 100644 --- a/package.json +++ b/package.json @@ -79,6 +79,7 @@ "@hocuspocus/server": "1.1.2", "@joplin/turndown-plugin-gfm": "^1.0.49", "@juggle/resize-observer": "^3.4.0", + "@linear/sdk": "^39.0.0", "@notionhq/client": "^2.3.0", "@octokit/auth-app": "^6.1.3", "@outlinewiki/koa-passport": "^4.2.1", diff --git a/plugins/linear/client/Icon.tsx b/plugins/linear/client/Icon.tsx new file mode 100644 index 0000000000..a16db9eb1a --- /dev/null +++ b/plugins/linear/client/Icon.tsx @@ -0,0 +1,41 @@ +import * as React from "react"; + +type Props = { + /** The size of the icon, 24px is default to match standard icons */ + size?: number; + /** The color of the icon, defaults to the current text color */ + fill?: string; +}; + +export default function Icon({ size = 24, fill = "currentColor" }: Props) { + return ( + <svg + fill={fill} + width={size} + height={size} + viewBox="0 0 24 24" + version="1.1" + > + <path + d="M3.93091 12.8481C4.11753 14.6298 4.89358 16.3615 6.25902 17.727C7.62446 19.0923 9.35612 19.8684 11.1378 20.0551L3.93091 12.8481Z" + fillRule="evenodd" + clipRule="evenodd" + /> + <path + d="M3.89929 11.5437L12.4422 20.0865C13.1671 20.0459 13.8876 19.9084 14.5827 19.6738L4.31194 9.4032C4.07743 10.0982 3.93988 10.8187 3.89929 11.5437Z" + fillRule="evenodd" + clipRule="evenodd" + /> + <path + d="M4.67981 8.49828L15.4875 19.306C16.0482 19.0374 16.5845 18.7005 17.0837 18.2953L5.6905 6.90222C5.28537 7.40142 4.94847 7.93759 4.67981 8.49828Z" + fillRule="evenodd" + clipRule="evenodd" + /> + <path + d="M6.29602 6.23494C9.46213 3.10852 14.5632 3.12079 17.7141 6.27173C20.865 9.42266 20.8774 14.5237 17.7509 17.6898L6.29602 6.23494Z" + fillRule="evenodd" + clipRule="evenodd" + /> + </svg> + ); +} diff --git a/plugins/linear/client/Settings.tsx b/plugins/linear/client/Settings.tsx new file mode 100644 index 0000000000..c4528bbfdf --- /dev/null +++ b/plugins/linear/client/Settings.tsx @@ -0,0 +1,140 @@ +import { observer } from "mobx-react"; +import { PlusIcon } from "outline-icons"; +import * as React from "react"; +import { useTranslation, Trans } from "react-i18next"; +import { IntegrationService } from "@shared/types"; +import { ConnectedButton } from "~/scenes/Settings/components/ConnectedButton"; +import { AvatarSize } from "~/components/Avatar"; +import Flex from "~/components/Flex"; +import Heading from "~/components/Heading"; +import List from "~/components/List"; +import ListItem from "~/components/List/Item"; +import Notice from "~/components/Notice"; +import PlaceholderText from "~/components/PlaceholderText"; +import Scene from "~/components/Scene"; +import TeamLogo from "~/components/TeamLogo"; +import Text from "~/components/Text"; +import Time from "~/components/Time"; +import env from "~/env"; +import useQuery from "~/hooks/useQuery"; +import useStores from "~/hooks/useStores"; +import LinearIcon from "./Icon"; +import { LinearConnectButton } from "./components/LinearButton"; + +function Linear() { + const { integrations } = useStores(); + const { t } = useTranslation(); + const query = useQuery(); + const error = query.get("error"); + const appName = env.APP_NAME; + + React.useEffect(() => { + void integrations.fetchAll({ + service: IntegrationService.Linear, + withRelations: true, + }); + }, [integrations]); + + return ( + <Scene title="Linear" icon={<LinearIcon />}> + <Heading>Linear</Heading> + + {error === "access_denied" && ( + <Notice> + <Trans> + Whoops, you need to accept the permissions in Linear to connect{" "} + {{ appName }} to your workspace. Try again? + </Trans> + </Notice> + )} + {error === "unauthenticated" && ( + <Notice> + <Trans> + Something went wrong while authenticating your request. Please try + logging in again. + </Trans> + </Notice> + )} + {env.LINEAR_CLIENT_ID ? ( + <> + <Text as="p"> + <Trans> + Enable previews of Linear issues in documents by connecting a + Linear workspace to {appName}. + </Trans> + </Text> + {integrations.linear.length ? ( + <> + <Heading as="h2"> + <Flex justify="space-between" auto> + {t("Connected")} + <LinearConnectButton icon={<PlusIcon />} /> + </Flex> + </Heading> + <List> + {integrations.linear.map((integration) => { + const linearWorkspace = + integration.settings?.linear?.workspace; + const integrationCreatedBy = integration.user + ? integration.user.name + : undefined; + + return ( + <ListItem + key={linearWorkspace?.id} + small + title={linearWorkspace?.name} + subtitle={ + integrationCreatedBy ? ( + <> + <Trans>Enabled by {{ integrationCreatedBy }}</Trans>{" "} + ·{" "} + <Time + dateTime={integration.createdAt} + relative={false} + format={{ en_US: "MMMM d, y" }} + /> + </> + ) : ( + <PlaceholderText /> + ) + } + image={ + <TeamLogo + src={linearWorkspace?.logoUrl} + size={AvatarSize.Large} + /> + } + actions={ + <ConnectedButton + onClick={integration.delete} + confirmationMessage={t( + "Disconnecting will prevent previewing Linear links from this workspace in documents. Are you sure?" + )} + /> + } + /> + ); + })} + </List> + </> + ) : ( + <p> + <LinearConnectButton icon={<LinearIcon />} /> + </p> + )} + </> + ) : ( + <Notice> + <Trans> + The Linear integration is currently disabled. Please set the + associated environment variables and restart the server to enable + the integration. + </Trans> + </Notice> + )} + </Scene> + ); +} + +export default observer(Linear); diff --git a/plugins/linear/client/components/LinearButton.tsx b/plugins/linear/client/components/LinearButton.tsx new file mode 100644 index 0000000000..d607b2b430 --- /dev/null +++ b/plugins/linear/client/components/LinearButton.tsx @@ -0,0 +1,23 @@ +import * as React from "react"; +import { useTranslation } from "react-i18next"; +import Button, { type Props } from "~/components/Button"; +import useCurrentTeam from "~/hooks/useCurrentTeam"; +import { redirectTo } from "~/utils/urls"; +import { LinearUtils } from "../../shared/LinearUtils"; + +export function LinearConnectButton(props: Props<HTMLButtonElement>) { + const { t } = useTranslation(); + const team = useCurrentTeam(); + + return ( + <Button + onClick={() => + redirectTo(LinearUtils.authUrl({ state: { teamId: team.id } })) + } + neutral + {...props} + > + {t("Connect")} + </Button> + ); +} diff --git a/plugins/linear/client/index.tsx b/plugins/linear/client/index.tsx new file mode 100644 index 0000000000..fbdc2d7824 --- /dev/null +++ b/plugins/linear/client/index.tsx @@ -0,0 +1,16 @@ +import * as React from "react"; +import { Hook, PluginManager } from "~/utils/PluginManager"; +import config from "../plugin.json"; +import Icon from "./Icon"; + +PluginManager.add([ + { + ...config, + type: Hook.Settings, + value: { + group: "Integrations", + icon: Icon, + component: React.lazy(() => import("./Settings")), + }, + }, +]); diff --git a/plugins/linear/plugin.json b/plugins/linear/plugin.json new file mode 100644 index 0000000000..ad99098078 --- /dev/null +++ b/plugins/linear/plugin.json @@ -0,0 +1,7 @@ +{ + "id": "linear", + "name": "Linear", + "priority": 15, + "description": "Adds a Linear integration for link unfurling and converting links to mentions.", + "after": "github" +} diff --git a/plugins/linear/server/api/linear.ts b/plugins/linear/server/api/linear.ts new file mode 100644 index 0000000000..97d47ff85b --- /dev/null +++ b/plugins/linear/server/api/linear.ts @@ -0,0 +1,110 @@ +import Router from "koa-router"; +import { IntegrationService, IntegrationType } from "@shared/types"; +import { parseDomain } from "@shared/utils/domains"; +import Logger from "@server/logging/Logger"; +import auth from "@server/middlewares/authentication"; +import { transaction } from "@server/middlewares/transaction"; +import validate from "@server/middlewares/validate"; +import { IntegrationAuthentication, Integration, Team } from "@server/models"; +import { APIContext } from "@server/types"; +import { Linear } from "../linear"; +import * as T from "./schema"; +import { LinearUtils } from "plugins/linear/shared/LinearUtils"; + +const router = new Router(); + +router.get( + "linear.callback", + auth({ + optional: true, + }), + validate(T.LinearCallbackSchema), + transaction(), + async (ctx: APIContext<T.LinearCallbackReq>) => { + const { code, state, error } = ctx.input.query; + const { user } = ctx.state.auth; + const { transaction } = ctx.state; + + let parsedState; + try { + parsedState = LinearUtils.parseState(state); + } catch { + ctx.redirect(LinearUtils.errorUrl("invalid_state")); + return; + } + + const { teamId } = parsedState; + + // this code block accounts for the root domain being unable to + // access authentication for subdomains. We must forward to the appropriate + // subdomain to complete the oauth flow + if (!user) { + if (teamId) { + try { + const team = await Team.findByPk(teamId, { + rejectOnEmpty: true, + transaction, + }); + return parseDomain(ctx.host).teamSubdomain === team.subdomain + ? ctx.redirect("/") + : ctx.redirectOnClient( + LinearUtils.callbackUrl({ + baseUrl: team.url, + params: ctx.request.querystring, + }) + ); + } catch (err) { + Logger.error(`Error fetching team for teamId: ${teamId}!`, err); + return ctx.redirect(LinearUtils.errorUrl("unauthenticated")); + } + } else { + return ctx.redirect(LinearUtils.errorUrl("unauthenticated")); + } + } + + // Check error after any sub-domain redirection. Otherwise, the user will be redirected to the root domain. + if (error) { + ctx.redirect(LinearUtils.errorUrl(error)); + return; + } + + // validation middleware ensures that code is non-null at this point. + const oauth = await Linear.oauthAccess(code!); + const workspace = await Linear.getInstalledWorkspace(oauth.access_token); + + const authentication = await IntegrationAuthentication.create( + { + service: IntegrationService.Linear, + userId: user.id, + teamId: user.teamId, + token: oauth.access_token, + scopes: oauth.scope.split(" "), + }, + { transaction } + ); + await Integration.create<Integration<IntegrationType.Embed>>( + { + service: IntegrationService.Linear, + type: IntegrationType.Embed, + userId: user.id, + teamId: user.teamId, + authenticationId: authentication.id, + settings: { + linear: { + workspace: { + id: workspace.id, + name: workspace.name, + key: workspace.urlKey, + logoUrl: workspace.logoUrl, + }, + }, + }, + }, + { transaction } + ); + + ctx.redirect(LinearUtils.successUrl()); + } +); + +export default router; diff --git a/plugins/linear/server/api/schema.ts b/plugins/linear/server/api/schema.ts new file mode 100644 index 0000000000..73abca1b8a --- /dev/null +++ b/plugins/linear/server/api/schema.ts @@ -0,0 +1,17 @@ +import isEmpty from "lodash/isEmpty"; +import { z } from "zod"; +import { BaseSchema } from "@server/routes/api/schema"; + +export const LinearCallbackSchema = BaseSchema.extend({ + query: z + .object({ + code: z.string().nullish(), + state: z.string(), + error: z.string().nullish(), + }) + .refine((req) => !(isEmpty(req.code) && isEmpty(req.error)), { + message: "one of code or error is required", + }), +}); + +export type LinearCallbackReq = z.infer<typeof LinearCallbackSchema>; diff --git a/plugins/linear/server/env.ts b/plugins/linear/server/env.ts new file mode 100644 index 0000000000..032ca41a1e --- /dev/null +++ b/plugins/linear/server/env.ts @@ -0,0 +1,25 @@ +import { IsOptional } from "class-validator"; +import { Environment } from "@server/env"; +import { Public } from "@server/utils/decorators/Public"; +import environment from "@server/utils/environment"; +import { CannotUseWithout } from "@server/utils/validators"; + +class LinearPluginEnvironment extends Environment { + /** + * Linear OAuth2 app client id. To enable integration with Linear. + */ + @Public + @IsOptional() + public LINEAR_CLIENT_ID = this.toOptionalString(environment.LINEAR_CLIENT_ID); + + /** + * Linear OAuth2 app client secret. To enable integration with Linear. + */ + @IsOptional() + @CannotUseWithout("LINEAR_CLIENT_ID") + public LINEAR_CLIENT_SECRET = this.toOptionalString( + environment.LINEAR_CLIENT_SECRET + ); +} + +export default new LinearPluginEnvironment(); diff --git a/plugins/linear/server/index.ts b/plugins/linear/server/index.ts new file mode 100644 index 0000000000..567b5ac168 --- /dev/null +++ b/plugins/linear/server/index.ts @@ -0,0 +1,27 @@ +import { Minute } from "@shared/utils/time"; +import { Hook, PluginManager } from "@server/utils/PluginManager"; +import config from "../plugin.json"; +import router from "./api/linear"; +import env from "./env"; +import { Linear } from "./linear"; +import { uninstall } from "./uninstall"; + +const enabled = !!env.LINEAR_CLIENT_ID && !!env.LINEAR_CLIENT_SECRET; + +if (enabled) { + PluginManager.add([ + { + ...config, + type: Hook.API, + value: router, + }, + { + type: Hook.UnfurlProvider, + value: { unfurl: Linear.unfurl, cacheExpiry: Minute.seconds }, + }, + { + type: Hook.Uninstall, + value: uninstall, + }, + ]); +} diff --git a/plugins/linear/server/linear.ts b/plugins/linear/server/linear.ts new file mode 100644 index 0000000000..e843e2d562 --- /dev/null +++ b/plugins/linear/server/linear.ts @@ -0,0 +1,204 @@ +import { Issue, LinearClient, WorkflowState } from "@linear/sdk"; +import sortBy from "lodash/sortBy"; +import { z } from "zod"; +import { + IntegrationService, + IntegrationType, + UnfurlResourceType, +} from "@shared/types"; +import Logger from "@server/logging/Logger"; +import { Integration } from "@server/models"; +import User from "@server/models/User"; +import { UnfurlIssueAndPR, UnfurlSignature } from "@server/types"; +import { LinearUtils } from "../shared/LinearUtils"; +import env from "./env"; + +const AccessTokenResponseSchema = z.object({ + access_token: z.string(), + token_type: z.string(), + expires_in: z.number(), + scope: z.string(), +}); + +export class Linear { + private static supportedUnfurls = [UnfurlResourceType.Issue]; + + static async oauthAccess(code: string) { + const headers = { + "Content-Type": "application/x-www-form-urlencoded", + Accept: "application/json", + }; + + const body = new URLSearchParams(); + body.set("code", code); + body.set("client_id", env.LINEAR_CLIENT_ID!); + body.set("client_secret", env.LINEAR_CLIENT_SECRET!); + body.set("redirect_uri", LinearUtils.callbackUrl()); + body.set("grant_type", "authorization_code"); + + const res = await fetch(LinearUtils.tokenUrl, { + method: "POST", + headers, + body, + }); + + return AccessTokenResponseSchema.parse(await res.json()); + } + + static async revokeAccess(accessToken: string) { + const headers = { + Authorization: `Bearer ${accessToken}`, + }; + + await fetch(LinearUtils.revokeUrl, { + method: "POST", + headers, + }); + } + + static async getInstalledWorkspace(accessToken: string) { + const client = new LinearClient({ accessToken }); + return client.organization; + } + + /** + * + * @param url Linear resource url + * @param actor User attempting to unfurl resource url + * @returns An object containing resource details e.g, a Linear issue details + */ + static unfurl: UnfurlSignature = async (url: string, actor: User) => { + const resource = Linear.parseUrl(url); + + if (!resource) { + return; + } + + const integration = (await Integration.scope("withAuthentication").findOne({ + where: { + service: IntegrationService.Linear, + teamId: actor.teamId, + "settings.linear.workspace.key": resource.workspaceKey, + }, + })) as Integration<IntegrationType.Embed>; + + if (!integration) { + return; + } + + try { + const client = new LinearClient({ + accessToken: integration.authentication.token, + }); + const issue = await client.issue(resource.id); + + if (!issue) { + return { error: "Resource not found" }; + } + + const [author, state, labels] = await Promise.all([ + issue.creator, + issue.state, + issue.paginate(issue.labels, {}), + ]); + + if (!author || !state || !labels) { + return { error: "Failed to fetch auxiliary data from Linear" }; + } + + const completionPercentage = await Linear.completionPercentage( + client, + issue, + state + ); + + return { + type: UnfurlResourceType.Issue, + url: issue.url, + id: issue.identifier, + title: issue.title, + description: issue.description ?? null, + author: { + name: author.name, + avatarUrl: author.avatarUrl ?? "", + }, + labels: labels.map((label) => ({ + name: label.name, + color: label.color, + })), + state: { + type: state.type, + name: state.name, + color: state.color, + completionPercentage, + }, + createdAt: issue.createdAt.toISOString(), + transformed_unfurl: true, + } satisfies UnfurlIssueAndPR; + } catch (err) { + Logger.warn("Failed to fetch resource from Linear", err); + return { error: err.message || "Unknown error" }; + } + }; + + private static async completionPercentage( + client: LinearClient, + issue: Issue, + state: WorkflowState + ) { + const defaultCompletionPercentage = 0.5; // fallback when we cannot determine actual value. + + if (state.type !== "started") { + return defaultCompletionPercentage; + } + + const team = await issue.team; + if (!team) { + return defaultCompletionPercentage; + } + + const allStates = await client.paginate(client.workflowStates, { + filter: { + team: { id: { eq: team.id } }, + type: { eq: "started" }, + }, + }); + const states = sortBy( + allStates.map((s) => ({ + name: s.name, + position: s.position, + })), + (s) => s.position + ); + + const idx = states.findIndex((s) => s.name === state.name); + return idx !== -1 + ? (idx + 1) / (states.length + 1) // add 1 to states for the "done" state. + : defaultCompletionPercentage; + } + + /** + * Parses a given URL and returns resource identifiers for Linear specific URLs + * + * @param url URL to parse + * @returns {object} Containing resource identifiers - `workspaceKey`, `type`, `id` and `name`. + */ + private static parseUrl(url: string) { + const { hostname, pathname } = new URL(url); + if (hostname !== "linear.app") { + return; + } + + const parts = pathname.split("/"); + const workspaceKey = parts[1]; + const type = parts[2] ? (parts[2] as UnfurlResourceType) : undefined; + const id = parts[3]; + const name = parts[4]; + + if (!type || !Linear.supportedUnfurls.includes(type)) { + return; + } + + return { workspaceKey, type, id, name }; + } +} diff --git a/plugins/linear/server/uninstall.ts b/plugins/linear/server/uninstall.ts new file mode 100644 index 0000000000..472caf6953 --- /dev/null +++ b/plugins/linear/server/uninstall.ts @@ -0,0 +1,25 @@ +import { IntegrationService, IntegrationType } from "@shared/types"; +import Logger from "@server/logging/Logger"; +import { Integration } from "@server/models"; +import { Linear } from "./linear"; + +export async function uninstall( + integration: Integration<IntegrationType.Embed> +) { + if (integration.service !== IntegrationService.Linear) { + return; + } + + const authentication = await integration.$get("authentication"); + + if (!authentication) { + return; + } + + try { + await Linear.revokeAccess(authentication.token); + } catch (err) { + // suppress error since this is a best-effort operation. + Logger.error("Failed to revoke Linear access token", err); + } +} diff --git a/plugins/linear/shared/LinearUtils.ts b/plugins/linear/shared/LinearUtils.ts new file mode 100644 index 0000000000..0ebee10724 --- /dev/null +++ b/plugins/linear/shared/LinearUtils.ts @@ -0,0 +1,53 @@ +import queryString from "query-string"; +import env from "@shared/env"; +import { integrationSettingsPath } from "@shared/utils/routeHelpers"; + +export type OAuthState = { + teamId: string; +}; + +export class LinearUtils { + private static oauthScopes = "read,issues:create"; + + public static tokenUrl = "https://api.linear.app/oauth/token"; + public static revokeUrl = "https://api.linear.app/oauth/revoke"; + private static authBaseUrl = "https://linear.app/oauth/authorize"; + + private static settingsUrl = integrationSettingsPath("linear"); + + static parseState(state: string): OAuthState { + return JSON.parse(state); + } + + static successUrl() { + return this.settingsUrl; + } + + static errorUrl(error: string) { + return `${this.settingsUrl}?error=${error}`; + } + + static callbackUrl( + { baseUrl, params }: { baseUrl: string; params?: string } = { + baseUrl: `${env.URL}`, + params: undefined, + } + ) { + return params + ? `${baseUrl}/api/linear.callback?${params}` + : `${baseUrl}/api/linear.callback`; + } + + static authUrl({ state }: { state: OAuthState }) { + const params = { + client_id: env.LINEAR_CLIENT_ID, + redirect_uri: this.callbackUrl(), + state: JSON.stringify(state), + scope: this.oauthScopes, + response_type: "code", + prompt: "consent", + actor: "application", + }; + return `${this.authBaseUrl}?${queryString.stringify(params)}`; + } +} diff --git a/shared/components/IssueStatusIcon.tsx b/shared/components/IssueStatusIcon/GitHubIssueStatusIcon.tsx similarity index 55% rename from shared/components/IssueStatusIcon.tsx rename to shared/components/IssueStatusIcon/GitHubIssueStatusIcon.tsx index 0b3e77c3c3..3239f92dff 100644 --- a/shared/components/IssueStatusIcon.tsx +++ b/shared/components/IssueStatusIcon/GitHubIssueStatusIcon.tsx @@ -1,43 +1,18 @@ -import * as React from "react"; -import styled from "styled-components"; +import React from "react"; +import { BaseIconProps } from "."; -type Props = { - status: string; - color: string; - size?: number; - className?: string; -}; +export function GitHubIssueStatusIcon(props: BaseIconProps) { + const { state, className } = props; -/** - * Issue status icon based on GitHub issue status, but can be used for any git-style integration. - */ -export function IssueStatusIcon({ size, ...rest }: Props) { - return ( - <Icon size={size}> - <BaseIcon {...rest} /> - </Icon> - ); -} - -const Icon = styled.span<{ size?: number }>` - display: inline-flex; - flex-shrink: 0; - width: ${(props) => props.size ?? 24}px; - height: ${(props) => props.size ?? 24}px; - align-items: center; - justify-content: center; -`; - -function BaseIcon(props: Props) { - switch (props.status) { + switch (state.name) { case "open": return ( <svg viewBox="0 0 16 16" width="16" height="16" - fill={props.color} - className={props.className} + fill={state.color} + className={className} > <path d="M8 9.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z" /> <path d="M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM1.5 8a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0Z" /> @@ -49,8 +24,8 @@ function BaseIcon(props: Props) { viewBox="0 0 16 16" width="16" height="16" - fill={props.color} - className={props.className} + fill={state.color} + className={className} > <path d="M11.28 6.78a.75.75 0 0 0-1.06-1.06L7.25 8.69 5.78 7.22a.75.75 0 0 0-1.06 1.06l2 2a.75.75 0 0 0 1.06 0l3.5-3.5Z" /> <path d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0Zm-1.5 0a6.5 6.5 0 1 0-13 0 6.5 6.5 0 0 0 13 0Z" /> @@ -62,8 +37,8 @@ function BaseIcon(props: Props) { viewBox="0 0 16 16" width="16" height="16" - fill={props.color} - className={props.className} + fill={state.color} + className={className} > <path d="M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM1.5 8a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0Zm9.78-2.22-5.5 5.5a.749.749 0 0 1-1.275-.326.749.749 0 0 1 .215-.734l5.5-5.5a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042Z" /> </svg> diff --git a/shared/components/IssueStatusIcon/LinearIssueStatusIcon.tsx b/shared/components/IssueStatusIcon/LinearIssueStatusIcon.tsx new file mode 100644 index 0000000000..e01a22c0ef --- /dev/null +++ b/shared/components/IssueStatusIcon/LinearIssueStatusIcon.tsx @@ -0,0 +1,75 @@ +import * as React from "react"; +import { useTheme } from "styled-components"; +import { isSafari } from "../../utils/browser"; +import { BaseIconProps } from "."; + +enum StateType { + Triage = "triage", + Backlog = "backlog", + Unstarted = "unstarted", + Started = "started", + Completed = "completed", + Canceled = "canceled", +} + +export function LinearIssueStatusIcon(props: BaseIconProps) { + const theme = useTheme(); + const { state } = props; + const percentage = + state.type === StateType.Triage || + state.type === StateType.Backlog || + state.type === StateType.Unstarted + ? 0 + : state.type === StateType.Started + ? state.completionPercentage ?? 0.5 + : 1; + const isTriage = state.type === StateType.Triage; + const isBacklog = state.type === StateType.Backlog; + const isCompleted = state.type === StateType.Completed; + // Due to some rendering issues and differences between browsers, the logical constant 4 in the rendering below + // needs to be a bit less to make 50% look like half a circle. + const magicFour = isSafari() ? 3.895 : 3.98; + + return ( + <svg width="14" height="14" viewBox="0 0 14 14" fill="none"> + <circle + cx={7} + cy={7} + r={isTriage ? 3.5 : 6} + fill="none" + stroke={state.color} + strokeWidth={isTriage ? 7 : 1.5} + strokeDasharray={isTriage ? "2 0" : isBacklog ? "1.4 1.74" : "3.14 0"} + strokeDashoffset={isTriage ? 3.2 : isBacklog ? 0.65 : -0.7} + /> + <circle + cx={7} + cy={7} + r={percentage === 1 ? 3 : 2} + fill="none" + stroke={state.color} + strokeWidth={percentage === 1 ? 6 : 4} + strokeDasharray={`${ + percentage * Math.PI * (percentage === 1 ? 6 : magicFour) + } 100`} + strokeDashoffset={0} + transform={`rotate(-90 7 7)`} + /> + {(isTriage || percentage === 1) && ( + <path + className="icon" + stroke="none" + d={isTriage ? triageIcon : isCompleted ? checkMarkIcon : closeIcon} + fill={theme.background} + /> + )} + </svg> + ); +} + +const checkMarkIcon = + "M10.951 4.24896C11.283 4.58091 11.283 5.11909 10.951 5.45104L5.95104 10.451C5.61909 10.783 5.0809 10.783 4.74896 10.451L2.74896 8.45104C2.41701 8.11909 2.41701 7.5809 2.74896 7.24896C3.0809 6.91701 3.61909 6.91701 3.95104 7.24896L5.35 8.64792L9.74896 4.24896C10.0809 3.91701 10.6191 3.91701 10.951 4.24896Z"; +const triageIcon = + "M8.0126 7.98223V9.50781C8.0126 9.92901 8.52329 10.1548 8.85102 9.87854L11.8258 7.37066C12.0581 7.17486 12.0581 6.82507 11.8258 6.62927L8.85102 4.12139C8.52329 3.84509 8.0126 4.07092 8.0126 4.49212V6.01763H5.98739V4.49218C5.98739 4.07098 5.4767 3.84515 5.14897 4.12146L2.17419 6.62933C1.94194 6.82513 1.94194 7.17492 2.17419 7.37072L5.14897 9.8786C5.4767 10.1549 5.98739 9.92907 5.98739 9.50787V7.98223H8.0126Z"; +const closeIcon = + "M3.73657 3.73657C4.05199 3.42114 4.56339 3.42114 4.87881 3.73657L5.93941 4.79716L7 5.85775L9.12117 3.73657C9.4366 3.42114 9.94801 3.42114 10.2634 3.73657C10.5789 4.05199 10.5789 4.56339 10.2634 4.87881L8.14225 7L10.2634 9.12118C10.5789 9.4366 10.5789 9.94801 10.2634 10.2634C9.94801 10.5789 9.4366 10.5789 9.12117 10.2634L7 8.14225L4.87881 10.2634C4.56339 10.5789 4.05199 10.5789 3.73657 10.2634C3.42114 9.94801 3.42114 9.4366 3.73657 9.12118L4.79716 8.06059L5.85775 7L3.73657 4.87881C3.42114 4.56339 3.42114 4.05199 3.73657 3.73657Z"; diff --git a/shared/components/IssueStatusIcon/index.tsx b/shared/components/IssueStatusIcon/index.tsx new file mode 100644 index 0000000000..b85a1e6402 --- /dev/null +++ b/shared/components/IssueStatusIcon/index.tsx @@ -0,0 +1,42 @@ +import * as React from "react"; +import styled from "styled-components"; +import { + IntegrationService, + IssueTrackerIntegrationService, + UnfurlResourceType, + UnfurlResponse, +} from "../../types"; +import { GitHubIssueStatusIcon } from "./GitHubIssueStatusIcon"; +import { LinearIssueStatusIcon } from "./LinearIssueStatusIcon"; + +export type BaseIconProps = { + state: UnfurlResponse[UnfurlResourceType.Issue]["state"]; + className?: string; +}; + +type Props = BaseIconProps & { + size?: number; + service: IssueTrackerIntegrationService; +}; + +export function IssueStatusIcon(props: Props) { + return <Icon size={props.size}>{getIcon(props)}</Icon>; +} + +function getIcon({ service, ...rest }: Props) { + switch (service) { + case IntegrationService.GitHub: + return <GitHubIssueStatusIcon {...rest} />; + case IntegrationService.Linear: + return <LinearIssueStatusIcon {...rest} />; + } +} + +const Icon = styled.span<{ size?: number }>` + display: inline-flex; + flex-shrink: 0; + width: ${(props) => props.size ?? 24}px; + height: ${(props) => props.size ?? 24}px; + align-items: center; + justify-content: center; +`; diff --git a/shared/editor/components/Mentions.tsx b/shared/editor/components/Mentions.tsx index 0ec427b553..2c33d34dfc 100644 --- a/shared/editor/components/Mentions.tsx +++ b/shared/editor/components/Mentions.tsx @@ -19,10 +19,11 @@ import Text from "../../components/Text"; import useIsMounted from "../../hooks/useIsMounted"; import useStores from "../../hooks/useStores"; import theme from "../../styles/theme"; -import type { - JSONValue, - UnfurlResourceType, - UnfurlResponse, +import { + IntegrationService, + type JSONValue, + type UnfurlResourceType, + type UnfurlResponse, } from "../../types"; import { cn } from "../styles/utils"; import { ComponentProps } from "../types"; @@ -187,6 +188,12 @@ export const MentionIssue = observer((props: IssuePrProps) => { const issue = unfurl as UnfurlResponse[UnfurlResourceType.Issue]; + const url = new URL(issue.url); + const service = + url.hostname === "github.com" + ? IntegrationService.GitHub + : IntegrationService.Linear; + return ( <a {...attrs} @@ -198,11 +205,7 @@ export const MentionIssue = observer((props: IssuePrProps) => { rel="noopener noreferrer nofollow" > <Flex align="center" gap={6}> - <IssueStatusIcon - size={14} - status={issue.state.name} - color={issue.state.color} - /> + <IssueStatusIcon size={14} service={service} state={issue.state} /> <Flex align="center" gap={4}> <Text>{issue.title}</Text> <Text type="tertiary">{issue.id}</Text> diff --git a/shared/i18n/locales/en_US/translation.json b/shared/i18n/locales/en_US/translation.json index 69080e8369..9e7704fc14 100644 --- a/shared/i18n/locales/en_US/translation.json +++ b/shared/i18n/locales/en_US/translation.json @@ -1089,6 +1089,10 @@ "Add a Google Analytics 4 measurement ID to send document views and analytics from the workspace to your own Google Analytics account.": "Add a Google Analytics 4 measurement ID to send document views and analytics from the workspace to your own Google Analytics account.", "Measurement ID": "Measurement ID", "Create a \"Web\" stream in your Google Analytics admin dashboard and copy the measurement ID from the generated code snippet to install.": "Create a \"Web\" stream in your Google Analytics admin dashboard and copy the measurement ID from the generated code snippet to install.", + "Whoops, you need to accept the permissions in Linear to connect {{appName}} to your workspace. Try again?": "Whoops, you need to accept the permissions in Linear to connect {{appName}} to your workspace. Try again?", + "Enable previews of Linear issues in documents by connecting a Linear workspace to {appName}.": "Enable previews of Linear issues in documents by connecting a Linear workspace to {appName}.", + "Disconnecting will prevent previewing Linear links from this workspace in documents. Are you sure?": "Disconnecting will prevent previewing Linear links from this workspace in documents. Are you sure?", + "The Linear integration is currently disabled. Please set the associated environment variables and restart the server to enable the integration.": "The Linear integration is currently disabled. Please set the associated environment variables and restart the server to enable the integration.", "Configure a Matomo installation to send views and analytics from the workspace to your own Matomo instance.": "Configure a Matomo installation to send views and analytics from the workspace to your own Matomo instance.", "Instance URL": "Instance URL", "The URL of your Matomo instance. If you are using Matomo Cloud it will end in matomo.cloud/": "The URL of your Matomo instance. If you are using Matomo Cloud it will end in matomo.cloud/", diff --git a/shared/types.ts b/shared/types.ts index 63cba80c0b..1ed45aaf47 100644 --- a/shared/types.ts +++ b/shared/types.ts @@ -117,6 +117,7 @@ export enum IntegrationService { Matomo = "matomo", Umami = "umami", GitHub = "github", + Linear = "linear", Notion = "notion", } @@ -131,11 +132,12 @@ export const ImportableIntegrationService = { export type IssueTrackerIntegrationService = Extract< IntegrationService, - IntegrationService.GitHub + IntegrationService.GitHub | IntegrationService.Linear >; export const IssueTrackerIntegrationService = { GitHub: IntegrationService.GitHub, + Linear: IntegrationService.Linear, } as const; export type UserCreatableIntegrationService = Extract< @@ -169,13 +171,16 @@ export enum DocumentPermission { export type IntegrationSettings<T> = T extends IntegrationType.Embed ? { - url: string; + url?: string; github?: { installation: { id: number; account: { id: number; name: string; avatarUrl: string }; }; }; + linear?: { + workspace: { id: string; name: string; key: string; logoUrl?: string }; + }; } : T extends IntegrationType.Analytics ? { measurementId: string; instanceUrl?: string; scriptName?: string } @@ -433,7 +438,12 @@ export type UnfurlResponse = { /** Issue's labels */ labels: Array<{ name: string; color: string }>; /** Issue's status */ - state: { name: string; color: string }; + state: { + type?: string; + name: string; + color: string; + completionPercentage?: number; + }; /** Issue's creation time */ createdAt: string; }; diff --git a/shared/utils/browser.ts b/shared/utils/browser.ts index 3ff106450f..f159989bfe 100644 --- a/shared/utils/browser.ts +++ b/shared/utils/browser.ts @@ -33,6 +33,18 @@ export function isWindows(): boolean { return window.navigator.platform === "Win32"; } +export function isSafari(): boolean { + if (!isBrowser) { + return false; + } + const userAgent = window.navigator.userAgent; + return ( + userAgent.includes("Safari") && + !userAgent.includes("Chrome") && + !userAgent.includes("Chromium") + ); +} + let supportsPassive = false; try { diff --git a/yarn.lock b/yarn.lock index 2676c70a65..a83574a1a8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2358,6 +2358,11 @@ dependencies: warning "^4.0.3" +"@graphql-typed-document-node/core@^3.1.0": + version "3.2.0" + resolved "https://registry.yarnpkg.com/@graphql-typed-document-node/core/-/core-3.2.0.tgz#5f3d96ec6b2354ad6d8a28bf216a1d97b5426861" + integrity sha512-mB9oAsNCm9aM3/SOv4YtBMqZbYj10R7dkq8byBqxGY/ncFwhf2oQzMV+LCRlWoDSEBJ3COiR1yeDvMtsoOsuFQ== + "@gulpjs/to-absolute-glob@^4.0.0": version "4.0.0" resolved "https://registry.yarnpkg.com/@gulpjs/to-absolute-glob/-/to-absolute-glob-4.0.0.tgz#1fc2460d3953e1d9b9f2dfdb4bcc99da4710c021" @@ -2796,6 +2801,15 @@ resolved "https://registry.yarnpkg.com/@lifeomic/attempt/-/attempt-3.0.3.tgz#e742a5b85eb673e2f1746b0f39cb932cbc6145bb" integrity "sha1-50KluF62c+LxdGsPOcuTLLxhRbs= sha512-GlM2AbzrErd/TmLL3E8hAHmb5Q7VhDJp35vIbyPVA5Rz55LZuRr8pwL3qrwwkVNo05gMX1J44gURKb4MHQZo7w==" +"@linear/sdk@^39.0.0": + version "39.0.0" + resolved "https://registry.yarnpkg.com/@linear/sdk/-/sdk-39.0.0.tgz#6238a04e4123386d5d873014afe5cafc40e6493d" + integrity sha512-GFZakeWsLFXyJjhrjt/VOW/lxMX9obOVw7ItypYWDh8IEzIui6gVN3EBof5A7zKqpdc6fsZEPYCvrI5FVet9+Q== + dependencies: + "@graphql-typed-document-node/core" "^3.1.0" + graphql "^15.4.0" + isomorphic-unfetch "^3.1.0" + "@mermaid-js/parser@^0.3.0": version "0.3.0" resolved "https://registry.yarnpkg.com/@mermaid-js/parser/-/parser-0.3.0.tgz#7a28714599f692f93df130b299fa1aadc9f9c8ab" @@ -9520,6 +9534,11 @@ graphemer@^1.4.0: resolved "https://registry.yarnpkg.com/graphemer/-/graphemer-1.4.0.tgz#fb2f1d55e0e3a1849aeffc90c4fa0dd53a0e66c6" integrity "sha1-+y8dVeDjoYSa7/yQxPoN1ToOZsY= sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==" +graphql@^15.4.0: + version "15.10.1" + resolved "https://registry.yarnpkg.com/graphql/-/graphql-15.10.1.tgz#e9ff3bb928749275477f748b14aa5c30dcad6f2f" + integrity sha512-BL/Xd/T9baO6NFzoMpiMD7YUZ62R6viR5tp/MULVEnbYJXZA//kRNW7J0j1w/wXArgL0sCxhDfK5dczSKn3+cg== + gulp-sort@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/gulp-sort/-/gulp-sort-2.0.0.tgz#c6762a2f1f0de0a3fc595a21599d3fac8dba1aca" @@ -10381,6 +10400,14 @@ isexe@^2.0.0: resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" integrity "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA= sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==" +isomorphic-unfetch@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/isomorphic-unfetch/-/isomorphic-unfetch-3.1.0.tgz#87341d5f4f7b63843d468438128cb087b7c3e98f" + integrity sha512-geDJjpoZ8N0kWexiwkX8F9NkTsXhetLPVbZFQ+JTW239QNOwvB0gniuR1Wc6f0AMTn7/mFGyXvHTifrCp/GH8Q== + dependencies: + node-fetch "^2.6.1" + unfetch "^4.2.0" + isomorphic-ws@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/isomorphic-ws/-/isomorphic-ws-4.0.1.tgz#55fd4cd6c5e6491e76dc125938dd863f5cd4f2dc" @@ -15369,6 +15396,11 @@ undici-types@~6.19.2: resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-6.19.8.tgz#35111c9d1437ab83a7cdc0abae2f26d88eda0a02" integrity sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw== +unfetch@^4.2.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/unfetch/-/unfetch-4.2.0.tgz#7e21b0ef7d363d8d9af0fb929a5555f6ef97a3be" + integrity sha512-F9p7yYCn6cIW9El1zi0HI6vqpeIvBsr3dSuRO6Xuppb1u5rXpCPmMvLSyECLhybr9isec8Ohl0hPekMVrEinDA== + unicode-canonical-property-names-ecmascript@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-2.0.0.tgz#301acdc525631670d39f6146e0e77ff6bbdebddc" From 2cc5846f1ba177790390806146f0629a11d826c1 Mon Sep 17 00:00:00 2001 From: "codegen-sh[bot]" <131295404+codegen-sh[bot]@users.noreply.github.com> Date: Thu, 24 Apr 2025 11:57:19 +0000 Subject: [PATCH 07/64] Truncate Notion document titles to fit validation limits (#9041) closes #9040 --- plugins/notion/server/notion.ts | 35 ++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/plugins/notion/server/notion.ts b/plugins/notion/server/notion.ts index 22a7783517..9508399407 100644 --- a/plugins/notion/server/notion.ts +++ b/plugins/notion/server/notion.ts @@ -15,9 +15,11 @@ import { import { RateLimit } from "async-sema"; import emojiRegex from "emoji-regex"; import compact from "lodash/compact"; +import truncate from "lodash/truncate"; import { z } from "zod"; import { Second } from "@shared/utils/time"; import { isUrl } from "@shared/utils/urls"; +import { CollectionValidation, DocumentValidation } from "@shared/validations"; import { NotionUtils } from "../shared/NotionUtils"; import { Block, Page, PageType } from "../shared/types"; import env from "./env"; @@ -116,7 +118,9 @@ export class NotionClient { pages.push({ type: item.object === "page" ? PageType.Page : PageType.Database, id: item.id, - name: this.parseTitle(item), + name: this.parseTitle(item, { + maxLength: CollectionValidation.maxNameLength, + }), emoji: this.parseEmoji(item), }); } @@ -162,7 +166,6 @@ export class NotionClient { cursor = response.next_cursor ?? undefined; } - // Recursive fetch when direct children have their own children. await Promise.all( blocks.map(async (block) => { if ( @@ -203,7 +206,9 @@ export class NotionClient { return { type: PageType.Page, id: item.id, - name: this.parseTitle(item), + name: this.parseTitle(item, { + maxLength: DocumentValidation.maxTitleLength, + }), emoji: this.parseEmoji(item), }; }) @@ -227,7 +232,9 @@ export class NotionClient { const author = await this.fetchUsername(page.created_by.id); return { - title: this.parseTitle(page), + title: this.parseTitle(page, { + maxLength: DocumentValidation.maxTitleLength, + }), emoji: this.parseEmoji(page), author: author ?? undefined, createdAt: !page.created_time ? undefined : new Date(page.created_time), @@ -246,7 +253,9 @@ export class NotionClient { const author = await this.fetchUsername(database.created_by.id); return { - title: this.parseTitle(database), + title: this.parseTitle(database, { + maxLength: DocumentValidation.maxTitleLength, + }), emoji: this.parseEmoji(database), author: author ?? undefined, createdAt: !database.created_time @@ -267,12 +276,12 @@ export class NotionClient { return user.name; } - // bot belongs to a user, get the user's name. + // bot belongs to a user, get the user's name if (user.bot.owner.type === "user" && isFullUser(user.bot.owner.user)) { return user.bot.owner.user.name; } - // bot belongs to a workspace, fallback to bot's name. + // bot belongs to a workspace, fallback to bot's name return user.name; } catch (error) { // Handle the case where a user can't be found @@ -286,7 +295,12 @@ export class NotionClient { } } - private parseTitle(item: PageObjectResponse | DatabaseObjectResponse) { + private parseTitle( + item: PageObjectResponse | DatabaseObjectResponse, + { + maxLength = DocumentValidation.maxTitleLength, + }: { maxLength?: number } = {} + ) { let richTexts: RichTextItemResponse[]; if (item.object === "page") { @@ -298,7 +312,10 @@ export class NotionClient { richTexts = item.title; } - return richTexts.map((richText) => richText.plain_text).join(""); + const title = richTexts.map((richText) => richText.plain_text).join(""); + + // Truncate title to fit within validation limits + return truncate(title, { length: maxLength }); } private parseEmoji(item: PageObjectResponse | DatabaseObjectResponse) { From 21e756c357c5970db841f6d94ccfac95b87c0777 Mon Sep 17 00:00:00 2001 From: Hemachandar <132386067+hmacr@users.noreply.github.com> Date: Fri, 25 Apr 2025 06:52:39 +0530 Subject: [PATCH 08/64] Check collection (or) document when processing page/database in Notion import (#9047) --- plugins/notion/server/notion.ts | 30 ++++++++++++++----- .../server/tasks/NotionAPIImportTask.ts | 12 ++++++-- 2 files changed, 32 insertions(+), 10 deletions(-) diff --git a/plugins/notion/server/notion.ts b/plugins/notion/server/notion.ts index 9508399407..abfef28a28 100644 --- a/plugins/notion/server/notion.ts +++ b/plugins/notion/server/notion.ts @@ -133,14 +133,22 @@ export class NotionClient { return pages; } - async fetchPage(pageId: string) { - const pageInfo = await this.fetchPageInfo(pageId); + async fetchPage( + pageId: string, + { titleMaxLength }: { titleMaxLength: number } + ) { + const pageInfo = await this.fetchPageInfo(pageId, { titleMaxLength }); const blocks = await this.fetchBlockChildren(pageId); return { ...pageInfo, blocks }; } - async fetchDatabase(databaseId: string) { - const databaseInfo = await this.fetchDatabaseInfo(databaseId); + async fetchDatabase( + databaseId: string, + { titleMaxLength }: { titleMaxLength: number } + ) { + const databaseInfo = await this.fetchDatabaseInfo(databaseId, { + titleMaxLength, + }); const pages = await this.queryDatabase(databaseId); return { ...databaseInfo, pages }; } @@ -223,7 +231,10 @@ export class NotionClient { return pages; } - private async fetchPageInfo(pageId: string): Promise<PageInfo> { + private async fetchPageInfo( + pageId: string, + { titleMaxLength }: { titleMaxLength: number } + ): Promise<PageInfo> { await this.limiter(); const page = (await this.client.pages.retrieve({ page_id: pageId, @@ -233,7 +244,7 @@ export class NotionClient { return { title: this.parseTitle(page, { - maxLength: DocumentValidation.maxTitleLength, + maxLength: titleMaxLength, }), emoji: this.parseEmoji(page), author: author ?? undefined, @@ -244,7 +255,10 @@ export class NotionClient { }; } - private async fetchDatabaseInfo(databaseId: string): Promise<PageInfo> { + private async fetchDatabaseInfo( + databaseId: string, + { titleMaxLength }: { titleMaxLength: number } + ): Promise<PageInfo> { await this.limiter(); const database = (await this.client.databases.retrieve({ database_id: databaseId, @@ -254,7 +268,7 @@ export class NotionClient { return { title: this.parseTitle(database, { - maxLength: DocumentValidation.maxTitleLength, + maxLength: titleMaxLength, }), emoji: this.parseEmoji(database), author: author ?? undefined, diff --git a/plugins/notion/server/tasks/NotionAPIImportTask.ts b/plugins/notion/server/tasks/NotionAPIImportTask.ts index 5198563ab4..0538583455 100644 --- a/plugins/notion/server/tasks/NotionAPIImportTask.ts +++ b/plugins/notion/server/tasks/NotionAPIImportTask.ts @@ -2,6 +2,7 @@ import { APIResponseError, APIErrorCode } from "@notionhq/client"; import { ImportTaskInput, ImportTaskOutput } from "@shared/schema"; import { IntegrationService, ProsemirrorDoc } from "@shared/types"; import { ProsemirrorHelper } from "@shared/utils/ProsemirrorHelper"; +import { CollectionValidation, DocumentValidation } from "@shared/validations"; import Logger from "@server/logging/Logger"; import { Integration } from "@server/models"; import ImportTask from "@server/models/ImportTask"; @@ -95,12 +96,17 @@ export default class NotionAPIImportTask extends APIImportTask<IntegrationServic client: NotionClient; }): Promise<ParsePageOutput | null> { const collectionExternalId = item.collectionExternalId ?? item.externalId; + const titleMaxLength = + item.externalId === collectionExternalId // This means it's a root page which will be imported as a collection + ? CollectionValidation.maxNameLength + : DocumentValidation.maxTitleLength; try { // Convert Notion database to an empty page with "pages in database" as its children. if (item.type === PageType.Database) { const { pages, ...databaseInfo } = await client.fetchDatabase( - item.externalId + item.externalId, + { titleMaxLength } ); return { @@ -115,7 +121,9 @@ export default class NotionAPIImportTask extends APIImportTask<IntegrationServic }; } - const { blocks, ...pageInfo } = await client.fetchPage(item.externalId); + const { blocks, ...pageInfo } = await client.fetchPage(item.externalId, { + titleMaxLength, + }); return { ...pageInfo, From 762140e49317c38a692e5d82d22a034c0a35ed46 Mon Sep 17 00:00:00 2001 From: "codegen-sh[bot]" <131295404+codegen-sh[bot]@users.noreply.github.com> Date: Fri, 25 Apr 2025 03:07:39 +0000 Subject: [PATCH 09/64] Add mcp to reserved subdomains (#9052) Co-authored-by: codegen-sh[bot] <131295404+codegen-sh[bot]@users.noreply.github.com> --- shared/utils/domains.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/shared/utils/domains.ts b/shared/utils/domains.ts index d9a95bf197..5dd49f2cf2 100644 --- a/shared/utils/domains.ts +++ b/shared/utils/domains.ts @@ -117,6 +117,7 @@ export const RESERVED_SUBDOMAINS = [ "localhost", "mail", "marketing", + "mcp", "mobile", "multiplayer", "new", From e503225f04ad9f140915cd8c93007967b262380d Mon Sep 17 00:00:00 2001 From: Tom Moor <tom@getoutline.com> Date: Thu, 24 Apr 2025 23:49:19 -0400 Subject: [PATCH 10/64] fix: Tidying mention hover cards (#9051) * Tidying hover card layout * Handle backticks in titles (common on GitHub + Linear) * Improve label display --- app/components/HoverPreview/Components.tsx | 25 ++++++++---- .../HoverPreview/HoverPreviewIssue.tsx | 19 +++++++-- .../HoverPreview/HoverPreviewPullRequest.tsx | 19 +++++++-- shared/components/Backticks.tsx | 39 +++++++++++++++++++ .../IssueStatusIcon/GitHubIssueStatusIcon.tsx | 14 +++---- .../IssueStatusIcon/LinearIssueStatusIcon.tsx | 4 +- shared/components/IssueStatusIcon/index.tsx | 16 +++++--- shared/components/PullRequestIcon.tsx | 32 +++++++-------- shared/editor/components/Mentions.tsx | 9 ++++- 9 files changed, 129 insertions(+), 48 deletions(-) create mode 100644 shared/components/Backticks.tsx diff --git a/app/components/HoverPreview/Components.tsx b/app/components/HoverPreview/Components.tsx index f56cf13625..de57687381 100644 --- a/app/components/HoverPreview/Components.tsx +++ b/app/components/HoverPreview/Components.tsx @@ -2,7 +2,6 @@ import { transparentize } from "polished"; import { Link } from "react-router-dom"; import styled, { css } from "styled-components"; import { s } from "@shared/styles"; -import { getTextColor } from "@shared/utils/color"; import Text from "~/components/Text"; export const CARD_MARGIN = 10; @@ -33,7 +32,7 @@ export const Title = styled(Text).attrs({ as: "h2", size: "large" })` display: flex; align-items: flex-start; justify-content: flex-start; - gap: 4px; + gap: 6px; `; export const Info = styled(StyledText).attrs(() => ({ @@ -60,15 +59,27 @@ export const Thumbnail = styled.img` export const Label = styled(Text).attrs({ size: "xsmall", weight: "bold" })<{ color?: string; }>` - background-color: ${(props) => - props.color ?? props.theme.backgroundSecondary}; - color: ${(props) => - props.color ? getTextColor(props.color) : props.theme.text}; + border: 1px solid ${(props) => props.theme.divider}; width: fit-content; border-radius: 2em; - padding: 0 8px; + padding: 1px 8px 1px 20px; margin-right: 0.5em; margin-top: 0.5em; + position: relative; + flex-shrink: 0; + + &::after { + content: ""; + position: absolute; + left: 8px; + top: 50%; + transform: translateY(-50%); + width: 6px; + height: 6px; + border-radius: 50%; + background-color: ${(props) => + props.color || props.theme.backgroundSecondary}; + } `; export const CardContent = styled.div` diff --git a/app/components/HoverPreview/HoverPreviewIssue.tsx b/app/components/HoverPreview/HoverPreviewIssue.tsx index 4eee531ef0..4ee1dbf904 100644 --- a/app/components/HoverPreview/HoverPreviewIssue.tsx +++ b/app/components/HoverPreview/HoverPreviewIssue.tsx @@ -1,5 +1,7 @@ import * as React from "react"; import { Trans } from "react-i18next"; +import styled from "styled-components"; +import { Backticks } from "@shared/components/Backticks"; import { IssueStatusIcon } from "@shared/components/IssueStatusIcon"; import { IntegrationService, @@ -40,13 +42,18 @@ const HoverPreviewIssue = React.forwardRef(function _HoverPreviewIssue( <CardContent> <Flex gap={2} column> <Title> - <IssueStatusIcon service={service} state={state} /> + <StyledIssueStatusIcon + service={service} + state={state} + size={18} + /> <span> - {title} <Text type="tertiary">{id}</Text> + <Backticks content={title} /> +  <Text type="tertiary">{id}</Text> </span> - - + + {{ authorName }} created{" "} @@ -71,4 +78,8 @@ const HoverPreviewIssue = React.forwardRef(function _HoverPreviewIssue( ); }); +const StyledIssueStatusIcon = styled(IssueStatusIcon)` + margin-top: 2px; +`; + export default HoverPreviewIssue; diff --git a/app/components/HoverPreview/HoverPreviewPullRequest.tsx b/app/components/HoverPreview/HoverPreviewPullRequest.tsx index c4165e4bf9..11bcc67f70 100644 --- a/app/components/HoverPreview/HoverPreviewPullRequest.tsx +++ b/app/components/HoverPreview/HoverPreviewPullRequest.tsx @@ -1,5 +1,7 @@ import * as React from "react"; import { Trans } from "react-i18next"; +import styled from "styled-components"; +import { Backticks } from "@shared/components/Backticks"; import { PullRequestIcon } from "@shared/components/PullRequestIcon"; import { UnfurlResourceType, UnfurlResponse } from "@shared/types"; import { Avatar } from "~/components/Avatar"; @@ -31,13 +33,18 @@ const HoverPreviewPullRequest = React.forwardRef( - <PullRequestIcon status={state.name} color={state.color} /> + <StyledPullRequestIcon + status={state.name} + color={state.color} + size={18} + /> <span> - {title} <Text type="tertiary">{id}</Text> + <Backticks content={title} /> +  <Text type="tertiary">{id}</Text> </span> - - + + {{ authorName }} opened{" "} @@ -55,4 +62,8 @@ const HoverPreviewPullRequest = React.forwardRef( } ); +const StyledPullRequestIcon = styled(PullRequestIcon)` + margin-top: 2px; +`; + export default HoverPreviewPullRequest; diff --git a/shared/components/Backticks.tsx b/shared/components/Backticks.tsx new file mode 100644 index 0000000000..1b60938799 --- /dev/null +++ b/shared/components/Backticks.tsx @@ -0,0 +1,39 @@ +import * as React from "react"; +import styled from "styled-components"; +import { s } from "../styles"; + +const BacktickSpan = styled.span` + font-family: ${s("fontFamilyMono")}; + background: ${s("codeBackground")}; + border-radius: 3px; + padding: 2px 4px; + font-size: 90%; +`; + +interface Props { + /** The content to be rendered that may contain backticks. */ + content: string; +} + +/** + * Component to render backticked content with styling. + * @param props - Props object containing the content to be rendered. + * @returns JSX.Element - The rendered component. + */ +export const Backticks: React.FC = ({ content }) => { + // Regex to match text between backticks + const regex = /`([^`]+)`/g; + const parts = content.split(regex); + + return ( + <> + {parts.map((part, i) => { + // Even indices are normal text, odd indices are backticked content + if (i % 2 === 0) { + return part; + } + return {part}; + })} + + ); +}; diff --git a/shared/components/IssueStatusIcon/GitHubIssueStatusIcon.tsx b/shared/components/IssueStatusIcon/GitHubIssueStatusIcon.tsx index 3239f92dff..b71c372251 100644 --- a/shared/components/IssueStatusIcon/GitHubIssueStatusIcon.tsx +++ b/shared/components/IssueStatusIcon/GitHubIssueStatusIcon.tsx @@ -2,15 +2,15 @@ import React from "react"; import { BaseIconProps } from "."; export function GitHubIssueStatusIcon(props: BaseIconProps) { - const { state, className } = props; + const { state, className, size = 16 } = props; switch (state.name) { case "open": return ( @@ -22,8 +22,8 @@ export function GitHubIssueStatusIcon(props: BaseIconProps) { return ( @@ -35,8 +35,8 @@ export function GitHubIssueStatusIcon(props: BaseIconProps) { return ( diff --git a/shared/components/IssueStatusIcon/LinearIssueStatusIcon.tsx b/shared/components/IssueStatusIcon/LinearIssueStatusIcon.tsx index e01a22c0ef..0493537c82 100644 --- a/shared/components/IssueStatusIcon/LinearIssueStatusIcon.tsx +++ b/shared/components/IssueStatusIcon/LinearIssueStatusIcon.tsx @@ -14,7 +14,7 @@ enum StateType { export function LinearIssueStatusIcon(props: BaseIconProps) { const theme = useTheme(); - const { state } = props; + const { state, size = 16 } = props; const percentage = state.type === StateType.Triage || state.type === StateType.Backlog || @@ -31,7 +31,7 @@ export function LinearIssueStatusIcon(props: BaseIconProps) { const magicFour = isSafari() ? 3.895 : 3.98; return ( - + {getIcon(props)}; + return ( + + {getIcon(props)} + + ); } -function getIcon({ service, ...rest }: Props) { - switch (service) { +function getIcon(props: Props) { + switch (props.service) { case IntegrationService.GitHub: - return ; + return ; case IntegrationService.Linear: - return ; + return ; } } diff --git a/shared/components/PullRequestIcon.tsx b/shared/components/PullRequestIcon.tsx index 90c61e4556..298d39f962 100644 --- a/shared/components/PullRequestIcon.tsx +++ b/shared/components/PullRequestIcon.tsx @@ -11,9 +11,9 @@ type Props = { /** * Issue status icon based on GitHub pull requests, but can be used for any git-style integration. */ -export function PullRequestIcon({ size, ...rest }: Props) { +export function PullRequestIcon({ size, className, ...rest }: Props) { return ( - + ); @@ -28,16 +28,16 @@ const Icon = styled.span<{ size?: number }>` justify-content: center; `; -function BaseIcon(props: Props) { - switch (props.status) { +function BaseIcon({ status, size, color, className }: Props) { + switch (status) { case "open": return ( @@ -46,10 +46,10 @@ function BaseIcon(props: Props) { return ( @@ -58,10 +58,10 @@ function BaseIcon(props: Props) { return ( diff --git a/shared/editor/components/Mentions.tsx b/shared/editor/components/Mentions.tsx index 2c33d34dfc..5a3dbeee86 100644 --- a/shared/editor/components/Mentions.tsx +++ b/shared/editor/components/Mentions.tsx @@ -10,6 +10,7 @@ import * as React from "react"; import { useTranslation } from "react-i18next"; import { Link } from "react-router-dom"; import styled from "styled-components"; +import { Backticks } from "../../components/Backticks"; import Flex from "../../components/Flex"; import Icon from "../../components/Icon"; import { IssueStatusIcon } from "../../components/IssueStatusIcon"; @@ -207,7 +208,9 @@ export const MentionIssue = observer((props: IssuePrProps) => { - {issue.title} + + + {issue.id} @@ -282,7 +285,9 @@ export const MentionPullRequest = observer((props: IssuePrProps) => { color={pullRequest.state.color} /> - {pullRequest.title} + + + {pullRequest.id} From 36772f144478c184120ae2040e91f6f6752e5099 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Fri, 25 Apr 2025 08:53:28 -0400 Subject: [PATCH 11/64] fix: Heading weight changes when linkified (#9058) --- shared/editor/components/Styles.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/shared/editor/components/Styles.ts b/shared/editor/components/Styles.ts index bfce93c37e..aee18e3e0e 100644 --- a/shared/editor/components/Styles.ts +++ b/shared/editor/components/Styles.ts @@ -1091,6 +1091,10 @@ p a { } } +.heading-content a { + font-weight: inherit; +} + a { color: ${props.theme.link}; cursor: pointer; From 4bb9ac40c7fb54cf4d638e7955cd609c5e6f3c4a Mon Sep 17 00:00:00 2001 From: Hemachandar <132386067+hmacr@users.noreply.github.com> Date: Fri, 25 Apr 2025 22:47:28 +0530 Subject: [PATCH 12/64] fix: Linear status icon completion percentage edge case (#9062) --- plugins/linear/server/linear.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/plugins/linear/server/linear.ts b/plugins/linear/server/linear.ts index e843e2d562..ceb4c80e4a 100644 --- a/plugins/linear/server/linear.ts +++ b/plugins/linear/server/linear.ts @@ -172,9 +172,16 @@ export class Linear { ); const idx = states.findIndex((s) => s.name === state.name); - return idx !== -1 - ? (idx + 1) / (states.length + 1) // add 1 to states for the "done" state. - : defaultCompletionPercentage; + + if (idx === -1) { + return defaultCompletionPercentage; + } else if (states.length === 1) { + return 0.5; + } else if (states.length === 2) { + return idx === 0 ? 0.5 : 0.75; + } else { + return (idx + 1) / (states.length + 1); // add 1 to states for the "done" state. + } } /** From 9274f56ef6ae9b69aa80ae9d68467d060af63dca Mon Sep 17 00:00:00 2001 From: Hemachandar <132386067+hmacr@users.noreply.github.com> Date: Sat, 26 Apr 2025 03:07:54 +0530 Subject: [PATCH 13/64] Show correct icon & color for GitHub draft PR (#9063) --- .../HoverPreview/HoverPreviewPullRequest.tsx | 6 +-- plugins/github/server/github.ts | 3 +- plugins/github/shared/GitHubUtils.ts | 4 +- shared/components/PullRequestIcon.tsx | 48 ++++++++----------- shared/editor/components/Mentions.tsx | 6 +-- shared/types.ts | 2 +- 6 files changed, 26 insertions(+), 43 deletions(-) diff --git a/app/components/HoverPreview/HoverPreviewPullRequest.tsx b/app/components/HoverPreview/HoverPreviewPullRequest.tsx index 11bcc67f70..ff830953ea 100644 --- a/app/components/HoverPreview/HoverPreviewPullRequest.tsx +++ b/app/components/HoverPreview/HoverPreviewPullRequest.tsx @@ -33,11 +33,7 @@ const HoverPreviewPullRequest = React.forwardRef( - <StyledPullRequestIcon - status={state.name} - color={state.color} - size={18} - /> + <StyledPullRequestIcon size={18} state={state} /> <span> <Backticks content={title} />  <Text type="tertiary">{id}</Text> diff --git a/plugins/github/server/github.ts b/plugins/github/server/github.ts index a5bb995818..8e5a140525 100644 --- a/plugins/github/server/github.ts +++ b/plugins/github/server/github.ts @@ -279,7 +279,8 @@ export class GitHub { }, state: { name: prState, - color: GitHubUtils.getColorForStatus(prState), + color: GitHubUtils.getColorForStatus(prState, !!pr.draft), + draft: pr.draft, }, createdAt: pr.created_at, transformed_unfurl: true, diff --git a/plugins/github/shared/GitHubUtils.ts b/plugins/github/shared/GitHubUtils.ts index 0ea545102d..a7eac82a42 100644 --- a/plugins/github/shared/GitHubUtils.ts +++ b/plugins/github/shared/GitHubUtils.ts @@ -45,10 +45,10 @@ export class GitHubUtils { return `${this.url}?install_request=true`; } - public static getColorForStatus(status: string) { + public static getColorForStatus(status: string, isDraftPR: boolean = false) { switch (status) { case "open": - return "#238636"; + return isDraftPR ? "#848d97" : "#238636"; case "done": return "#a371f7"; case "closed": diff --git a/shared/components/PullRequestIcon.tsx b/shared/components/PullRequestIcon.tsx index 298d39f962..6a42842e65 100644 --- a/shared/components/PullRequestIcon.tsx +++ b/shared/components/PullRequestIcon.tsx @@ -1,9 +1,9 @@ import * as React from "react"; import styled from "styled-components"; +import { UnfurlResourceType, UnfurlResponse } from "../types"; type Props = { - status: string; - color: string; + state: UnfurlResponse[UnfurlResourceType.PR]["state"]; size?: number; className?: string; }; @@ -11,10 +11,10 @@ type Props = { /** * Issue status icon based on GitHub pull requests, but can be used for any git-style integration. */ -export function PullRequestIcon({ size, className, ...rest }: Props) { +export function PullRequestIcon({ size, className, state }: Props) { return ( <Icon size={size} className={className}> - <BaseIcon {...rest} /> + <BaseIcon state={state} /> </Icon> ); } @@ -28,42 +28,32 @@ const Icon = styled.span<{ size?: number }>` justify-content: center; `; -function BaseIcon({ status, size, color, className }: Props) { - switch (status) { +function BaseIcon({ state }: Pick<Props, "state">) { + switch (state.name) { case "open": return ( - <svg - viewBox="0 0 16 16" - width={size} - height={size} - fill={color} - className={className} - > - <path d="M1.5 3.25a2.25 2.25 0 1 1 3 2.122v5.256a2.251 2.251 0 1 1-1.5 0V5.372A2.25 2.25 0 0 1 1.5 3.25Zm5.677-.177L9.573.677A.25.25 0 0 1 10 .854V2.5h1A2.5 2.5 0 0 1 13.5 5v5.628a2.251 2.251 0 1 1-1.5 0V5a1 1 0 0 0-1-1h-1v1.646a.25.25 0 0 1-.427.177L7.177 3.427a.25.25 0 0 1 0-.354ZM3.75 2.5a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm0 9.5a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm8.25.75a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0Z" /> + <svg viewBox="0 0 16 16" fill={state.color}> + {state.draft ? ( + <path d="M3.25 1A2.25 2.25 0 0 1 4 5.372v5.256a2.251 2.251 0 1 1-1.5 0V5.372A2.251 2.251 0 0 1 3.25 1Zm9.5 14a2.25 2.25 0 1 1 0-4.5 2.25 2.25 0 0 1 0 4.5ZM2.5 3.25a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0ZM3.25 12a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm9.5 0a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5ZM14 7.5a1.25 1.25 0 1 1-2.5 0 1.25 1.25 0 0 1 2.5 0Zm0-4.25a1.25 1.25 0 1 1-2.5 0 1.25 1.25 0 0 1 2.5 0Z" /> + ) : ( + <path d="M1.5 3.25a2.25 2.25 0 1 1 3 2.122v5.256a2.251 2.251 0 1 1-1.5 0V5.372A2.25 2.25 0 0 1 1.5 3.25Zm5.677-.177L9.573.677A.25.25 0 0 1 10 .854V2.5h1A2.5 2.5 0 0 1 13.5 5v5.628a2.251 2.251 0 1 1-1.5 0V5a1 1 0 0 0-1-1h-1v1.646a.25.25 0 0 1-.427.177L7.177 3.427a.25.25 0 0 1 0-.354ZM3.75 2.5a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm0 9.5a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm8.25.75a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0Z" /> + )} </svg> ); case "merged": return ( - <svg - viewBox="0 0 16 16" - width={size} - height={size} - fill={color} - className={className} - > + <svg viewBox="0 0 16 16" fill={state.color}> <path d="M5.45 5.154A4.25 4.25 0 0 0 9.25 7.5h1.378a2.251 2.251 0 1 1 0 1.5H9.25A5.734 5.734 0 0 1 5 7.123v3.505a2.25 2.25 0 1 1-1.5 0V5.372a2.25 2.25 0 1 1 1.95-.218ZM4.25 13.5a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Zm8.5-4.5a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5ZM5 3.25a.75.75 0 1 0 0 .005V3.25Z" /> </svg> ); case "closed": return ( - <svg - viewBox="0 0 16 16" - width={size} - height={size} - fill={color} - className={className} - > - <path d="M3.25 1A2.25 2.25 0 0 1 4 5.372v5.256a2.251 2.251 0 1 1-1.5 0V5.372A2.251 2.251 0 0 1 3.25 1Zm9.5 5.5a.75.75 0 0 1 .75.75v3.378a2.251 2.251 0 1 1-1.5 0V7.25a.75.75 0 0 1 .75-.75Zm-2.03-5.273a.75.75 0 0 1 1.06 0l.97.97.97-.97a.748.748 0 0 1 1.265.332.75.75 0 0 1-.205.729l-.97.97.97.97a.751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018l-.97-.97-.97.97a.749.749 0 0 1-1.275-.326.749.749 0 0 1 .215-.734l.97-.97-.97-.97a.75.75 0 0 1 0-1.06ZM2.5 3.25a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0ZM3.25 12a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm9.5 0a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Z" /> + <svg viewBox="0 0 16 16" fill={state.color}> + {state.draft ? ( + <path d="M3.25 1A2.25 2.25 0 0 1 4 5.372v5.256a2.251 2.251 0 1 1-1.5 0V5.372A2.251 2.251 0 0 1 3.25 1Zm9.5 5.5a.75.75 0 0 1 .75.75v3.378a2.251 2.251 0 1 1-1.5 0V7.25a.75.75 0 0 1 .75-.75Zm-2.03-5.273a.75.75 0 0 1 1.06 0l.97.97.97-.97a.748.748 0 0 1 1.265.332.75.75 0 0 1-.205.729l-.97.97.97.97a.751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018l-.97-.97-.97.97a.749.749 0 0 1-1.275-.326.749.749 0 0 1 .215-.734l.97-.97-.97-.97a.75.75 0 0 1 0-1.06ZM2.5 3.25a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0ZM3.25 12a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm9.5 0a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Z" /> + ) : ( + <path d="M3.25 1A2.25 2.25 0 0 1 4 5.372v5.256a2.251 2.251 0 1 1-1.5 0V5.372A2.251 2.251 0 0 1 3.25 1Zm9.5 5.5a.75.75 0 0 1 .75.75v3.378a2.251 2.251 0 1 1-1.5 0V7.25a.75.75 0 0 1 .75-.75Zm-2.03-5.273a.75.75 0 0 1 1.06 0l.97.97.97-.97a.748.748 0 0 1 1.265.332.75.75 0 0 1-.205.729l-.97.97.97.97a.751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018l-.97-.97-.97.97a.749.749 0 0 1-1.275-.326.749.749 0 0 1 .215-.734l.97-.97-.97-.97a.75.75 0 0 1 0-1.06ZM2.5 3.25a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0ZM3.25 12a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm9.5 0a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Z" /> + )} </svg> ); default: diff --git a/shared/editor/components/Mentions.tsx b/shared/editor/components/Mentions.tsx index 5a3dbeee86..1f9898ee4c 100644 --- a/shared/editor/components/Mentions.tsx +++ b/shared/editor/components/Mentions.tsx @@ -279,11 +279,7 @@ export const MentionPullRequest = observer((props: IssuePrProps) => { rel="noopener noreferrer nofollow" > <Flex align="center" gap={6}> - <PullRequestIcon - size={14} - status={pullRequest.state.name} - color={pullRequest.state.color} - /> + <PullRequestIcon size={14} state={pullRequest.state} /> <Flex align="center" gap={4}> <Text> <Backticks content={pullRequest.title} /> diff --git a/shared/types.ts b/shared/types.ts index 1ed45aaf47..bf08671624 100644 --- a/shared/types.ts +++ b/shared/types.ts @@ -461,7 +461,7 @@ export type UnfurlResponse = { /** Pull Request author */ author: { name: string; avatarUrl: string }; /** Pull Request status */ - state: { name: string; color: string }; + state: { name: string; color: string; draft?: boolean }; /** Pull Request creation time */ createdAt: string; }; From 3156f62e94486eecab8a2df33069f03fa3595be3 Mon Sep 17 00:00:00 2001 From: Tom Moor <tom@getoutline.com> Date: Fri, 25 Apr 2025 18:22:53 -0400 Subject: [PATCH 14/64] Vite 5 -> 6 upgrade (#9057) * Vite 5 -> 6 * Revert i18next-parser upgrade * rolldown * fix build * tsc --- package.json | 5 +- vite.config.ts | 12 +- yarn.lock | 532 ++++++++++++++++++++++++++++--------------------- 3 files changed, 321 insertions(+), 228 deletions(-) diff --git a/package.json b/package.json index a18e682872..d77fd0ba93 100644 --- a/package.json +++ b/package.json @@ -249,7 +249,7 @@ "uuid": "^8.3.2", "validator": "13.12.0", "vaul": "^1.1.2", - "vite": "^5.4.18", + "vite": "^6.3.3", "vite-plugin-pwa": "^0.21.2", "winston": "^3.17.0", "ws": "^7.5.10", @@ -361,7 +361,7 @@ "prettier": "^2.8.8", "react-refresh": "^0.14.2", "rimraf": "^2.5.4", - "rollup-plugin-webpack-stats": "^2.0.3", + "rollup-plugin-webpack-stats": "^2.0.5", "terser": "^5.39.0", "typescript": "^5.8.3", "vite-plugin-static-copy": "^0.17.0", @@ -375,7 +375,6 @@ "node-fetch": "^2.7.0", "js-yaml": "^3.14.1", "qs": "6.9.7", - "rollup": "^4.5.1", "prismjs": "1.30.0" }, "version": "0.83.0", diff --git a/vite.config.ts b/vite.config.ts index 6d23276dfa..63b28afc16 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -3,12 +3,12 @@ import path from "path"; import react from "@vitejs/plugin-react"; import browserslistToEsbuild from "browserslist-to-esbuild"; import webpackStats from "rollup-plugin-webpack-stats"; -import { CommonServerOptions, defineConfig } from "vite"; +import { ServerOptions, defineConfig } from "vite"; import { VitePWA } from "vite-plugin-pwa"; import { viteStaticCopy } from "vite-plugin-static-copy"; import environment from "./server/utils/environment"; -let httpsConfig: CommonServerOptions["https"] | undefined; +let httpsConfig: ServerOptions["https"] | undefined; let host: string | undefined; if (environment.NODE_ENV === "development") { @@ -145,6 +145,7 @@ export default () => }, }), // Generate a stats.json file for webpack that will be consumed by RelativeCI + // @ts-expect-error Type mismatch with latest versions but Plugin runs without issue webpackStats(), ], optimizeDeps: { @@ -175,6 +176,13 @@ export default () => keep_fnames: true, }, rollupOptions: { + onwarn(warning, warn) { + // Suppress noisy warnings about module-level directives, e.g. "use client" + if (warning.code === "MODULE_LEVEL_DIRECTIVE") { + return; + } + warn(warning); + }, input: { index: "./app/index.tsx", }, diff --git a/yarn.lock b/yarn.lock index a83574a1a8..9b57cf96d1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1978,230 +1978,240 @@ resolved "https://registry.yarnpkg.com/@esbuild/aix-ppc64/-/aix-ppc64-0.20.2.tgz#a70f4ac11c6a1dfc18b8bbb13284155d933b9537" integrity sha512-D+EBOJHXdNZcLJRBkhENNG8Wji2kgc9AZ9KiPr1JuZjsNtyHzrsfLRrY0tk2H2aoFu6RANO1y1iPPUCDYWkb5g== -"@esbuild/aix-ppc64@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/aix-ppc64/-/aix-ppc64-0.21.5.tgz#c7184a326533fcdf1b8ee0733e21c713b975575f" - integrity sha512-1SDgH6ZSPTlggy1yI6+Dbkiz8xzpHJEVAlF/AM1tHPLsf5STom9rwtjE4hKAF20FfXXNTFqEYXyJNWh1GiZedQ== +"@esbuild/aix-ppc64@0.25.3": + version "0.25.3" + resolved "https://registry.yarnpkg.com/@esbuild/aix-ppc64/-/aix-ppc64-0.25.3.tgz#014180d9a149cffd95aaeead37179433f5ea5437" + integrity sha512-W8bFfPA8DowP8l//sxjJLSLkD8iEjMc7cBVyP+u4cEv9sM7mdUCkgsj+t0n/BWPFtv7WWCN5Yzj0N6FJNUUqBQ== "@esbuild/android-arm64@0.20.2": version "0.20.2" resolved "https://registry.yarnpkg.com/@esbuild/android-arm64/-/android-arm64-0.20.2.tgz#db1c9202a5bc92ea04c7b6840f1bbe09ebf9e6b9" integrity sha512-mRzjLacRtl/tWU0SvD8lUEwb61yP9cqQo6noDZP/O8VkwafSYwZ4yWy24kan8jE/IMERpYncRt2dw438LP3Xmg== -"@esbuild/android-arm64@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/android-arm64/-/android-arm64-0.21.5.tgz#09d9b4357780da9ea3a7dfb833a1f1ff439b4052" - integrity sha512-c0uX9VAUBQ7dTDCjq+wdyGLowMdtR/GoC2U5IYk/7D1H1JYC0qseD7+11iMP2mRLN9RcCMRcjC4YMclCzGwS/A== +"@esbuild/android-arm64@0.25.3": + version "0.25.3" + resolved "https://registry.yarnpkg.com/@esbuild/android-arm64/-/android-arm64-0.25.3.tgz#649e47e04ddb24a27dc05c395724bc5f4c55cbfe" + integrity sha512-XelR6MzjlZuBM4f5z2IQHK6LkK34Cvv6Rj2EntER3lwCBFdg6h2lKbtRjpTTsdEjD/WSe1q8UyPBXP1x3i/wYQ== "@esbuild/android-arm@0.20.2": version "0.20.2" resolved "https://registry.yarnpkg.com/@esbuild/android-arm/-/android-arm-0.20.2.tgz#3b488c49aee9d491c2c8f98a909b785870d6e995" integrity sha512-t98Ra6pw2VaDhqNWO2Oph2LXbz/EJcnLmKLGBJwEwXX/JAN83Fym1rU8l0JUWK6HkIbWONCSSatf4sf2NBRx/w== -"@esbuild/android-arm@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/android-arm/-/android-arm-0.21.5.tgz#9b04384fb771926dfa6d7ad04324ecb2ab9b2e28" - integrity sha512-vCPvzSjpPHEi1siZdlvAlsPxXl7WbOVUBBAowWug4rJHb68Ox8KualB+1ocNvT5fjv6wpkX6o/iEpbDrf68zcg== +"@esbuild/android-arm@0.25.3": + version "0.25.3" + resolved "https://registry.yarnpkg.com/@esbuild/android-arm/-/android-arm-0.25.3.tgz#8a0f719c8dc28a4a6567ef7328c36ea85f568ff4" + integrity sha512-PuwVXbnP87Tcff5I9ngV0lmiSu40xw1At6i3GsU77U7cjDDB4s0X2cyFuBiDa1SBk9DnvWwnGvVaGBqoFWPb7A== "@esbuild/android-x64@0.20.2": version "0.20.2" resolved "https://registry.yarnpkg.com/@esbuild/android-x64/-/android-x64-0.20.2.tgz#3b1628029e5576249d2b2d766696e50768449f98" integrity sha512-btzExgV+/lMGDDa194CcUQm53ncxzeBrWJcncOBxuC6ndBkKxnHdFJn86mCIgTELsooUmwUm9FkhSp5HYu00Rg== -"@esbuild/android-x64@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/android-x64/-/android-x64-0.21.5.tgz#29918ec2db754cedcb6c1b04de8cd6547af6461e" - integrity sha512-D7aPRUUNHRBwHxzxRvp856rjUHRFW1SdQATKXH2hqA0kAZb1hKmi02OpYRacl0TxIGz/ZmXWlbZgjwWYaCakTA== +"@esbuild/android-x64@0.25.3": + version "0.25.3" + resolved "https://registry.yarnpkg.com/@esbuild/android-x64/-/android-x64-0.25.3.tgz#e2ab182d1fd06da9bef0784a13c28a7602d78009" + integrity sha512-ogtTpYHT/g1GWS/zKM0cc/tIebFjm1F9Aw1boQ2Y0eUQ+J89d0jFY//s9ei9jVIlkYi8AfOjiixcLJSGNSOAdQ== "@esbuild/darwin-arm64@0.20.2": version "0.20.2" resolved "https://registry.yarnpkg.com/@esbuild/darwin-arm64/-/darwin-arm64-0.20.2.tgz#6e8517a045ddd86ae30c6608c8475ebc0c4000bb" integrity sha512-4J6IRT+10J3aJH3l1yzEg9y3wkTDgDk7TSDFX+wKFiWjqWp/iCfLIYzGyasx9l0SAFPT1HwSCR+0w/h1ES/MjA== -"@esbuild/darwin-arm64@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/darwin-arm64/-/darwin-arm64-0.21.5.tgz#e495b539660e51690f3928af50a76fb0a6ccff2a" - integrity sha512-DwqXqZyuk5AiWWf3UfLiRDJ5EDd49zg6O9wclZ7kUMv2WRFr4HKjXp/5t8JZ11QbQfUS6/cRCKGwYhtNAY88kQ== +"@esbuild/darwin-arm64@0.25.3": + version "0.25.3" + resolved "https://registry.yarnpkg.com/@esbuild/darwin-arm64/-/darwin-arm64-0.25.3.tgz#c7f3166fcece4d158a73dcfe71b2672ca0b1668b" + integrity sha512-eESK5yfPNTqpAmDfFWNsOhmIOaQA59tAcF/EfYvo5/QWQCzXn5iUSOnqt3ra3UdzBv073ykTtmeLJZGt3HhA+w== "@esbuild/darwin-x64@0.20.2": version "0.20.2" resolved "https://registry.yarnpkg.com/@esbuild/darwin-x64/-/darwin-x64-0.20.2.tgz#90ed098e1f9dd8a9381695b207e1cff45540a0d0" integrity sha512-tBcXp9KNphnNH0dfhv8KYkZhjc+H3XBkF5DKtswJblV7KlT9EI2+jeA8DgBjp908WEuYll6pF+UStUCfEpdysA== -"@esbuild/darwin-x64@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/darwin-x64/-/darwin-x64-0.21.5.tgz#c13838fa57372839abdddc91d71542ceea2e1e22" - integrity sha512-se/JjF8NlmKVG4kNIuyWMV/22ZaerB+qaSi5MdrXtd6R08kvs2qCN4C09miupktDitvh8jRFflwGFBQcxZRjbw== +"@esbuild/darwin-x64@0.25.3": + version "0.25.3" + resolved "https://registry.yarnpkg.com/@esbuild/darwin-x64/-/darwin-x64-0.25.3.tgz#d8c5342ec1a4bf4b1915643dfe031ba4b173a87a" + integrity sha512-Kd8glo7sIZtwOLcPbW0yLpKmBNWMANZhrC1r6K++uDR2zyzb6AeOYtI6udbtabmQpFaxJ8uduXMAo1gs5ozz8A== "@esbuild/freebsd-arm64@0.20.2": version "0.20.2" resolved "https://registry.yarnpkg.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.20.2.tgz#d71502d1ee89a1130327e890364666c760a2a911" integrity sha512-d3qI41G4SuLiCGCFGUrKsSeTXyWG6yem1KcGZVS+3FYlYhtNoNgYrWcvkOoaqMhwXSMrZRl69ArHsGJ9mYdbbw== -"@esbuild/freebsd-arm64@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.21.5.tgz#646b989aa20bf89fd071dd5dbfad69a3542e550e" - integrity sha512-5JcRxxRDUJLX8JXp/wcBCy3pENnCgBR9bN6JsY4OmhfUtIHe3ZW0mawA7+RDAcMLrMIZaf03NlQiX9DGyB8h4g== +"@esbuild/freebsd-arm64@0.25.3": + version "0.25.3" + resolved "https://registry.yarnpkg.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.25.3.tgz#9f7d789e2eb7747d4868817417cc968ffa84f35b" + integrity sha512-EJiyS70BYybOBpJth3M0KLOus0n+RRMKTYzhYhFeMwp7e/RaajXvP+BWlmEXNk6uk+KAu46j/kaQzr6au+JcIw== "@esbuild/freebsd-x64@0.20.2": version "0.20.2" resolved "https://registry.yarnpkg.com/@esbuild/freebsd-x64/-/freebsd-x64-0.20.2.tgz#aa5ea58d9c1dd9af688b8b6f63ef0d3d60cea53c" integrity sha512-d+DipyvHRuqEeM5zDivKV1KuXn9WeRX6vqSqIDgwIfPQtwMP4jaDsQsDncjTDDsExT4lR/91OLjRo8bmC1e+Cw== -"@esbuild/freebsd-x64@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/freebsd-x64/-/freebsd-x64-0.21.5.tgz#aa615cfc80af954d3458906e38ca22c18cf5c261" - integrity sha512-J95kNBj1zkbMXtHVH29bBriQygMXqoVQOQYA+ISs0/2l3T9/kj42ow2mpqerRBxDJnmkUDCaQT/dfNXWX/ZZCQ== +"@esbuild/freebsd-x64@0.25.3": + version "0.25.3" + resolved "https://registry.yarnpkg.com/@esbuild/freebsd-x64/-/freebsd-x64-0.25.3.tgz#8ad35c51d084184a8e9e76bb4356e95350a64709" + integrity sha512-Q+wSjaLpGxYf7zC0kL0nDlhsfuFkoN+EXrx2KSB33RhinWzejOd6AvgmP5JbkgXKmjhmpfgKZq24pneodYqE8Q== "@esbuild/linux-arm64@0.20.2": version "0.20.2" resolved "https://registry.yarnpkg.com/@esbuild/linux-arm64/-/linux-arm64-0.20.2.tgz#055b63725df678379b0f6db9d0fa85463755b2e5" integrity sha512-9pb6rBjGvTFNira2FLIWqDk/uaf42sSyLE8j1rnUpuzsODBq7FvpwHYZxQ/It/8b+QOS1RYfqgGFNLRI+qlq2A== -"@esbuild/linux-arm64@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/linux-arm64/-/linux-arm64-0.21.5.tgz#70ac6fa14f5cb7e1f7f887bcffb680ad09922b5b" - integrity sha512-ibKvmyYzKsBeX8d8I7MH/TMfWDXBF3db4qM6sy+7re0YXya+K1cem3on9XgdT2EQGMu4hQyZhan7TeQ8XkGp4Q== +"@esbuild/linux-arm64@0.25.3": + version "0.25.3" + resolved "https://registry.yarnpkg.com/@esbuild/linux-arm64/-/linux-arm64-0.25.3.tgz#3af0da3d9186092a9edd4e28fa342f57d9e3cd30" + integrity sha512-xCUgnNYhRD5bb1C1nqrDV1PfkwgbswTTBRbAd8aH5PhYzikdf/ddtsYyMXFfGSsb/6t6QaPSzxtbfAZr9uox4A== "@esbuild/linux-arm@0.20.2": version "0.20.2" resolved "https://registry.yarnpkg.com/@esbuild/linux-arm/-/linux-arm-0.20.2.tgz#76b3b98cb1f87936fbc37f073efabad49dcd889c" integrity sha512-VhLPeR8HTMPccbuWWcEUD1Az68TqaTYyj6nfE4QByZIQEQVWBB8vup8PpR7y1QHL3CpcF6xd5WVBU/+SBEvGTg== -"@esbuild/linux-arm@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/linux-arm/-/linux-arm-0.21.5.tgz#fc6fd11a8aca56c1f6f3894f2bea0479f8f626b9" - integrity sha512-bPb5AHZtbeNGjCKVZ9UGqGwo8EUu4cLq68E95A53KlxAPRmUyYv2D6F0uUI65XisGOL1hBP5mTronbgo+0bFcA== +"@esbuild/linux-arm@0.25.3": + version "0.25.3" + resolved "https://registry.yarnpkg.com/@esbuild/linux-arm/-/linux-arm-0.25.3.tgz#e91cafa95e4474b3ae3d54da12e006b782e57225" + integrity sha512-dUOVmAUzuHy2ZOKIHIKHCm58HKzFqd+puLaS424h6I85GlSDRZIA5ycBixb3mFgM0Jdh+ZOSB6KptX30DD8YOQ== "@esbuild/linux-ia32@0.20.2": version "0.20.2" resolved "https://registry.yarnpkg.com/@esbuild/linux-ia32/-/linux-ia32-0.20.2.tgz#c0e5e787c285264e5dfc7a79f04b8b4eefdad7fa" integrity sha512-o10utieEkNPFDZFQm9CoP7Tvb33UutoJqg3qKf1PWVeeJhJw0Q347PxMvBgVVFgouYLGIhFYG0UGdBumROyiig== -"@esbuild/linux-ia32@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/linux-ia32/-/linux-ia32-0.21.5.tgz#3271f53b3f93e3d093d518d1649d6d68d346ede2" - integrity sha512-YvjXDqLRqPDl2dvRODYmmhz4rPeVKYvppfGYKSNGdyZkA01046pLWyRKKI3ax8fbJoK5QbxblURkwK/MWY18Tg== +"@esbuild/linux-ia32@0.25.3": + version "0.25.3" + resolved "https://registry.yarnpkg.com/@esbuild/linux-ia32/-/linux-ia32-0.25.3.tgz#81025732d85b68ee510161b94acdf7e3007ea177" + integrity sha512-yplPOpczHOO4jTYKmuYuANI3WhvIPSVANGcNUeMlxH4twz/TeXuzEP41tGKNGWJjuMhotpGabeFYGAOU2ummBw== "@esbuild/linux-loong64@0.20.2": version "0.20.2" resolved "https://registry.yarnpkg.com/@esbuild/linux-loong64/-/linux-loong64-0.20.2.tgz#a6184e62bd7cdc63e0c0448b83801001653219c5" integrity sha512-PR7sp6R/UC4CFVomVINKJ80pMFlfDfMQMYynX7t1tNTeivQ6XdX5r2XovMmha/VjR1YN/HgHWsVcTRIMkymrgQ== -"@esbuild/linux-loong64@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/linux-loong64/-/linux-loong64-0.21.5.tgz#ed62e04238c57026aea831c5a130b73c0f9f26df" - integrity sha512-uHf1BmMG8qEvzdrzAqg2SIG/02+4/DHB6a9Kbya0XDvwDEKCoC8ZRWI5JJvNdUjtciBGFQ5PuBlpEOXQj+JQSg== +"@esbuild/linux-loong64@0.25.3": + version "0.25.3" + resolved "https://registry.yarnpkg.com/@esbuild/linux-loong64/-/linux-loong64-0.25.3.tgz#3c744e4c8d5e1148cbe60a71a11b58ed8ee5deb8" + integrity sha512-P4BLP5/fjyihmXCELRGrLd793q/lBtKMQl8ARGpDxgzgIKJDRJ/u4r1A/HgpBpKpKZelGct2PGI4T+axcedf6g== "@esbuild/linux-mips64el@0.20.2": version "0.20.2" resolved "https://registry.yarnpkg.com/@esbuild/linux-mips64el/-/linux-mips64el-0.20.2.tgz#d08e39ce86f45ef8fc88549d29c62b8acf5649aa" integrity sha512-4BlTqeutE/KnOiTG5Y6Sb/Hw6hsBOZapOVF6njAESHInhlQAghVVZL1ZpIctBOoTFbQyGW+LsVYZ8lSSB3wkjA== -"@esbuild/linux-mips64el@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/linux-mips64el/-/linux-mips64el-0.21.5.tgz#e79b8eb48bf3b106fadec1ac8240fb97b4e64cbe" - integrity sha512-IajOmO+KJK23bj52dFSNCMsz1QP1DqM6cwLUv3W1QwyxkyIWecfafnI555fvSGqEKwjMXVLokcV5ygHW5b3Jbg== +"@esbuild/linux-mips64el@0.25.3": + version "0.25.3" + resolved "https://registry.yarnpkg.com/@esbuild/linux-mips64el/-/linux-mips64el-0.25.3.tgz#1dfe2a5d63702db9034cc6b10b3087cc0424ec26" + integrity sha512-eRAOV2ODpu6P5divMEMa26RRqb2yUoYsuQQOuFUexUoQndm4MdpXXDBbUoKIc0iPa4aCO7gIhtnYomkn2x+bag== "@esbuild/linux-ppc64@0.20.2": version "0.20.2" resolved "https://registry.yarnpkg.com/@esbuild/linux-ppc64/-/linux-ppc64-0.20.2.tgz#8d252f0b7756ffd6d1cbde5ea67ff8fd20437f20" integrity sha512-rD3KsaDprDcfajSKdn25ooz5J5/fWBylaaXkuotBDGnMnDP1Uv5DLAN/45qfnf3JDYyJv/ytGHQaziHUdyzaAg== -"@esbuild/linux-ppc64@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/linux-ppc64/-/linux-ppc64-0.21.5.tgz#5f2203860a143b9919d383ef7573521fb154c3e4" - integrity sha512-1hHV/Z4OEfMwpLO8rp7CvlhBDnjsC3CttJXIhBi+5Aj5r+MBvy4egg7wCbe//hSsT+RvDAG7s81tAvpL2XAE4w== +"@esbuild/linux-ppc64@0.25.3": + version "0.25.3" + resolved "https://registry.yarnpkg.com/@esbuild/linux-ppc64/-/linux-ppc64-0.25.3.tgz#2e85d9764c04a1ebb346dc0813ea05952c9a5c56" + integrity sha512-ZC4jV2p7VbzTlnl8nZKLcBkfzIf4Yad1SJM4ZMKYnJqZFD4rTI+pBG65u8ev4jk3/MPwY9DvGn50wi3uhdaghg== "@esbuild/linux-riscv64@0.20.2": version "0.20.2" resolved "https://registry.yarnpkg.com/@esbuild/linux-riscv64/-/linux-riscv64-0.20.2.tgz#19f6dcdb14409dae607f66ca1181dd4e9db81300" integrity sha512-snwmBKacKmwTMmhLlz/3aH1Q9T8v45bKYGE3j26TsaOVtjIag4wLfWSiZykXzXuE1kbCE+zJRmwp+ZbIHinnVg== -"@esbuild/linux-riscv64@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/linux-riscv64/-/linux-riscv64-0.21.5.tgz#07bcafd99322d5af62f618cb9e6a9b7f4bb825dc" - integrity sha512-2HdXDMd9GMgTGrPWnJzP2ALSokE/0O5HhTUvWIbD3YdjME8JwvSCnNGBnTThKGEB91OZhzrJ4qIIxk/SBmyDDA== +"@esbuild/linux-riscv64@0.25.3": + version "0.25.3" + resolved "https://registry.yarnpkg.com/@esbuild/linux-riscv64/-/linux-riscv64-0.25.3.tgz#a9ea3334556b09f85ccbfead58c803d305092415" + integrity sha512-LDDODcFzNtECTrUUbVCs6j9/bDVqy7DDRsuIXJg6so+mFksgwG7ZVnTruYi5V+z3eE5y+BJZw7VvUadkbfg7QA== "@esbuild/linux-s390x@0.20.2": version "0.20.2" resolved "https://registry.yarnpkg.com/@esbuild/linux-s390x/-/linux-s390x-0.20.2.tgz#3c830c90f1a5d7dd1473d5595ea4ebb920988685" integrity sha512-wcWISOobRWNm3cezm5HOZcYz1sKoHLd8VL1dl309DiixxVFoFe/o8HnwuIwn6sXre88Nwj+VwZUvJf4AFxkyrQ== -"@esbuild/linux-s390x@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/linux-s390x/-/linux-s390x-0.21.5.tgz#b7ccf686751d6a3e44b8627ababc8be3ef62d8de" - integrity sha512-zus5sxzqBJD3eXxwvjN1yQkRepANgxE9lgOW2qLnmr8ikMTphkjgXu1HR01K4FJg8h1kEEDAqDcZQtbrRnB41A== +"@esbuild/linux-s390x@0.25.3": + version "0.25.3" + resolved "https://registry.yarnpkg.com/@esbuild/linux-s390x/-/linux-s390x-0.25.3.tgz#f6a7cb67969222b200974de58f105dfe8e99448d" + integrity sha512-s+w/NOY2k0yC2p9SLen+ymflgcpRkvwwa02fqmAwhBRI3SC12uiS10edHHXlVWwfAagYSY5UpmT/zISXPMW3tQ== "@esbuild/linux-x64@0.20.2": version "0.20.2" resolved "https://registry.yarnpkg.com/@esbuild/linux-x64/-/linux-x64-0.20.2.tgz#86eca35203afc0d9de0694c64ec0ab0a378f6fff" integrity sha512-1MdwI6OOTsfQfek8sLwgyjOXAu+wKhLEoaOLTjbijk6E2WONYpH9ZU2mNtR+lZ2B4uwr+usqGuVfFT9tMtGvGw== -"@esbuild/linux-x64@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/linux-x64/-/linux-x64-0.21.5.tgz#6d8f0c768e070e64309af8004bb94e68ab2bb3b0" - integrity sha512-1rYdTpyv03iycF1+BhzrzQJCdOuAOtaqHTWJZCWvijKD2N5Xu0TtVC8/+1faWqcP9iBCWOmjmhoH94dH82BxPQ== +"@esbuild/linux-x64@0.25.3": + version "0.25.3" + resolved "https://registry.yarnpkg.com/@esbuild/linux-x64/-/linux-x64-0.25.3.tgz#a237d3578ecdd184a3066b1f425e314ade0f8033" + integrity sha512-nQHDz4pXjSDC6UfOE1Fw9Q8d6GCAd9KdvMZpfVGWSJztYCarRgSDfOVBY5xwhQXseiyxapkiSJi/5/ja8mRFFA== + +"@esbuild/netbsd-arm64@0.25.3": + version "0.25.3" + resolved "https://registry.yarnpkg.com/@esbuild/netbsd-arm64/-/netbsd-arm64-0.25.3.tgz#4c15c68d8149614ddb6a56f9c85ae62ccca08259" + integrity sha512-1QaLtOWq0mzK6tzzp0jRN3eccmN3hezey7mhLnzC6oNlJoUJz4nym5ZD7mDnS/LZQgkrhEbEiTn515lPeLpgWA== "@esbuild/netbsd-x64@0.20.2": version "0.20.2" resolved "https://registry.yarnpkg.com/@esbuild/netbsd-x64/-/netbsd-x64-0.20.2.tgz#e771c8eb0e0f6e1877ffd4220036b98aed5915e6" integrity sha512-K8/DhBxcVQkzYc43yJXDSyjlFeHQJBiowJ0uVL6Tor3jGQfSGHNNJcWxNbOI8v5k82prYqzPuwkzHt3J1T1iZQ== -"@esbuild/netbsd-x64@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/netbsd-x64/-/netbsd-x64-0.21.5.tgz#bbe430f60d378ecb88decb219c602667387a6047" - integrity sha512-Woi2MXzXjMULccIwMnLciyZH4nCIMpWQAs049KEeMvOcNADVxo0UBIQPfSmxB3CWKedngg7sWZdLvLczpe0tLg== +"@esbuild/netbsd-x64@0.25.3": + version "0.25.3" + resolved "https://registry.yarnpkg.com/@esbuild/netbsd-x64/-/netbsd-x64-0.25.3.tgz#12f6856f8c54c2d7d0a8a64a9711c01a743878d5" + integrity sha512-i5Hm68HXHdgv8wkrt+10Bc50zM0/eonPb/a/OFVfB6Qvpiirco5gBA5bz7S2SHuU+Y4LWn/zehzNX14Sp4r27g== + +"@esbuild/openbsd-arm64@0.25.3": + version "0.25.3" + resolved "https://registry.yarnpkg.com/@esbuild/openbsd-arm64/-/openbsd-arm64-0.25.3.tgz#ca078dad4a34df192c60233b058db2ca3d94bc5c" + integrity sha512-zGAVApJEYTbOC6H/3QBr2mq3upG/LBEXr85/pTtKiv2IXcgKV0RT0QA/hSXZqSvLEpXeIxah7LczB4lkiYhTAQ== "@esbuild/openbsd-x64@0.20.2": version "0.20.2" resolved "https://registry.yarnpkg.com/@esbuild/openbsd-x64/-/openbsd-x64-0.20.2.tgz#9a795ae4b4e37e674f0f4d716f3e226dd7c39baf" integrity sha512-eMpKlV0SThJmmJgiVyN9jTPJ2VBPquf6Kt/nAoo6DgHAoN57K15ZghiHaMvqjCye/uU4X5u3YSMgVBI1h3vKrQ== -"@esbuild/openbsd-x64@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/openbsd-x64/-/openbsd-x64-0.21.5.tgz#99d1cf2937279560d2104821f5ccce220cb2af70" - integrity sha512-HLNNw99xsvx12lFBUwoT8EVCsSvRNDVxNpjZ7bPn947b8gJPzeHWyNVhFsaerc0n3TsbOINvRP2byTZ5LKezow== +"@esbuild/openbsd-x64@0.25.3": + version "0.25.3" + resolved "https://registry.yarnpkg.com/@esbuild/openbsd-x64/-/openbsd-x64-0.25.3.tgz#c9178adb60e140e03a881d0791248489c79f95b2" + integrity sha512-fpqctI45NnCIDKBH5AXQBsD0NDPbEFczK98hk/aa6HJxbl+UtLkJV2+Bvy5hLSLk3LHmqt0NTkKNso1A9y1a4w== "@esbuild/sunos-x64@0.20.2": version "0.20.2" resolved "https://registry.yarnpkg.com/@esbuild/sunos-x64/-/sunos-x64-0.20.2.tgz#7df23b61a497b8ac189def6e25a95673caedb03f" integrity sha512-2UyFtRC6cXLyejf/YEld4Hajo7UHILetzE1vsRcGL3earZEW77JxrFjH4Ez2qaTiEfMgAXxfAZCm1fvM/G/o8w== -"@esbuild/sunos-x64@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/sunos-x64/-/sunos-x64-0.21.5.tgz#08741512c10d529566baba837b4fe052c8f3487b" - integrity sha512-6+gjmFpfy0BHU5Tpptkuh8+uw3mnrvgs+dSPQXQOv3ekbordwnzTVEb4qnIvQcYXq6gzkyTnoZ9dZG+D4garKg== +"@esbuild/sunos-x64@0.25.3": + version "0.25.3" + resolved "https://registry.yarnpkg.com/@esbuild/sunos-x64/-/sunos-x64-0.25.3.tgz#03765eb6d4214ff27e5230af779e80790d1ee09f" + integrity sha512-ROJhm7d8bk9dMCUZjkS8fgzsPAZEjtRJqCAmVgB0gMrvG7hfmPmz9k1rwO4jSiblFjYmNvbECL9uhaPzONMfgA== "@esbuild/win32-arm64@0.20.2": version "0.20.2" resolved "https://registry.yarnpkg.com/@esbuild/win32-arm64/-/win32-arm64-0.20.2.tgz#f1ae5abf9ca052ae11c1bc806fb4c0f519bacf90" integrity sha512-GRibxoawM9ZCnDxnP3usoUDO9vUkpAxIIZ6GQI+IlVmr5kP3zUq+l17xELTHMWTWzjxa2guPNyrpq1GWmPvcGQ== -"@esbuild/win32-arm64@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/win32-arm64/-/win32-arm64-0.21.5.tgz#675b7385398411240735016144ab2e99a60fc75d" - integrity sha512-Z0gOTd75VvXqyq7nsl93zwahcTROgqvuAcYDUr+vOv8uHhNSKROyU961kgtCD1e95IqPKSQKH7tBTslnS3tA8A== +"@esbuild/win32-arm64@0.25.3": + version "0.25.3" + resolved "https://registry.yarnpkg.com/@esbuild/win32-arm64/-/win32-arm64-0.25.3.tgz#f1c867bd1730a9b8dfc461785ec6462e349411ea" + integrity sha512-YWcow8peiHpNBiIXHwaswPnAXLsLVygFwCB3A7Bh5jRkIBFWHGmNQ48AlX4xDvQNoMZlPYzjVOQDYEzWCqufMQ== "@esbuild/win32-ia32@0.20.2": version "0.20.2" resolved "https://registry.yarnpkg.com/@esbuild/win32-ia32/-/win32-ia32-0.20.2.tgz#241fe62c34d8e8461cd708277813e1d0ba55ce23" integrity sha512-HfLOfn9YWmkSKRQqovpnITazdtquEW8/SoHW7pWpuEeguaZI4QnCRW6b+oZTztdBnZOS2hqJ6im/D5cPzBTTlQ== -"@esbuild/win32-ia32@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/win32-ia32/-/win32-ia32-0.21.5.tgz#1bfc3ce98aa6ca9a0969e4d2af72144c59c1193b" - integrity sha512-SWXFF1CL2RVNMaVs+BBClwtfZSvDgtL//G/smwAc5oVK/UPu2Gu9tIaRgFmYFFKrmg3SyAjSrElf0TiJ1v8fYA== +"@esbuild/win32-ia32@0.25.3": + version "0.25.3" + resolved "https://registry.yarnpkg.com/@esbuild/win32-ia32/-/win32-ia32-0.25.3.tgz#77491f59ef6c9ddf41df70670d5678beb3acc322" + integrity sha512-qspTZOIGoXVS4DpNqUYUs9UxVb04khS1Degaw/MnfMe7goQ3lTfQ13Vw4qY/Nj0979BGvMRpAYbs/BAxEvU8ew== "@esbuild/win32-x64@0.20.2": version "0.20.2" resolved "https://registry.yarnpkg.com/@esbuild/win32-x64/-/win32-x64-0.20.2.tgz#9c907b21e30a52db959ba4f80bb01a0cc403d5cc" integrity sha512-N49X4lJX27+l9jbLKSqZ6bKNjzQvHaT8IIFUy+YIqmXQdjYCToGWwOItDrfby14c78aDd5NHQl29xingXfCdLQ== -"@esbuild/win32-x64@0.21.5": - version "0.21.5" - resolved "https://registry.yarnpkg.com/@esbuild/win32-x64/-/win32-x64-0.21.5.tgz#acad351d582d157bb145535db2a6ff53dd514b5c" - integrity sha512-tQd/1efJuzPC6rCFwEvLtci/xNFcTZknmXs98FYDfGE4wP9ClFV98nyKrzJKVPMhdDnjzLhdUyMX4PsQAPjwIw== +"@esbuild/win32-x64@0.25.3": + version "0.25.3" + resolved "https://registry.yarnpkg.com/@esbuild/win32-x64/-/win32-x64-0.25.3.tgz#b17a2171f9074df9e91bfb07ef99a892ac06412a" + integrity sha512-ICgUR+kPimx0vvRzf+N/7L7tVSQeE3BYY+NhHRHXS1kBuPO7z2+7ea2HbhDyZdTephgvNvKrlDDKUexuCVBVvg== "@eslint-community/eslint-utils@^4.2.0", "@eslint-community/eslint-utils@^4.4.0": version "4.4.0" @@ -3818,65 +3828,105 @@ estree-walker "^2.0.2" picomatch "^2.3.1" -"@rollup/rollup-android-arm-eabi@4.5.1": - version "4.5.1" - resolved "https://registry.yarnpkg.com/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.5.1.tgz#11bea66c013e5a88a0f53f315b2d49cfd663584e" - integrity "sha1-Eb6mbAE+Woig9T8xWy1Jz9ZjWE4= sha512-YaN43wTyEBaMqLDYeze+gQ4ZrW5RbTEGtT5o1GVDkhpdNcsLTnLRcLccvwy3E9wiDKWg9RIhuoy3JQKDRBfaZA==" +"@rollup/rollup-android-arm-eabi@4.40.0": + version "4.40.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.40.0.tgz#d964ee8ce4d18acf9358f96adc408689b6e27fe3" + integrity sha512-+Fbls/diZ0RDerhE8kyC6hjADCXA1K4yVNlH0EYfd2XjyH0UGgzaQ8MlT0pCXAThfxv3QUAczHaL+qSv1E4/Cg== -"@rollup/rollup-android-arm64@4.5.1": - version "4.5.1" - resolved "https://registry.yarnpkg.com/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.5.1.tgz#cae505492204c018d1c6335f3b845319b15dc669" - integrity "sha1-yuUFSSIEwBjRxjNfO4RTGbFdxmk= sha512-n1bX+LCGlQVuPlCofO0zOKe1b2XkFozAVRoczT+yxWZPGnkEAKTTYVOGZz8N4sKuBnKMxDbfhUsB1uwYdup/sw==" +"@rollup/rollup-android-arm64@4.40.0": + version "4.40.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.40.0.tgz#9b5e130ecc32a5fc1e96c09ff371743ee71a62d3" + integrity sha512-PPA6aEEsTPRz+/4xxAmaoWDqh67N7wFbgFUJGMnanCFs0TV99M0M8QhhaSCks+n6EbQoFvLQgYOGXxlMGQe/6w== -"@rollup/rollup-darwin-arm64@4.5.1": - version "4.5.1" - resolved "https://registry.yarnpkg.com/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.5.1.tgz#5442ca442fca1a166e41e03b983b2f3e3235c17c" - integrity "sha1-VELKRC/KGhZuQeA7mDsvPjI1wXw= sha512-QqJBumdvfBqBBmyGHlKxje+iowZwrHna7pokj/Go3dV1PJekSKfmjKrjKQ/e6ESTGhkfPNLq3VXdYLAc+UtAQw==" +"@rollup/rollup-darwin-arm64@4.40.0": + version "4.40.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.40.0.tgz#ef439182c739b20b3c4398cfc03e3c1249ac8903" + integrity sha512-GwYOcOakYHdfnjjKwqpTGgn5a6cUX7+Ra2HeNj/GdXvO2VJOOXCiYYlRFU4CubFM67EhbmzLOmACKEfvp3J1kQ== -"@rollup/rollup-darwin-x64@4.5.1": - version "4.5.1" - resolved "https://registry.yarnpkg.com/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.5.1.tgz#e5140b0aaab0ea1424a4c8a1e76442105866290c" - integrity "sha1-5RQLCqqw6hQkpMih52RCEFhmKQw= sha512-RrkDNkR/P5AEQSPkxQPmd2ri8WTjSl0RYmuFOiEABkEY/FSg0a4riihWQGKDJ4LnV9gigWZlTMx2DtFGzUrYQw==" +"@rollup/rollup-darwin-x64@4.40.0": + version "4.40.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.40.0.tgz#d7380c1531ab0420ca3be16f17018ef72dd3d504" + integrity sha512-CoLEGJ+2eheqD9KBSxmma6ld01czS52Iw0e2qMZNpPDlf7Z9mj8xmMemxEucinev4LgHalDPczMyxzbq+Q+EtA== -"@rollup/rollup-linux-arm-gnueabihf@4.5.1": - version "4.5.1" - resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.5.1.tgz#501a336b1dc4cb350a1b8b4e24bba4d049902d74" - integrity "sha1-UBozax3EyzUKG4tOJLuk0EmQLXQ= sha512-ZFPxvUZmE+fkB/8D9y/SWl/XaDzNSaxd1TJUSE27XAKlRpQ2VNce/86bGd9mEUgL3qrvjJ9XTGwoX0BrJkYK/A==" +"@rollup/rollup-freebsd-arm64@4.40.0": + version "4.40.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.40.0.tgz#cbcbd7248823c6b430ce543c59906dd3c6df0936" + integrity sha512-r7yGiS4HN/kibvESzmrOB/PxKMhPTlz+FcGvoUIKYoTyGd5toHp48g1uZy1o1xQvybwwpqpe010JrcGG2s5nkg== -"@rollup/rollup-linux-arm64-gnu@4.5.1": - version "4.5.1" - resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.5.1.tgz#bdb0c8552d167477d2624a4a6df0f71f128dc546" - integrity "sha1-vbDIVS0WdHfSYkpKbfD3HxKNxUY= sha512-FEuAjzVIld5WVhu+M2OewLmjmbXWd3q7Zcx+Rwy4QObQCqfblriDMMS7p7+pwgjZoo9BLkP3wa9uglQXzsB9ww==" +"@rollup/rollup-freebsd-x64@4.40.0": + version "4.40.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.40.0.tgz#96bf6ff875bab5219c3472c95fa6eb992586a93b" + integrity sha512-mVDxzlf0oLzV3oZOr0SMJ0lSDd3xC4CmnWJ8Val8isp9jRGl5Dq//LLDSPFrasS7pSm6m5xAcKaw3sHXhBjoRw== -"@rollup/rollup-linux-arm64-musl@4.5.1": - version "4.5.1" - resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.5.1.tgz#f7e8036c2f771bb366ca0d8c79d2132cffb1d295" - integrity "sha1-9+gDbC93G7Nmyg2MedITLP+x0pU= sha512-f5Gs8WQixqGRtI0Iq/cMqvFYmgFzMinuJO24KRfnv7Ohi/HQclwrBCYkzQu1XfLEEt3DZyvveq9HWo4bLJf1Lw==" +"@rollup/rollup-linux-arm-gnueabihf@4.40.0": + version "4.40.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.40.0.tgz#d80cd62ce6d40f8e611008d8dbf03b5e6bbf009c" + integrity sha512-y/qUMOpJxBMy8xCXD++jeu8t7kzjlOCkoxxajL58G62PJGBZVl/Gwpm7JK9+YvlB701rcQTzjUZ1JgUoPTnoQA== -"@rollup/rollup-linux-x64-gnu@4.5.1": - version "4.5.1" - resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.5.1.tgz#079ca543a649b1dcf9832a34dff94ebb46c96745" - integrity "sha1-B5ylQ6ZJsdz5gyo03/lOu0bJZ0U= sha512-CWPkPGrFfN2vj3mw+S7A/4ZaU3rTV7AkXUr08W9lNP+UzOvKLVf34tWCqrKrfwQ0NTk5GFqUr2XGpeR2p6R4gw==" +"@rollup/rollup-linux-arm-musleabihf@4.40.0": + version "4.40.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.40.0.tgz#75440cfc1e8d0f87a239b4c31dfeaf4719b656b7" + integrity sha512-GoCsPibtVdJFPv/BOIvBKO/XmwZLwaNWdyD8TKlXuqp0veo2sHE+A/vpMQ5iSArRUz/uaoj4h5S6Pn0+PdhRjg== -"@rollup/rollup-linux-x64-musl@4.5.1": - version "4.5.1" - resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.5.1.tgz#9cc8c0ea1c0e0d3b18888d5b2fd51ef6c9b42481" - integrity "sha1-nMjA6hwODTsYiI1bL9Ue9sm0JIE= sha512-ZRETMFA0uVukUC9u31Ed1nx++29073goCxZtmZARwk5aF/ltuENaeTtRVsSQzFlzdd4J6L3qUm+EW8cbGt0CKQ==" +"@rollup/rollup-linux-arm64-gnu@4.40.0": + version "4.40.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.40.0.tgz#ac527485ecbb619247fb08253ec8c551a0712e7c" + integrity sha512-L5ZLphTjjAD9leJzSLI7rr8fNqJMlGDKlazW2tX4IUF9P7R5TMQPElpH82Q7eNIDQnQlAyiNVfRPfP2vM5Avvg== -"@rollup/rollup-win32-arm64-msvc@4.5.1": - version "4.5.1" - resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.5.1.tgz#df70597f6639549e79f0801004525d6a7a0075e4" - integrity "sha1-33BZf2Y5VJ558IAQBFJdanoAdeQ= sha512-ihqfNJNb2XtoZMSCPeoo0cYMgU04ksyFIoOw5S0JUVbOhafLot+KD82vpKXOurE2+9o/awrqIxku9MRR9hozHQ==" +"@rollup/rollup-linux-arm64-musl@4.40.0": + version "4.40.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.40.0.tgz#74d2b5cb11cf714cd7d1682e7c8b39140e908552" + integrity sha512-ATZvCRGCDtv1Y4gpDIXsS+wfFeFuLwVxyUBSLawjgXK2tRE6fnsQEkE4csQQYWlBlsFztRzCnBvWVfcae/1qxQ== -"@rollup/rollup-win32-ia32-msvc@4.5.1": - version "4.5.1" - resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.5.1.tgz#6f9e8b30a4d6b5c564bfe55cdf44a5b493139838" - integrity "sha1-b56LMKTWtcVkv+Vc30SltJMTmDg= sha512-zK9MRpC8946lQ9ypFn4gLpdwr5a01aQ/odiIJeL9EbgZDMgbZjjT/XzTqJvDfTmnE1kHdbG20sAeNlpc91/wbg==" +"@rollup/rollup-linux-loongarch64-gnu@4.40.0": + version "4.40.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-loongarch64-gnu/-/rollup-linux-loongarch64-gnu-4.40.0.tgz#a0a310e51da0b5fea0e944b0abd4be899819aef6" + integrity sha512-wG9e2XtIhd++QugU5MD9i7OnpaVb08ji3P1y/hNbxrQ3sYEelKJOq1UJ5dXczeo6Hj2rfDEL5GdtkMSVLa/AOg== -"@rollup/rollup-win32-x64-msvc@4.5.1": - version "4.5.1" - resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.5.1.tgz#0e79117bacb5817ff9a88ab19cb59df839638d6d" - integrity "sha1-DnkRe6y1gX/5qIqxnLWd+DljjW0= sha512-5I3Nz4Sb9TYOtkRwlH0ow+BhMH2vnh38tZ4J4mggE48M/YyJyp/0sPSxhw1UeS1+oBgQ8q7maFtSeKpeRJu41Q==" +"@rollup/rollup-linux-powerpc64le-gnu@4.40.0": + version "4.40.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.40.0.tgz#4077e2862b0ac9f61916d6b474d988171bd43b83" + integrity sha512-vgXfWmj0f3jAUvC7TZSU/m/cOE558ILWDzS7jBhiCAFpY2WEBn5jqgbqvmzlMjtp8KlLcBlXVD2mkTSEQE6Ixw== + +"@rollup/rollup-linux-riscv64-gnu@4.40.0": + version "4.40.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.40.0.tgz#5812a1a7a2f9581cbe12597307cc7ba3321cf2f3" + integrity sha512-uJkYTugqtPZBS3Z136arevt/FsKTF/J9dEMTX/cwR7lsAW4bShzI2R0pJVw+hcBTWF4dxVckYh72Hk3/hWNKvA== + +"@rollup/rollup-linux-riscv64-musl@4.40.0": + version "4.40.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.40.0.tgz#973aaaf4adef4531375c36616de4e01647f90039" + integrity sha512-rKmSj6EXQRnhSkE22+WvrqOqRtk733x3p5sWpZilhmjnkHkpeCgWsFFo0dGnUGeA+OZjRl3+VYq+HyCOEuwcxQ== + +"@rollup/rollup-linux-s390x-gnu@4.40.0": + version "4.40.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.40.0.tgz#9bad59e907ba5bfcf3e9dbd0247dfe583112f70b" + integrity sha512-SpnYlAfKPOoVsQqmTFJ0usx0z84bzGOS9anAC0AZ3rdSo3snecihbhFTlJZ8XMwzqAcodjFU4+/SM311dqE5Sw== + +"@rollup/rollup-linux-x64-gnu@4.40.0": + version "4.40.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.40.0.tgz#68b045a720bd9b4d905f462b997590c2190a6de0" + integrity sha512-RcDGMtqF9EFN8i2RYN2W+64CdHruJ5rPqrlYw+cgM3uOVPSsnAQps7cpjXe9be/yDp8UC7VLoCoKC8J3Kn2FkQ== + +"@rollup/rollup-linux-x64-musl@4.40.0": + version "4.40.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.40.0.tgz#8e703e2c2ad19ba7b2cb3d8c3a4ad11d4ee3a282" + integrity sha512-HZvjpiUmSNx5zFgwtQAV1GaGazT2RWvqeDi0hV+AtC8unqqDSsaFjPxfsO6qPtKRRg25SisACWnJ37Yio8ttaw== + +"@rollup/rollup-win32-arm64-msvc@4.40.0": + version "4.40.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.40.0.tgz#c5bee19fa670ff5da5f066be6a58b4568e9c650b" + integrity sha512-UtZQQI5k/b8d7d3i9AZmA/t+Q4tk3hOC0tMOMSq2GlMYOfxbesxG4mJSeDp0EHs30N9bsfwUvs3zF4v/RzOeTQ== + +"@rollup/rollup-win32-ia32-msvc@4.40.0": + version "4.40.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.40.0.tgz#846e02c17044bd922f6f483a3b4d36aac6e2b921" + integrity sha512-+m03kvI2f5syIqHXCZLPVYplP8pQch9JHyXKZ3AGMKlg8dCyr2PKHjwRLiW53LTrN/Nc3EqHOKxUxzoSPdKddA== + +"@rollup/rollup-win32-x64-msvc@4.40.0": + version "4.40.0" + resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.40.0.tgz#fd92d31a2931483c25677b9c6698106490cbbc76" + integrity sha512-lpPE1cLfP5oPzVjKMx10pgBmKELQnFJXHgvtHCtuJWOv8MxqdEIMNtgHgBFf7Ea2/7EuVwa9fodWUfXAlXZLZQ== "@rtsao/scc@^1.1.0": version "1.1.0" @@ -4983,10 +5033,10 @@ resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.39.tgz#e177e699ee1b8c22d23174caaa7422644389509f" integrity "sha1-4Xfmme4bjCLSMXTKqnQiZEOJUJ8= sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw==" -"@types/estree@^1.0.0": - version "1.0.5" - resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.5.tgz#a6ce3e556e00fd9895dd872dd172ad0d4bd687f4" - integrity sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw== +"@types/estree@1.0.7", "@types/estree@^1.0.0": + version "1.0.7" + resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.7.tgz#4158d3105276773d5b7695cd4834b1722e4f37a8" + integrity sha512-w28IoSUCJpidD/TGviZwwMJckNESJZXFu7NBZ5YJ4mEUnNraUn9Pm8HSZm/jDF1pDWYKspWE7oVphigUPRakIQ== "@types/express-serve-static-core@^4.17.18": version "4.17.24" @@ -8550,34 +8600,36 @@ esbuild@^0.20.1: "@esbuild/win32-ia32" "0.20.2" "@esbuild/win32-x64" "0.20.2" -esbuild@^0.21.3: - version "0.21.5" - resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.21.5.tgz#9ca301b120922959b766360d8ac830da0d02997d" - integrity sha512-mg3OPMV4hXywwpoDxu3Qda5xCKQi+vCTZq8S9J/EpkhB2HzKXq4SNFZE3+NK93JYxc8VMSep+lOUSC/RVKaBqw== +esbuild@^0.25.0: + version "0.25.3" + resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.25.3.tgz#371f7cb41283e5b2191a96047a7a89562965a285" + integrity sha512-qKA6Pvai73+M2FtftpNKRxJ78GIjmFXFxd/1DVBqGo/qNhLSfv+G12n9pNoWdytJC8U00TrViOwpjT0zgqQS8Q== optionalDependencies: - "@esbuild/aix-ppc64" "0.21.5" - "@esbuild/android-arm" "0.21.5" - "@esbuild/android-arm64" "0.21.5" - "@esbuild/android-x64" "0.21.5" - "@esbuild/darwin-arm64" "0.21.5" - "@esbuild/darwin-x64" "0.21.5" - "@esbuild/freebsd-arm64" "0.21.5" - "@esbuild/freebsd-x64" "0.21.5" - "@esbuild/linux-arm" "0.21.5" - "@esbuild/linux-arm64" "0.21.5" - "@esbuild/linux-ia32" "0.21.5" - "@esbuild/linux-loong64" "0.21.5" - "@esbuild/linux-mips64el" "0.21.5" - "@esbuild/linux-ppc64" "0.21.5" - "@esbuild/linux-riscv64" "0.21.5" - "@esbuild/linux-s390x" "0.21.5" - "@esbuild/linux-x64" "0.21.5" - "@esbuild/netbsd-x64" "0.21.5" - "@esbuild/openbsd-x64" "0.21.5" - "@esbuild/sunos-x64" "0.21.5" - "@esbuild/win32-arm64" "0.21.5" - "@esbuild/win32-ia32" "0.21.5" - "@esbuild/win32-x64" "0.21.5" + "@esbuild/aix-ppc64" "0.25.3" + "@esbuild/android-arm" "0.25.3" + "@esbuild/android-arm64" "0.25.3" + "@esbuild/android-x64" "0.25.3" + "@esbuild/darwin-arm64" "0.25.3" + "@esbuild/darwin-x64" "0.25.3" + "@esbuild/freebsd-arm64" "0.25.3" + "@esbuild/freebsd-x64" "0.25.3" + "@esbuild/linux-arm" "0.25.3" + "@esbuild/linux-arm64" "0.25.3" + "@esbuild/linux-ia32" "0.25.3" + "@esbuild/linux-loong64" "0.25.3" + "@esbuild/linux-mips64el" "0.25.3" + "@esbuild/linux-ppc64" "0.25.3" + "@esbuild/linux-riscv64" "0.25.3" + "@esbuild/linux-s390x" "0.25.3" + "@esbuild/linux-x64" "0.25.3" + "@esbuild/netbsd-arm64" "0.25.3" + "@esbuild/netbsd-x64" "0.25.3" + "@esbuild/openbsd-arm64" "0.25.3" + "@esbuild/openbsd-x64" "0.25.3" + "@esbuild/sunos-x64" "0.25.3" + "@esbuild/win32-arm64" "0.25.3" + "@esbuild/win32-ia32" "0.25.3" + "@esbuild/win32-x64" "0.25.3" escalade@^3.1.1, escalade@^3.2.0: version "3.2.0" @@ -9046,10 +9098,10 @@ fd-slicer@~1.1.0: dependencies: pend "~1.2.0" -fdir@^6.4.2: - version "6.4.3" - resolved "https://registry.yarnpkg.com/fdir/-/fdir-6.4.3.tgz#011cdacf837eca9b811c89dbb902df714273db72" - integrity sha512-PMXmW2y1hDDfTSRc9gaXIuCCRpuoz3Kaz8cUelp3smouvfT632ozg2vrT6lJsHKKOF59YLbOGfAWGUcKEfRMQw== +fdir@^6.4.4: + version "6.4.4" + resolved "https://registry.yarnpkg.com/fdir/-/fdir-6.4.4.tgz#1cfcf86f875a883e19a8fab53622cfe992e8d2f9" + integrity sha512-1NZP+GK4GfuAv3PqKvxQRDMjdSRZjnkq7KfhlNrCNNlZ0ygQFpebfrnfnq/W7fpUnAv9aGWmY1zKx7FYL3gwhg== fecha@^4.2.0: version "4.2.1" @@ -12112,10 +12164,10 @@ mz@^2.7.0: object-assign "^4.0.1" thenify-all "^1.0.0" -nanoid@^3.3.7: - version "3.3.8" - resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.8.tgz#b1be3030bee36aaff18bacb375e5cce521684baf" - integrity sha512-WNLf5Sd8oZxOm+TzppcYk8gVOgP+l58xNy58D0nbUnOxOWRWvlcCV4kUF7ltmI6PsrLl/BgKEyS4mqsGChFN0w== +nanoid@^3.3.8: + version "3.3.11" + resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.11.tgz#4f4f112cefbe303202f2199838128936266d185b" + integrity sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w== natural-compare@^1.4.0: version "1.4.0" @@ -12839,7 +12891,7 @@ pgpass@1.x: dependencies: split2 "^3.1.1" -picocolors@^1.0.0, picocolors@^1.1.0, picocolors@^1.1.1: +picocolors@^1.0.0, picocolors@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.1.1.tgz#3d321af3eab939b083c8f929a1d12cda81c26b6b" integrity sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA== @@ -12949,13 +13001,13 @@ postcss-value-parser@^4.0.2: resolved "https://registry.yarnpkg.com/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz#723c09920836ba6d3e5af019f92bc0971c02e514" integrity "sha1-cjwJkgg2um0+WvAZ+SvAlxwC5RQ= sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==" -postcss@^8.4.43: - version "8.4.47" - resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.47.tgz#5bf6c9a010f3e724c503bf03ef7947dcb0fea365" - integrity sha512-56rxCq7G/XfB4EkXq9Egn5GCqugWvDFjafDOThIdMBsI15iqPqR5r15TfSr1YPYeEI19YeaXMCbY6u88Y76GLQ== +postcss@^8.5.3: + version "8.5.3" + resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.5.3.tgz#1463b6f1c7fb16fe258736cba29a2de35237eafb" + integrity sha512-dle9A3yYxlBSrt8Fu+IpjGT8SY8hN0mlaA6GY8t0P5PjIOZemULz/E2Bnm/2dcUOena75OTNkHI76uZBNUUq3A== dependencies: - nanoid "^3.3.7" - picocolors "^1.1.0" + nanoid "^3.3.8" + picocolors "^1.1.1" source-map-js "^1.2.1" postgres-array@~2.0.0: @@ -13962,35 +14014,59 @@ rollup-plugin-node-resolve@^3.0.0: is-module "^1.0.0" resolve "^1.1.6" -rollup-plugin-stats@1.3.4: - version "1.3.4" - resolved "https://registry.yarnpkg.com/rollup-plugin-stats/-/rollup-plugin-stats-1.3.4.tgz#772f147bb195f7bd77877b95a7e0baf801aeaf94" - integrity sha512-N6PCNucOrRJxqzeAvpEyK9Wf4bxQlCCuIj5+n0XUB0plFU0u1VwjY0GDM6Z3lvs/KDhzJ2anYwxXUZVfmFw8LA== +rollup-plugin-stats@1.3.6: + version "1.3.6" + resolved "https://registry.yarnpkg.com/rollup-plugin-stats/-/rollup-plugin-stats-1.3.6.tgz#aa1d3f29c0f443b4e39e380f0d23c5eceb9909eb" + integrity sha512-wpsRsRtp52kN0gv3yBPB1KEKU99Rbsj+aqcHdfH1YVrSLnRuFWJj7auOcp3siF+xpnkd+85XOBZzKCbysD06gw== -rollup-plugin-webpack-stats@^2.0.3: - version "2.0.3" - resolved "https://registry.yarnpkg.com/rollup-plugin-webpack-stats/-/rollup-plugin-webpack-stats-2.0.3.tgz#918dc46aa652a731bb62239c894e487bf8e5365a" - integrity sha512-tJJaYkP3yQctWRoAn7zh47DszOpwXVaDDmxriu48cohi7Nv/87l8Ry0vHnUd8e9MbpXuKZwEGQjqk1BjYLbYww== +rollup-plugin-webpack-stats@^2.0.5: + version "2.0.5" + resolved "https://registry.yarnpkg.com/rollup-plugin-webpack-stats/-/rollup-plugin-webpack-stats-2.0.5.tgz#dee3ef2fb34adea2df0bef1711e253a360994741" + integrity sha512-okto2hDUh7TU1/9JHpLBS5BZwMYTsQUPiiiY1LF3aNy+61PzyzF6jugz5TWj0c04/8N/7DDnX/YDNqmpzGLX7Q== dependencies: - rollup-plugin-stats "1.3.4" + rollup-plugin-stats "1.3.6" -rollup@^0.41.4, rollup@^2.43.1, rollup@^4.20.0, rollup@^4.5.1: - version "4.5.1" - resolved "https://registry.yarnpkg.com/rollup/-/rollup-4.5.1.tgz#95661ead5373d46e1c91b38fc1549bc59fc72aa4" - integrity "sha1-lWYerVNz1G4ckbOPwVSbxZ/HKqQ= sha512-0EQribZoPKpb5z1NW/QYm3XSR//Xr8BeEXU49Lc/mQmpmVVG5jPUVrpc2iptup/0WMrY9mzas0fxH+TjYvG2CA==" +rollup@^0.41.4: + version "0.41.6" + resolved "https://registry.yarnpkg.com/rollup/-/rollup-0.41.6.tgz#e0d05497877a398c104d816d2733a718a7a94e2a" + integrity sha512-rq3eIm5O0oWo2LswknhTxP9FQj+EsyRk8KN6DaRG+OVtQ1Ce1wA71+7eY9mjtqLfNVphcmBdlutn0bcHwHREng== + dependencies: + source-map-support "^0.4.0" + +rollup@^2.43.1: + version "2.79.2" + resolved "https://registry.yarnpkg.com/rollup/-/rollup-2.79.2.tgz#f150e4a5db4b121a21a747d762f701e5e9f49090" + integrity sha512-fS6iqSPZDs3dr/y7Od6y5nha8dW1YnbgtsyotCVvoFGKbERG++CVRFv1meyGDE1SNItQA8BrnCw7ScdAhRJ3XQ== optionalDependencies: - "@rollup/rollup-android-arm-eabi" "4.5.1" - "@rollup/rollup-android-arm64" "4.5.1" - "@rollup/rollup-darwin-arm64" "4.5.1" - "@rollup/rollup-darwin-x64" "4.5.1" - "@rollup/rollup-linux-arm-gnueabihf" "4.5.1" - "@rollup/rollup-linux-arm64-gnu" "4.5.1" - "@rollup/rollup-linux-arm64-musl" "4.5.1" - "@rollup/rollup-linux-x64-gnu" "4.5.1" - "@rollup/rollup-linux-x64-musl" "4.5.1" - "@rollup/rollup-win32-arm64-msvc" "4.5.1" - "@rollup/rollup-win32-ia32-msvc" "4.5.1" - "@rollup/rollup-win32-x64-msvc" "4.5.1" + fsevents "~2.3.2" + +rollup@^4.34.9: + version "4.40.0" + resolved "https://registry.yarnpkg.com/rollup/-/rollup-4.40.0.tgz#13742a615f423ccba457554f006873d5a4de1920" + integrity sha512-Noe455xmA96nnqH5piFtLobsGbCij7Tu+tb3c1vYjNbTkfzGqXqQXG3wJaYXkRZuQ0vEYN4bhwg7QnIrqB5B+w== + dependencies: + "@types/estree" "1.0.7" + optionalDependencies: + "@rollup/rollup-android-arm-eabi" "4.40.0" + "@rollup/rollup-android-arm64" "4.40.0" + "@rollup/rollup-darwin-arm64" "4.40.0" + "@rollup/rollup-darwin-x64" "4.40.0" + "@rollup/rollup-freebsd-arm64" "4.40.0" + "@rollup/rollup-freebsd-x64" "4.40.0" + "@rollup/rollup-linux-arm-gnueabihf" "4.40.0" + "@rollup/rollup-linux-arm-musleabihf" "4.40.0" + "@rollup/rollup-linux-arm64-gnu" "4.40.0" + "@rollup/rollup-linux-arm64-musl" "4.40.0" + "@rollup/rollup-linux-loongarch64-gnu" "4.40.0" + "@rollup/rollup-linux-powerpc64le-gnu" "4.40.0" + "@rollup/rollup-linux-riscv64-gnu" "4.40.0" + "@rollup/rollup-linux-riscv64-musl" "4.40.0" + "@rollup/rollup-linux-s390x-gnu" "4.40.0" + "@rollup/rollup-linux-x64-gnu" "4.40.0" + "@rollup/rollup-linux-x64-musl" "4.40.0" + "@rollup/rollup-win32-arm64-msvc" "4.40.0" + "@rollup/rollup-win32-ia32-msvc" "4.40.0" + "@rollup/rollup-win32-x64-msvc" "4.40.0" fsevents "~2.3.2" rope-sequence@^1.3.0: @@ -14460,6 +14536,13 @@ source-map-support@0.5.13: buffer-from "^1.0.0" source-map "^0.6.0" +source-map-support@^0.4.0: + version "0.4.18" + resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.4.18.tgz#0286a6de8be42641338594e97ccea75f0a2c585f" + integrity sha512-try0/JqxPLF9nOjvSta7tVondkP5dwgyLDjVoyMDlmjugT2lRZ1OfsrYTkCd2hkDnJTKRbO/Rl3orm8vlsUzbA== + dependencies: + source-map "^0.5.6" + source-map-support@~0.5.20: version "0.5.21" resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.21.tgz#04fe7c7f9e1ed2d662233c28cb2b35b9f63f6e4f" @@ -15006,12 +15089,12 @@ tinyexec@^0.3.0: resolved "https://registry.yarnpkg.com/tinyexec/-/tinyexec-0.3.1.tgz#0ab0daf93b43e2c211212396bdb836b468c97c98" integrity sha512-WiCJLEECkO18gwqIp6+hJg0//p23HXp4S+gGtAKu3mI2F2/sXC4FvHvXvB0zJVVaTPhx1/tOwdbRsa1sOBIKqQ== -tinyglobby@^0.2.10: - version "0.2.10" - resolved "https://registry.yarnpkg.com/tinyglobby/-/tinyglobby-0.2.10.tgz#e712cf2dc9b95a1f5c5bbd159720e15833977a0f" - integrity sha512-Zc+8eJlFMvgatPZTl6A9L/yht8QqdmUNtURHaKZLmKBE12hNPSrqNkUp2cs3M/UKmNVVAMFQYSjYIVHDjW5zew== +tinyglobby@^0.2.10, tinyglobby@^0.2.13: + version "0.2.13" + resolved "https://registry.yarnpkg.com/tinyglobby/-/tinyglobby-0.2.13.tgz#a0e46515ce6cbcd65331537e57484af5a7b2ff7e" + integrity sha512-mEwzpUgrLySlveBwEVDMKk5B57bhLPYovRfPAXD5gA/98Opn0rCDj3GtLwFvCvH5RK9uPCExUROW5NjDwvqkxw== dependencies: - fdir "^6.4.2" + fdir "^6.4.4" picomatch "^4.0.2" tippy.js@^6.3.1: @@ -15662,14 +15745,17 @@ vite-plugin-static-copy@^0.17.0: fs-extra "^11.1.0" picocolors "^1.0.0" -vite@^5.4.18: - version "5.4.18" - resolved "https://registry.yarnpkg.com/vite/-/vite-5.4.18.tgz#b5af357f9d5ebb2e0c085779b7a37a77f09168a4" - integrity sha512-1oDcnEp3lVyHCuQ2YFelM4Alm2o91xNoMncRm1U7S+JdYfYOvbiGZ3/CxGttrOu2M/KcGz7cRC2DoNUA6urmMA== +vite@^6.3.3: + version "6.3.3" + resolved "https://registry.yarnpkg.com/vite/-/vite-6.3.3.tgz#497392c3f2243194e4dbf09ea83e9a3dddf49b88" + integrity sha512-5nXH+QsELbFKhsEfWLkHrvgRpTdGJzqOZ+utSdmPTvwHmvU6ITTm3xx+mRusihkcI8GeC7lCDyn3kDtiki9scw== dependencies: - esbuild "^0.21.3" - postcss "^8.4.43" - rollup "^4.20.0" + esbuild "^0.25.0" + fdir "^6.4.4" + picomatch "^4.0.2" + postcss "^8.5.3" + rollup "^4.34.9" + tinyglobby "^0.2.13" optionalDependencies: fsevents "~2.3.3" From e8e46a438c8a68f8ab48229d8b96bc74cd2160b6 Mon Sep 17 00:00:00 2001 From: Hemachandar <132386067+hmacr@users.noreply.github.com> Date: Sat, 26 Apr 2025 08:48:21 +0530 Subject: [PATCH 15/64] fix: Store Linear workspace logo in storage (#9061) * fix: Store Linear workspace logo in Outline * use async task * Move task into plugin --------- Co-authored-by: Tom Moor <tom@getoutline.com> --- plugins/linear/server/api/linear.ts | 12 ++++- plugins/linear/server/index.ts | 5 ++ .../tasks/UploadLinearWorkspaceLogoTask.ts | 52 +++++++++++++++++++ server/storage/files/BaseStorage.ts | 13 +++-- 4 files changed, 77 insertions(+), 5 deletions(-) create mode 100644 plugins/linear/server/tasks/UploadLinearWorkspaceLogoTask.ts diff --git a/plugins/linear/server/api/linear.ts b/plugins/linear/server/api/linear.ts index 97d47ff85b..033c2fde88 100644 --- a/plugins/linear/server/api/linear.ts +++ b/plugins/linear/server/api/linear.ts @@ -8,6 +8,7 @@ import validate from "@server/middlewares/validate"; import { IntegrationAuthentication, Integration, Team } from "@server/models"; import { APIContext } from "@server/types"; import { Linear } from "../linear"; +import UploadLinearWorkspaceLogoTask from "../tasks/UploadLinearWorkspaceLogoTask"; import * as T from "./schema"; import { LinearUtils } from "plugins/linear/shared/LinearUtils"; @@ -82,7 +83,9 @@ router.get( }, { transaction } ); - await Integration.create<Integration<IntegrationType.Embed>>( + const integration = await Integration.create< + Integration<IntegrationType.Embed> + >( { service: IntegrationService.Linear, type: IntegrationType.Embed, @@ -103,6 +106,13 @@ router.get( { transaction } ); + transaction.afterCommit(async () => { + await UploadLinearWorkspaceLogoTask.schedule({ + integrationId: integration.id, + logoUrl: workspace.logoUrl, + }); + }); + ctx.redirect(LinearUtils.successUrl()); } ); diff --git a/plugins/linear/server/index.ts b/plugins/linear/server/index.ts index 567b5ac168..32d06ce409 100644 --- a/plugins/linear/server/index.ts +++ b/plugins/linear/server/index.ts @@ -4,6 +4,7 @@ import config from "../plugin.json"; import router from "./api/linear"; import env from "./env"; import { Linear } from "./linear"; +import UploadLinearWorkspaceLogoTask from "./tasks/UploadLinearWorkspaceLogoTask"; import { uninstall } from "./uninstall"; const enabled = !!env.LINEAR_CLIENT_ID && !!env.LINEAR_CLIENT_SECRET; @@ -15,6 +16,10 @@ if (enabled) { type: Hook.API, value: router, }, + { + type: Hook.Task, + value: UploadLinearWorkspaceLogoTask, + }, { type: Hook.UnfurlProvider, value: { unfurl: Linear.unfurl, cacheExpiry: Minute.seconds }, diff --git a/plugins/linear/server/tasks/UploadLinearWorkspaceLogoTask.ts b/plugins/linear/server/tasks/UploadLinearWorkspaceLogoTask.ts new file mode 100644 index 0000000000..30529300c3 --- /dev/null +++ b/plugins/linear/server/tasks/UploadLinearWorkspaceLogoTask.ts @@ -0,0 +1,52 @@ +import { v4 as uuidv4 } from "uuid"; +import { IntegrationService, IntegrationType } from "@shared/types"; +import { Integration } from "@server/models"; +import { Buckets } from "@server/models/helpers/AttachmentHelper"; +import BaseTask, { TaskPriority } from "@server/queues/tasks/BaseTask"; +import FileStorage from "@server/storage/files"; + +type Props = { + /** The integrationId to operate on */ + integrationId: string; + /** The original logoUrl from Linear */ + logoUrl: string; +}; + +/** + * A task that uploads the provided logoUrl to storage and updates the + * Linear integration record with the new url. + */ +export default class UploadLinearWorkspaceLogoTask extends BaseTask<Props> { + public async perform(props: Props) { + const integration = await Integration.scope("withAuthentication").findByPk< + Integration<IntegrationType.Embed> + >(props.integrationId); + if (!integration || integration.service !== IntegrationService.Linear) { + return; + } + + const res = await FileStorage.storeFromUrl( + props.logoUrl, + `${Buckets.avatars}/${integration.teamId}/${uuidv4()}`, + "public-read", + { + headers: { + Authorization: `Bearer ${integration.authentication.token}`, + }, + } + ); + + if (res?.url) { + integration.settings.linear!.workspace.logoUrl = res.url; + integration.changed("settings", true); + await integration.save(); + } + } + + public get options() { + return { + attempts: 3, + priority: TaskPriority.Normal, + }; + } +} diff --git a/server/storage/files/BaseStorage.ts b/server/storage/files/BaseStorage.ts index d8ddbebb8a..0753142780 100644 --- a/server/storage/files/BaseStorage.ts +++ b/server/storage/files/BaseStorage.ts @@ -1,6 +1,7 @@ import { Blob } from "buffer"; import { Readable } from "stream"; import { PresignedPost } from "@aws-sdk/s3-presigned-post"; +import omit from "lodash/omit"; import FileHelper from "@shared/editor/lib/FileHelper"; import { isBase64Url, isInternalUrl } from "@shared/utils/urls"; import env from "@server/env"; @@ -162,6 +163,12 @@ export default abstract class BaseStorage { buffer = Buffer.from(match[2], "base64"); } else { try { + const headers = { + "User-Agent": chromeUserAgent, + ...init?.headers, + }; + const initWithoutHeaders = omit(init, ["headers"]); + const res = await fetch(url, { follow: 3, redirect: "follow", @@ -169,11 +176,9 @@ export default abstract class BaseStorage { options?.maxUploadSize ?? Infinity, env.FILE_STORAGE_UPLOAD_MAX_SIZE ), - headers: { - "User-Agent": chromeUserAgent, - }, + headers, timeout: 10000, - ...init, + ...initWithoutHeaders, }); if (!res.ok) { From 2bc47cfcef581f7736cebaf07ebac46280126364 Mon Sep 17 00:00:00 2001 From: Tom Moor <tom@getoutline.com> Date: Sat, 26 Apr 2025 08:27:45 -0400 Subject: [PATCH 16/64] Add recency boost to search results (#9038) * Add recency boost to search helpers * Restore tests * Use boost --- plugins/slack/server/api/hooks.ts | 3 + server/models/helpers/SearchHelper.test.ts | 288 +++++++++++++++++---- server/models/helpers/SearchHelper.ts | 60 ++++- server/routes/api/documents/documents.ts | 3 + 4 files changed, 293 insertions(+), 61 deletions(-) diff --git a/plugins/slack/server/api/hooks.ts b/plugins/slack/server/api/hooks.ts index f280673265..9b88c42348 100644 --- a/plugins/slack/server/api/hooks.ts +++ b/plugins/slack/server/api/hooks.ts @@ -227,6 +227,9 @@ router.post( const options = { query: text, limit: 5, + searchConfig: { + boostRecent: true, + }, }; if (!user) { diff --git a/server/models/helpers/SearchHelper.test.ts b/server/models/helpers/SearchHelper.test.ts index e5f21f1441..15836f2f15 100644 --- a/server/models/helpers/SearchHelper.test.ts +++ b/server/models/helpers/SearchHelper.test.ts @@ -1,23 +1,25 @@ +import { describe, expect } from "@jest/globals"; +import { subMonths } from "date-fns"; import { DocumentPermission, StatusFilter } from "@shared/types"; -import SearchHelper from "@server/models/helpers/SearchHelper"; import { - buildDocument, - buildDraftDocument, - buildCollection, buildTeam, buildUser, + buildCollection, + buildDocument, + buildDraftDocument, buildShare, } from "@server/test/factories"; import UserMembership from "../UserMembership"; - -beforeEach(async () => { - jest.resetAllMocks(); - await buildDocument(); -}); +import SearchHelper from "./SearchHelper"; describe("SearchHelper", () => { describe("#searchForTeam", () => { - test("should return search results from public collections", async () => { + beforeEach(async () => { + jest.resetAllMocks(); + await buildDocument(); + }); + + it("should return search results from public collections", async () => { const team = await buildTeam(); const collection = await buildCollection({ teamId: team.id, @@ -34,7 +36,7 @@ describe("SearchHelper", () => { expect(results[0].document?.id).toBe(document.id); }); - test("should return search results from a collection without search term", async () => { + it("should return search results from a collection without search term", async () => { const team = await buildTeam(); const collection = await buildCollection({ teamId: team.id, @@ -58,7 +60,7 @@ describe("SearchHelper", () => { ); }); - test("should not return results from private collections without providing collectionId", async () => { + it("should not return results from private collections without providing collectionId", async () => { const team = await buildTeam(); const collection = await buildCollection({ permission: null, @@ -75,7 +77,7 @@ describe("SearchHelper", () => { expect(results.length).toBe(0); }); - test("should return results from private collections when collectionId is provided", async () => { + it("should return results from private collections when collectionId is provided", async () => { const team = await buildTeam(); const collection = await buildCollection({ permission: null, @@ -93,7 +95,7 @@ describe("SearchHelper", () => { expect(results.length).toBe(1); }); - test("should return results from document tree of shared document", async () => { + it("should return results from document tree of shared document", async () => { const team = await buildTeam(); const collection = await buildCollection({ permission: null, @@ -123,7 +125,7 @@ describe("SearchHelper", () => { expect(results.length).toBe(1); }); - test("should handle no collections", async () => { + it("should handle no collections", async () => { const team = await buildTeam(); const { results } = await SearchHelper.searchForTeam(team, { query: "test", @@ -131,7 +133,7 @@ describe("SearchHelper", () => { expect(results.length).toBe(0); }); - test("should handle backslashes in search term", async () => { + it("should handle backslashes in search term", async () => { const team = await buildTeam(); const { results } = await SearchHelper.searchForTeam(team, { query: "\\\\", @@ -139,7 +141,7 @@ describe("SearchHelper", () => { expect(results.length).toBe(0); }); - test("should return the total count of search results", async () => { + it("should return the total count of search results", async () => { const team = await buildTeam(); const collection = await buildCollection({ teamId: team.id, @@ -160,7 +162,7 @@ describe("SearchHelper", () => { expect(total).toBe(2); }); - test("should return the document when searched with their previous titles", async () => { + it("should return the document when searched with their previous titles", async () => { const team = await buildTeam(); const collection = await buildCollection({ teamId: team.id, @@ -178,7 +180,7 @@ describe("SearchHelper", () => { expect(total).toBe(1); }); - test("should not return the document when searched with neither the titles nor the previous titles", async () => { + it("should not return the document when searched with neither the titles nor the previous titles", async () => { const team = await buildTeam(); const collection = await buildCollection({ teamId: team.id, @@ -198,7 +200,12 @@ describe("SearchHelper", () => { }); describe("#searchForUser", () => { - test("should return search results from collections", async () => { + beforeEach(async () => { + jest.resetAllMocks(); + await buildDocument(); + }); + + it("should return search results from collections", async () => { const team = await buildTeam(); const user = await buildUser({ teamId: team.id }); const collection = await buildCollection({ @@ -226,7 +233,7 @@ describe("SearchHelper", () => { expect(results[0].document?.id).toBe(document.id); }); - test("should return search results for a user without search term", async () => { + it("should return search results for a user without search term", async () => { const team = await buildTeam(); const user = await buildUser({ teamId: team.id }); const collection = await buildCollection({ @@ -254,7 +261,7 @@ describe("SearchHelper", () => { ); }); - test("should return search results from a collection without search term", async () => { + it("should return search results from a collection without search term", async () => { const team = await buildTeam(); const user = await buildUser({ teamId: team.id }); const collection = await buildCollection({ @@ -284,7 +291,7 @@ describe("SearchHelper", () => { ); }); - test("should handle no collections", async () => { + it("should handle no collections", async () => { const team = await buildTeam(); const user = await buildUser({ teamId: team.id }); const { results } = await SearchHelper.searchForUser(user, { @@ -293,7 +300,7 @@ describe("SearchHelper", () => { expect(results.length).toBe(0); }); - test("should search only drafts created by user", async () => { + it("should search only drafts created by user", async () => { const user = await buildUser(); await buildDraftDocument({ title: "test", @@ -324,7 +331,7 @@ describe("SearchHelper", () => { expect(results.length).toBe(1); }); - test("should not include drafts with user read permission", async () => { + it("should not include drafts with user read permission", async () => { const user = await buildUser(); await buildDraftDocument({ title: "test", @@ -349,7 +356,7 @@ describe("SearchHelper", () => { expect(results.length).toBe(0); }); - test("should search only published created by user", async () => { + it("should search only published created by user", async () => { const user = await buildUser(); await buildDocument({ title: "test", @@ -380,7 +387,7 @@ describe("SearchHelper", () => { expect(results.length).toBe(1); }); - test("should search only archived documents created by user", async () => { + it("should search only archived documents created by user", async () => { const user = await buildUser(); await buildDocument({ title: "test", @@ -417,7 +424,7 @@ describe("SearchHelper", () => { expect(results.length).toBe(1); }); - test("should return results from archived and published", async () => { + it("should return results from archived and published", async () => { const user = await buildUser(); await buildDraftDocument({ teamId: user.teamId, @@ -445,7 +452,7 @@ describe("SearchHelper", () => { expect(results.length).toBe(2); }); - test("should return results from drafts and published", async () => { + it("should return results from drafts and published", async () => { const user = await buildUser(); await buildDocument({ userId: user.id, @@ -473,7 +480,7 @@ describe("SearchHelper", () => { expect(results.length).toBe(2); }); - test("should include results from drafts and archived", async () => { + it("should include results from drafts and archived", async () => { const user = await buildUser(); await buildDocument({ userId: user.id, @@ -501,7 +508,7 @@ describe("SearchHelper", () => { expect(results.length).toBe(2); }); - test("should return the total count of search results", async () => { + it("should return the total count of search results", async () => { const team = await buildTeam(); const user = await buildUser({ teamId: team.id }); const collection = await buildCollection({ @@ -526,7 +533,7 @@ describe("SearchHelper", () => { expect(total).toBe(2); }); - test("should return the document when searched with their previous titles", async () => { + it("should return the document when searched with their previous titles", async () => { const team = await buildTeam(); const user = await buildUser({ teamId: team.id }); const collection = await buildCollection({ @@ -547,7 +554,7 @@ describe("SearchHelper", () => { expect(total).toBe(1); }); - test("should not return the document when searched with neither the titles nor the previous titles", async () => { + it("should not return the document when searched with neither the titles nor the previous titles", async () => { const team = await buildTeam(); const user = await buildUser({ teamId: team.id }); const collection = await buildCollection({ @@ -568,7 +575,7 @@ describe("SearchHelper", () => { expect(total).toBe(0); }); - test("should find exact phrases", async () => { + it("should find exact phrases", async () => { const team = await buildTeam(); const user = await buildUser({ teamId: team.id }); const collection = await buildCollection({ @@ -589,7 +596,7 @@ describe("SearchHelper", () => { expect(total).toBe(1); }); - test("should correctly handle removal of trailing spaces", async () => { + it("should correctly handle removal of trailing spaces", async () => { const team = await buildTeam(); const user = await buildUser({ teamId: team.id }); const collection = await buildCollection({ @@ -612,7 +619,12 @@ describe("SearchHelper", () => { }); describe("#searchTitlesForUser", () => { - test("should return search results from collections", async () => { + beforeEach(async () => { + jest.resetAllMocks(); + await buildDocument(); + }); + + it("should return search results from collections", async () => { const team = await buildTeam(); const user = await buildUser({ teamId: team.id }); const collection = await buildCollection({ @@ -632,7 +644,7 @@ describe("SearchHelper", () => { expect(documents[0]?.id).toBe(document.id); }); - test("should filter to specific collection", async () => { + it("should filter to specific collection", async () => { const team = await buildTeam(); const user = await buildUser({ teamId: team.id }); const collection = await buildCollection({ @@ -668,7 +680,7 @@ describe("SearchHelper", () => { expect(documents[0]?.id).toBe(document.id); }); - test("should handle no collections", async () => { + it("should handle no collections", async () => { const team = await buildTeam(); const user = await buildUser({ teamId: team.id }); const documents = await SearchHelper.searchTitlesForUser(user, { @@ -677,7 +689,7 @@ describe("SearchHelper", () => { expect(documents.length).toBe(0); }); - test("should search only drafts created by user", async () => { + it("should search only drafts created by user", async () => { const user = await buildUser(); await buildDraftDocument({ title: "test", @@ -708,7 +720,7 @@ describe("SearchHelper", () => { expect(documents.length).toBe(1); }); - test("should search only published created by user", async () => { + it("should search only published created by user", async () => { const user = await buildUser(); await buildDocument({ title: "test", @@ -739,7 +751,7 @@ describe("SearchHelper", () => { expect(documents.length).toBe(1); }); - test("should search only archived documents created by user", async () => { + it("should search only archived documents created by user", async () => { const user = await buildUser(); await buildDocument({ title: "test", @@ -776,7 +788,7 @@ describe("SearchHelper", () => { expect(documents.length).toBe(1); }); - test("should return results from archived and published", async () => { + it("should return results from archived and published", async () => { const user = await buildUser(); await buildDraftDocument({ teamId: user.teamId, @@ -804,7 +816,7 @@ describe("SearchHelper", () => { expect(documents.length).toBe(2); }); - test("should return results from drafts and published", async () => { + it("should return results from drafts and published", async () => { const user = await buildUser(); await buildDocument({ userId: user.id, @@ -832,7 +844,7 @@ describe("SearchHelper", () => { expect(documents.length).toBe(2); }); - test("should include results from drafts and archived", async () => { + it("should include results from drafts and archived", async () => { const user = await buildUser(); await buildDocument({ userId: user.id, @@ -862,7 +874,12 @@ describe("SearchHelper", () => { }); describe("#searchCollectionsForUser", () => { - test("should return search results from collections", async () => { + beforeEach(async () => { + jest.resetAllMocks(); + await buildDocument(); + }); + + it("should return search results from collections", async () => { const team = await buildTeam(); const user = await buildUser({ teamId: team.id }); const collection1 = await buildCollection({ @@ -884,7 +901,7 @@ describe("SearchHelper", () => { expect(results[0].id).toBe(collection1.id); }); - test("should return all collections when no query provided", async () => { + it("should return all collections when no query provided", async () => { const team = await buildTeam(); const user = await buildUser({ teamId: team.id }); const collection1 = await buildCollection({ @@ -907,25 +924,196 @@ describe("SearchHelper", () => { }); describe("webSearchQuery", () => { - test("should correctly sanitize query", () => { + it("should correctly sanitize query", () => { expect(SearchHelper.webSearchQuery("one/two")).toBe("one/two:*"); expect(SearchHelper.webSearchQuery("one\\two")).toBe("one\\\\two:*"); expect(SearchHelper.webSearchQuery("test''")).toBe("test"); }); - test("should wildcard unquoted queries", () => { + it("should wildcard unquoted queries", () => { expect(SearchHelper.webSearchQuery("test")).toBe("test:*"); expect(SearchHelper.webSearchQuery("'")).toBe(""); expect(SearchHelper.webSearchQuery("'quoted'")).toBe(`"quoted":*`); }); - test("should wildcard multi-word queries", () => { + it("should wildcard multi-word queries", () => { expect(SearchHelper.webSearchQuery("this is a test")).toBe( "this&is&a&test:*" ); }); - test("should not wildcard quoted queries", () => { + it("should not wildcard quoted queries", () => { expect(SearchHelper.webSearchQuery(`"this is a test"`)).toBe( `"this<->is<->a<->test"` ); }); }); + + describe("searchConfig", () => { + it("should boost recent documents when boostRecentMonths is set", async () => { + const team = await buildTeam(); + const user = await buildUser({ teamId: team.id }); + const collection = await buildCollection({ teamId: team.id }); + const now = new Date(); + + const recentDoc = await buildDocument({ + teamId: team.id, + collectionId: collection.id, + title: "test document recent", + text: "test search term recent", + }); + + // Set date 4 months ago + const olderDoc = await buildDocument({ + teamId: team.id, + collectionId: collection.id, + title: "test document older", + text: "test search term older test", + createdAt: subMonths(now, 4), + updatedAt: subMonths(now, 4), + }); + + // Search without recency boost + const resultsWithoutBoost = await SearchHelper.searchForUser(user, { + query: "test search term", + }); + + // Search with recency boost + const resultsWithBoost = await SearchHelper.searchForUser(user, { + query: "test search term", + searchConfig: { + boostRecent: true, + boostRecentMonths: 6, + maxRecentBoost: 2.0, + }, + }); + + // Without boost, documents should be ordered by base relevance + expect(resultsWithoutBoost.results.length).toBe(2); + expect(resultsWithoutBoost.results[0].document.id).toBe(olderDoc.id); + expect(resultsWithoutBoost.results[1].document.id).toBe(recentDoc.id); + + // With boost, recent document should be ranked higher + expect(resultsWithBoost.results.length).toBe(2); + expect(resultsWithBoost.results[0].document.id).toBe(recentDoc.id); + expect(resultsWithBoost.results[1].document.id).toBe(olderDoc.id); + + // Recent document should have higher ranking + expect(resultsWithBoost.results[0].ranking).toBeGreaterThan( + resultsWithBoost.results[1].ranking + ); + }); + + it("should respect different time windows", async () => { + const team = await buildTeam(); + const user = await buildUser({ teamId: team.id }); + const collection = await buildCollection({ teamId: team.id }); + const now = new Date(); + + const recentDoc = await buildDocument({ + teamId: team.id, + collectionId: collection.id, + title: "test document recent", + text: "test search term recent", + }); + + // Set date 2 months ago + const twoMonthOldDoc = await buildDocument({ + teamId: team.id, + collectionId: collection.id, + title: "test document two months", + text: "test search term two months", + createdAt: subMonths(now, 2), + updatedAt: subMonths(now, 2), + }); + + // Search with 1-month window + const resultsShortWindow = await SearchHelper.searchForUser(user, { + query: "test search term", + searchConfig: { + boostRecent: true, + boostRecentMonths: 1, + maxRecentBoost: 2.0, + }, + }); + + // Search with 3-month window + const resultsLongWindow = await SearchHelper.searchForUser(user, { + query: "test search term", + searchConfig: { + boostRecentMonths: 3, + maxRecentBoost: 2.0, + }, + }); + + // With 1-month window, two-month-old doc should have no boost + expect(resultsShortWindow.results[0].document.id).toBe(recentDoc.id); + expect(resultsShortWindow.results[1].document.id).toBe(twoMonthOldDoc.id); + expect(resultsShortWindow.results[0].ranking).toBeGreaterThan( + resultsShortWindow.results[1].ranking * 1.5 + ); + + // With 3-month window, two-month-old doc should have some boost + expect(resultsLongWindow.results[0].document.id).toBe(recentDoc.id); + expect(resultsLongWindow.results[1].document.id).toBe(twoMonthOldDoc.id); + const rankingRatio = + resultsLongWindow.results[0].ranking / + resultsLongWindow.results[1].ranking; + expect(rankingRatio).toBeLessThan(1.5); + expect(rankingRatio).toBeGreaterThan(1.0); + }); + + it("should respect custom boost factor", async () => { + const team = await buildTeam(); + const user = await buildUser({ teamId: team.id }); + const collection = await buildCollection({ teamId: team.id }); + const now = new Date(); + + const recentDoc = await buildDocument({ + teamId: team.id, + collectionId: collection.id, + title: "test document recent", + text: "test search term recent", + }); + + // Set date 2 months ago + await buildDocument({ + teamId: team.id, + collectionId: collection.id, + title: "test document older", + text: "test search term older", + createdAt: subMonths(now, 2), + updatedAt: subMonths(now, 2), + }); + + // Search with low boost factor + const resultsLowBoost = await SearchHelper.searchForUser(user, { + query: "test search term", + searchConfig: { + boostRecent: true, + boostRecentMonths: 6, + maxRecentBoost: 1.2, + }, + }); + + // Search with high boost factor + const resultsHighBoost = await SearchHelper.searchForUser(user, { + query: "test search term", + searchConfig: { + boostRecent: true, + boostRecentMonths: 6, + maxRecentBoost: 3.0, + }, + }); + + // Both searches should rank recent document higher + expect(resultsLowBoost.results[0].document.id).toBe(recentDoc.id); + expect(resultsHighBoost.results[0].document.id).toBe(recentDoc.id); + + // High boost should have greater difference in rankings + const lowBoostRatio = + resultsLowBoost.results[0].ranking / resultsLowBoost.results[1].ranking; + const highBoostRatio = + resultsHighBoost.results[0].ranking / + resultsHighBoost.results[1].ranking; + expect(highBoostRatio).toBeGreaterThan(lowBoostRatio); + }); + }); }); diff --git a/server/models/helpers/SearchHelper.ts b/server/models/helpers/SearchHelper.ts index e8a85d83b0..c4759c97aa 100644 --- a/server/models/helpers/SearchHelper.ts +++ b/server/models/helpers/SearchHelper.ts @@ -37,6 +37,14 @@ type SearchResponse = { total: number; }; +type SearchConfig = { + boostRecent?: boolean; + /** Time window in months for recent content boosting. When set, enables recency boosting. */ + boostRecentMonths?: number; + /** Maximum boost multiplier for recent content */ + maxRecentBoost?: number; +}; + type SearchOptions = { /** The query limit for pagination */ limit?: number; @@ -60,6 +68,8 @@ type SearchOptions = { snippetMinWords?: number; /** The maximum number of words to be returned in the contextual snippet */ snippetMaxWords?: number; + /** Configuration for search behavior */ + searchConfig?: SearchConfig; }; type RankedDocument = Document & { @@ -79,7 +89,7 @@ export default class SearchHelper { team: Team, options: SearchOptions = {} ): Promise<SearchResponse> { - const { limit = 15, offset = 0, query } = options; + const { limit = 15, offset = 0, query, searchConfig } = options; const where = await this.buildWhere(team, { ...options, @@ -101,7 +111,7 @@ export default class SearchHelper { }); } - const findOptions = this.buildFindOptions(query); + const findOptions = this.buildFindOptions(query, searchConfig); try { const resultsQuery = Document.unscoped().findAll({ @@ -236,11 +246,11 @@ export default class SearchHelper { user: User, options: SearchOptions = {} ): Promise<SearchResponse> { - const { limit = 15, offset = 0, query } = options; + const { limit = 15, offset = 0, query, searchConfig } = options; const where = await this.buildWhere(user, options); - const findOptions = this.buildFindOptions(query); + const findOptions = this.buildFindOptions(query, searchConfig); const include = [ { @@ -309,18 +319,46 @@ export default class SearchHelper { } } - private static buildFindOptions(query?: string): FindOptions { + private static buildFindOptions( + query?: string, + searchConfig?: SearchConfig + ): FindOptions { const attributes: FindAttributeOptions = ["id"]; const replacements: BindOrReplacements = {}; const order: Order = [["updatedAt", "DESC"]]; if (query) { - attributes.push([ - Sequelize.literal( - `ts_rank("searchVector", to_tsquery('english', :query))` - ), - "searchRanking", - ]); + // Default values for recency boosting + const boostRecent = searchConfig?.boostRecent ?? false; + const boostRecentMonths = searchConfig?.boostRecentMonths ?? 2; + const maxRecentBoost = searchConfig?.maxRecentBoost ?? 2.0; + + if (boostRecent) { + // Calculate ranking with recency boost + // The formula creates a multiplier between 1.0 and maxRecentBoost based on document age + attributes.push([ + Sequelize.literal( + `( + ts_rank("searchVector", to_tsquery('english', :query)) * + (1 + (LEAST( + ${maxRecentBoost - 1}, + (1 - EXTRACT(EPOCH FROM (NOW() - document."updatedAt")) / + EXTRACT(EPOCH FROM INTERVAL '${boostRecentMonths} months')) + ) * ${maxRecentBoost})) + )` + ), + "searchRanking", + ]); + } else { + // Original ranking without recency boost + attributes.push([ + Sequelize.literal( + `ts_rank("searchVector", to_tsquery('english', :query))` + ), + "searchRanking", + ]); + } + replacements["query"] = this.webSearchQuery(query); order.unshift(["searchRanking", "DESC"]); } diff --git a/server/routes/api/documents/documents.ts b/server/routes/api/documents/documents.ts index a6a015c134..55b8cb2a59 100644 --- a/server/routes/api/documents/documents.ts +++ b/server/routes/api/documents/documents.ts @@ -1060,6 +1060,9 @@ router.post( limit, snippetMinWords, snippetMaxWords, + searchConfig: { + boostRecent: true, + }, }); } From 7e05fc101727a1d314b8ea11710b3aa7ab269739 Mon Sep 17 00:00:00 2001 From: Tom Moor <tom@getoutline.com> Date: Sat, 26 Apr 2025 12:44:49 -0400 Subject: [PATCH 17/64] Revert "Add recency boost to search results (#9038)" (#9065) This reverts commit 2bc47cfcef581f7736cebaf07ebac46280126364. --- plugins/slack/server/api/hooks.ts | 3 - server/models/helpers/SearchHelper.test.ts | 288 ++++----------------- server/models/helpers/SearchHelper.ts | 60 +---- server/routes/api/documents/documents.ts | 3 - 4 files changed, 61 insertions(+), 293 deletions(-) diff --git a/plugins/slack/server/api/hooks.ts b/plugins/slack/server/api/hooks.ts index 9b88c42348..f280673265 100644 --- a/plugins/slack/server/api/hooks.ts +++ b/plugins/slack/server/api/hooks.ts @@ -227,9 +227,6 @@ router.post( const options = { query: text, limit: 5, - searchConfig: { - boostRecent: true, - }, }; if (!user) { diff --git a/server/models/helpers/SearchHelper.test.ts b/server/models/helpers/SearchHelper.test.ts index 15836f2f15..e5f21f1441 100644 --- a/server/models/helpers/SearchHelper.test.ts +++ b/server/models/helpers/SearchHelper.test.ts @@ -1,25 +1,23 @@ -import { describe, expect } from "@jest/globals"; -import { subMonths } from "date-fns"; import { DocumentPermission, StatusFilter } from "@shared/types"; +import SearchHelper from "@server/models/helpers/SearchHelper"; import { - buildTeam, - buildUser, - buildCollection, buildDocument, buildDraftDocument, + buildCollection, + buildTeam, + buildUser, buildShare, } from "@server/test/factories"; import UserMembership from "../UserMembership"; -import SearchHelper from "./SearchHelper"; + +beforeEach(async () => { + jest.resetAllMocks(); + await buildDocument(); +}); describe("SearchHelper", () => { describe("#searchForTeam", () => { - beforeEach(async () => { - jest.resetAllMocks(); - await buildDocument(); - }); - - it("should return search results from public collections", async () => { + test("should return search results from public collections", async () => { const team = await buildTeam(); const collection = await buildCollection({ teamId: team.id, @@ -36,7 +34,7 @@ describe("SearchHelper", () => { expect(results[0].document?.id).toBe(document.id); }); - it("should return search results from a collection without search term", async () => { + test("should return search results from a collection without search term", async () => { const team = await buildTeam(); const collection = await buildCollection({ teamId: team.id, @@ -60,7 +58,7 @@ describe("SearchHelper", () => { ); }); - it("should not return results from private collections without providing collectionId", async () => { + test("should not return results from private collections without providing collectionId", async () => { const team = await buildTeam(); const collection = await buildCollection({ permission: null, @@ -77,7 +75,7 @@ describe("SearchHelper", () => { expect(results.length).toBe(0); }); - it("should return results from private collections when collectionId is provided", async () => { + test("should return results from private collections when collectionId is provided", async () => { const team = await buildTeam(); const collection = await buildCollection({ permission: null, @@ -95,7 +93,7 @@ describe("SearchHelper", () => { expect(results.length).toBe(1); }); - it("should return results from document tree of shared document", async () => { + test("should return results from document tree of shared document", async () => { const team = await buildTeam(); const collection = await buildCollection({ permission: null, @@ -125,7 +123,7 @@ describe("SearchHelper", () => { expect(results.length).toBe(1); }); - it("should handle no collections", async () => { + test("should handle no collections", async () => { const team = await buildTeam(); const { results } = await SearchHelper.searchForTeam(team, { query: "test", @@ -133,7 +131,7 @@ describe("SearchHelper", () => { expect(results.length).toBe(0); }); - it("should handle backslashes in search term", async () => { + test("should handle backslashes in search term", async () => { const team = await buildTeam(); const { results } = await SearchHelper.searchForTeam(team, { query: "\\\\", @@ -141,7 +139,7 @@ describe("SearchHelper", () => { expect(results.length).toBe(0); }); - it("should return the total count of search results", async () => { + test("should return the total count of search results", async () => { const team = await buildTeam(); const collection = await buildCollection({ teamId: team.id, @@ -162,7 +160,7 @@ describe("SearchHelper", () => { expect(total).toBe(2); }); - it("should return the document when searched with their previous titles", async () => { + test("should return the document when searched with their previous titles", async () => { const team = await buildTeam(); const collection = await buildCollection({ teamId: team.id, @@ -180,7 +178,7 @@ describe("SearchHelper", () => { expect(total).toBe(1); }); - it("should not return the document when searched with neither the titles nor the previous titles", async () => { + test("should not return the document when searched with neither the titles nor the previous titles", async () => { const team = await buildTeam(); const collection = await buildCollection({ teamId: team.id, @@ -200,12 +198,7 @@ describe("SearchHelper", () => { }); describe("#searchForUser", () => { - beforeEach(async () => { - jest.resetAllMocks(); - await buildDocument(); - }); - - it("should return search results from collections", async () => { + test("should return search results from collections", async () => { const team = await buildTeam(); const user = await buildUser({ teamId: team.id }); const collection = await buildCollection({ @@ -233,7 +226,7 @@ describe("SearchHelper", () => { expect(results[0].document?.id).toBe(document.id); }); - it("should return search results for a user without search term", async () => { + test("should return search results for a user without search term", async () => { const team = await buildTeam(); const user = await buildUser({ teamId: team.id }); const collection = await buildCollection({ @@ -261,7 +254,7 @@ describe("SearchHelper", () => { ); }); - it("should return search results from a collection without search term", async () => { + test("should return search results from a collection without search term", async () => { const team = await buildTeam(); const user = await buildUser({ teamId: team.id }); const collection = await buildCollection({ @@ -291,7 +284,7 @@ describe("SearchHelper", () => { ); }); - it("should handle no collections", async () => { + test("should handle no collections", async () => { const team = await buildTeam(); const user = await buildUser({ teamId: team.id }); const { results } = await SearchHelper.searchForUser(user, { @@ -300,7 +293,7 @@ describe("SearchHelper", () => { expect(results.length).toBe(0); }); - it("should search only drafts created by user", async () => { + test("should search only drafts created by user", async () => { const user = await buildUser(); await buildDraftDocument({ title: "test", @@ -331,7 +324,7 @@ describe("SearchHelper", () => { expect(results.length).toBe(1); }); - it("should not include drafts with user read permission", async () => { + test("should not include drafts with user read permission", async () => { const user = await buildUser(); await buildDraftDocument({ title: "test", @@ -356,7 +349,7 @@ describe("SearchHelper", () => { expect(results.length).toBe(0); }); - it("should search only published created by user", async () => { + test("should search only published created by user", async () => { const user = await buildUser(); await buildDocument({ title: "test", @@ -387,7 +380,7 @@ describe("SearchHelper", () => { expect(results.length).toBe(1); }); - it("should search only archived documents created by user", async () => { + test("should search only archived documents created by user", async () => { const user = await buildUser(); await buildDocument({ title: "test", @@ -424,7 +417,7 @@ describe("SearchHelper", () => { expect(results.length).toBe(1); }); - it("should return results from archived and published", async () => { + test("should return results from archived and published", async () => { const user = await buildUser(); await buildDraftDocument({ teamId: user.teamId, @@ -452,7 +445,7 @@ describe("SearchHelper", () => { expect(results.length).toBe(2); }); - it("should return results from drafts and published", async () => { + test("should return results from drafts and published", async () => { const user = await buildUser(); await buildDocument({ userId: user.id, @@ -480,7 +473,7 @@ describe("SearchHelper", () => { expect(results.length).toBe(2); }); - it("should include results from drafts and archived", async () => { + test("should include results from drafts and archived", async () => { const user = await buildUser(); await buildDocument({ userId: user.id, @@ -508,7 +501,7 @@ describe("SearchHelper", () => { expect(results.length).toBe(2); }); - it("should return the total count of search results", async () => { + test("should return the total count of search results", async () => { const team = await buildTeam(); const user = await buildUser({ teamId: team.id }); const collection = await buildCollection({ @@ -533,7 +526,7 @@ describe("SearchHelper", () => { expect(total).toBe(2); }); - it("should return the document when searched with their previous titles", async () => { + test("should return the document when searched with their previous titles", async () => { const team = await buildTeam(); const user = await buildUser({ teamId: team.id }); const collection = await buildCollection({ @@ -554,7 +547,7 @@ describe("SearchHelper", () => { expect(total).toBe(1); }); - it("should not return the document when searched with neither the titles nor the previous titles", async () => { + test("should not return the document when searched with neither the titles nor the previous titles", async () => { const team = await buildTeam(); const user = await buildUser({ teamId: team.id }); const collection = await buildCollection({ @@ -575,7 +568,7 @@ describe("SearchHelper", () => { expect(total).toBe(0); }); - it("should find exact phrases", async () => { + test("should find exact phrases", async () => { const team = await buildTeam(); const user = await buildUser({ teamId: team.id }); const collection = await buildCollection({ @@ -596,7 +589,7 @@ describe("SearchHelper", () => { expect(total).toBe(1); }); - it("should correctly handle removal of trailing spaces", async () => { + test("should correctly handle removal of trailing spaces", async () => { const team = await buildTeam(); const user = await buildUser({ teamId: team.id }); const collection = await buildCollection({ @@ -619,12 +612,7 @@ describe("SearchHelper", () => { }); describe("#searchTitlesForUser", () => { - beforeEach(async () => { - jest.resetAllMocks(); - await buildDocument(); - }); - - it("should return search results from collections", async () => { + test("should return search results from collections", async () => { const team = await buildTeam(); const user = await buildUser({ teamId: team.id }); const collection = await buildCollection({ @@ -644,7 +632,7 @@ describe("SearchHelper", () => { expect(documents[0]?.id).toBe(document.id); }); - it("should filter to specific collection", async () => { + test("should filter to specific collection", async () => { const team = await buildTeam(); const user = await buildUser({ teamId: team.id }); const collection = await buildCollection({ @@ -680,7 +668,7 @@ describe("SearchHelper", () => { expect(documents[0]?.id).toBe(document.id); }); - it("should handle no collections", async () => { + test("should handle no collections", async () => { const team = await buildTeam(); const user = await buildUser({ teamId: team.id }); const documents = await SearchHelper.searchTitlesForUser(user, { @@ -689,7 +677,7 @@ describe("SearchHelper", () => { expect(documents.length).toBe(0); }); - it("should search only drafts created by user", async () => { + test("should search only drafts created by user", async () => { const user = await buildUser(); await buildDraftDocument({ title: "test", @@ -720,7 +708,7 @@ describe("SearchHelper", () => { expect(documents.length).toBe(1); }); - it("should search only published created by user", async () => { + test("should search only published created by user", async () => { const user = await buildUser(); await buildDocument({ title: "test", @@ -751,7 +739,7 @@ describe("SearchHelper", () => { expect(documents.length).toBe(1); }); - it("should search only archived documents created by user", async () => { + test("should search only archived documents created by user", async () => { const user = await buildUser(); await buildDocument({ title: "test", @@ -788,7 +776,7 @@ describe("SearchHelper", () => { expect(documents.length).toBe(1); }); - it("should return results from archived and published", async () => { + test("should return results from archived and published", async () => { const user = await buildUser(); await buildDraftDocument({ teamId: user.teamId, @@ -816,7 +804,7 @@ describe("SearchHelper", () => { expect(documents.length).toBe(2); }); - it("should return results from drafts and published", async () => { + test("should return results from drafts and published", async () => { const user = await buildUser(); await buildDocument({ userId: user.id, @@ -844,7 +832,7 @@ describe("SearchHelper", () => { expect(documents.length).toBe(2); }); - it("should include results from drafts and archived", async () => { + test("should include results from drafts and archived", async () => { const user = await buildUser(); await buildDocument({ userId: user.id, @@ -874,12 +862,7 @@ describe("SearchHelper", () => { }); describe("#searchCollectionsForUser", () => { - beforeEach(async () => { - jest.resetAllMocks(); - await buildDocument(); - }); - - it("should return search results from collections", async () => { + test("should return search results from collections", async () => { const team = await buildTeam(); const user = await buildUser({ teamId: team.id }); const collection1 = await buildCollection({ @@ -901,7 +884,7 @@ describe("SearchHelper", () => { expect(results[0].id).toBe(collection1.id); }); - it("should return all collections when no query provided", async () => { + test("should return all collections when no query provided", async () => { const team = await buildTeam(); const user = await buildUser({ teamId: team.id }); const collection1 = await buildCollection({ @@ -924,196 +907,25 @@ describe("SearchHelper", () => { }); describe("webSearchQuery", () => { - it("should correctly sanitize query", () => { + test("should correctly sanitize query", () => { expect(SearchHelper.webSearchQuery("one/two")).toBe("one/two:*"); expect(SearchHelper.webSearchQuery("one\\two")).toBe("one\\\\two:*"); expect(SearchHelper.webSearchQuery("test''")).toBe("test"); }); - it("should wildcard unquoted queries", () => { + test("should wildcard unquoted queries", () => { expect(SearchHelper.webSearchQuery("test")).toBe("test:*"); expect(SearchHelper.webSearchQuery("'")).toBe(""); expect(SearchHelper.webSearchQuery("'quoted'")).toBe(`"quoted":*`); }); - it("should wildcard multi-word queries", () => { + test("should wildcard multi-word queries", () => { expect(SearchHelper.webSearchQuery("this is a test")).toBe( "this&is&a&test:*" ); }); - it("should not wildcard quoted queries", () => { + test("should not wildcard quoted queries", () => { expect(SearchHelper.webSearchQuery(`"this is a test"`)).toBe( `"this<->is<->a<->test"` ); }); }); - - describe("searchConfig", () => { - it("should boost recent documents when boostRecentMonths is set", async () => { - const team = await buildTeam(); - const user = await buildUser({ teamId: team.id }); - const collection = await buildCollection({ teamId: team.id }); - const now = new Date(); - - const recentDoc = await buildDocument({ - teamId: team.id, - collectionId: collection.id, - title: "test document recent", - text: "test search term recent", - }); - - // Set date 4 months ago - const olderDoc = await buildDocument({ - teamId: team.id, - collectionId: collection.id, - title: "test document older", - text: "test search term older test", - createdAt: subMonths(now, 4), - updatedAt: subMonths(now, 4), - }); - - // Search without recency boost - const resultsWithoutBoost = await SearchHelper.searchForUser(user, { - query: "test search term", - }); - - // Search with recency boost - const resultsWithBoost = await SearchHelper.searchForUser(user, { - query: "test search term", - searchConfig: { - boostRecent: true, - boostRecentMonths: 6, - maxRecentBoost: 2.0, - }, - }); - - // Without boost, documents should be ordered by base relevance - expect(resultsWithoutBoost.results.length).toBe(2); - expect(resultsWithoutBoost.results[0].document.id).toBe(olderDoc.id); - expect(resultsWithoutBoost.results[1].document.id).toBe(recentDoc.id); - - // With boost, recent document should be ranked higher - expect(resultsWithBoost.results.length).toBe(2); - expect(resultsWithBoost.results[0].document.id).toBe(recentDoc.id); - expect(resultsWithBoost.results[1].document.id).toBe(olderDoc.id); - - // Recent document should have higher ranking - expect(resultsWithBoost.results[0].ranking).toBeGreaterThan( - resultsWithBoost.results[1].ranking - ); - }); - - it("should respect different time windows", async () => { - const team = await buildTeam(); - const user = await buildUser({ teamId: team.id }); - const collection = await buildCollection({ teamId: team.id }); - const now = new Date(); - - const recentDoc = await buildDocument({ - teamId: team.id, - collectionId: collection.id, - title: "test document recent", - text: "test search term recent", - }); - - // Set date 2 months ago - const twoMonthOldDoc = await buildDocument({ - teamId: team.id, - collectionId: collection.id, - title: "test document two months", - text: "test search term two months", - createdAt: subMonths(now, 2), - updatedAt: subMonths(now, 2), - }); - - // Search with 1-month window - const resultsShortWindow = await SearchHelper.searchForUser(user, { - query: "test search term", - searchConfig: { - boostRecent: true, - boostRecentMonths: 1, - maxRecentBoost: 2.0, - }, - }); - - // Search with 3-month window - const resultsLongWindow = await SearchHelper.searchForUser(user, { - query: "test search term", - searchConfig: { - boostRecentMonths: 3, - maxRecentBoost: 2.0, - }, - }); - - // With 1-month window, two-month-old doc should have no boost - expect(resultsShortWindow.results[0].document.id).toBe(recentDoc.id); - expect(resultsShortWindow.results[1].document.id).toBe(twoMonthOldDoc.id); - expect(resultsShortWindow.results[0].ranking).toBeGreaterThan( - resultsShortWindow.results[1].ranking * 1.5 - ); - - // With 3-month window, two-month-old doc should have some boost - expect(resultsLongWindow.results[0].document.id).toBe(recentDoc.id); - expect(resultsLongWindow.results[1].document.id).toBe(twoMonthOldDoc.id); - const rankingRatio = - resultsLongWindow.results[0].ranking / - resultsLongWindow.results[1].ranking; - expect(rankingRatio).toBeLessThan(1.5); - expect(rankingRatio).toBeGreaterThan(1.0); - }); - - it("should respect custom boost factor", async () => { - const team = await buildTeam(); - const user = await buildUser({ teamId: team.id }); - const collection = await buildCollection({ teamId: team.id }); - const now = new Date(); - - const recentDoc = await buildDocument({ - teamId: team.id, - collectionId: collection.id, - title: "test document recent", - text: "test search term recent", - }); - - // Set date 2 months ago - await buildDocument({ - teamId: team.id, - collectionId: collection.id, - title: "test document older", - text: "test search term older", - createdAt: subMonths(now, 2), - updatedAt: subMonths(now, 2), - }); - - // Search with low boost factor - const resultsLowBoost = await SearchHelper.searchForUser(user, { - query: "test search term", - searchConfig: { - boostRecent: true, - boostRecentMonths: 6, - maxRecentBoost: 1.2, - }, - }); - - // Search with high boost factor - const resultsHighBoost = await SearchHelper.searchForUser(user, { - query: "test search term", - searchConfig: { - boostRecent: true, - boostRecentMonths: 6, - maxRecentBoost: 3.0, - }, - }); - - // Both searches should rank recent document higher - expect(resultsLowBoost.results[0].document.id).toBe(recentDoc.id); - expect(resultsHighBoost.results[0].document.id).toBe(recentDoc.id); - - // High boost should have greater difference in rankings - const lowBoostRatio = - resultsLowBoost.results[0].ranking / resultsLowBoost.results[1].ranking; - const highBoostRatio = - resultsHighBoost.results[0].ranking / - resultsHighBoost.results[1].ranking; - expect(highBoostRatio).toBeGreaterThan(lowBoostRatio); - }); - }); }); diff --git a/server/models/helpers/SearchHelper.ts b/server/models/helpers/SearchHelper.ts index c4759c97aa..e8a85d83b0 100644 --- a/server/models/helpers/SearchHelper.ts +++ b/server/models/helpers/SearchHelper.ts @@ -37,14 +37,6 @@ type SearchResponse = { total: number; }; -type SearchConfig = { - boostRecent?: boolean; - /** Time window in months for recent content boosting. When set, enables recency boosting. */ - boostRecentMonths?: number; - /** Maximum boost multiplier for recent content */ - maxRecentBoost?: number; -}; - type SearchOptions = { /** The query limit for pagination */ limit?: number; @@ -68,8 +60,6 @@ type SearchOptions = { snippetMinWords?: number; /** The maximum number of words to be returned in the contextual snippet */ snippetMaxWords?: number; - /** Configuration for search behavior */ - searchConfig?: SearchConfig; }; type RankedDocument = Document & { @@ -89,7 +79,7 @@ export default class SearchHelper { team: Team, options: SearchOptions = {} ): Promise<SearchResponse> { - const { limit = 15, offset = 0, query, searchConfig } = options; + const { limit = 15, offset = 0, query } = options; const where = await this.buildWhere(team, { ...options, @@ -111,7 +101,7 @@ export default class SearchHelper { }); } - const findOptions = this.buildFindOptions(query, searchConfig); + const findOptions = this.buildFindOptions(query); try { const resultsQuery = Document.unscoped().findAll({ @@ -246,11 +236,11 @@ export default class SearchHelper { user: User, options: SearchOptions = {} ): Promise<SearchResponse> { - const { limit = 15, offset = 0, query, searchConfig } = options; + const { limit = 15, offset = 0, query } = options; const where = await this.buildWhere(user, options); - const findOptions = this.buildFindOptions(query, searchConfig); + const findOptions = this.buildFindOptions(query); const include = [ { @@ -319,46 +309,18 @@ export default class SearchHelper { } } - private static buildFindOptions( - query?: string, - searchConfig?: SearchConfig - ): FindOptions { + private static buildFindOptions(query?: string): FindOptions { const attributes: FindAttributeOptions = ["id"]; const replacements: BindOrReplacements = {}; const order: Order = [["updatedAt", "DESC"]]; if (query) { - // Default values for recency boosting - const boostRecent = searchConfig?.boostRecent ?? false; - const boostRecentMonths = searchConfig?.boostRecentMonths ?? 2; - const maxRecentBoost = searchConfig?.maxRecentBoost ?? 2.0; - - if (boostRecent) { - // Calculate ranking with recency boost - // The formula creates a multiplier between 1.0 and maxRecentBoost based on document age - attributes.push([ - Sequelize.literal( - `( - ts_rank("searchVector", to_tsquery('english', :query)) * - (1 + (LEAST( - ${maxRecentBoost - 1}, - (1 - EXTRACT(EPOCH FROM (NOW() - document."updatedAt")) / - EXTRACT(EPOCH FROM INTERVAL '${boostRecentMonths} months')) - ) * ${maxRecentBoost})) - )` - ), - "searchRanking", - ]); - } else { - // Original ranking without recency boost - attributes.push([ - Sequelize.literal( - `ts_rank("searchVector", to_tsquery('english', :query))` - ), - "searchRanking", - ]); - } - + attributes.push([ + Sequelize.literal( + `ts_rank("searchVector", to_tsquery('english', :query))` + ), + "searchRanking", + ]); replacements["query"] = this.webSearchQuery(query); order.unshift(["searchRanking", "DESC"]); } diff --git a/server/routes/api/documents/documents.ts b/server/routes/api/documents/documents.ts index 55b8cb2a59..a6a015c134 100644 --- a/server/routes/api/documents/documents.ts +++ b/server/routes/api/documents/documents.ts @@ -1060,9 +1060,6 @@ router.post( limit, snippetMinWords, snippetMaxWords, - searchConfig: { - boostRecent: true, - }, }); } From 6440d78b6fe3ae7c5489726ca322aa695d2d7f81 Mon Sep 17 00:00:00 2001 From: Tom Moor <tom@getoutline.com> Date: Sat, 26 Apr 2025 17:35:41 -0400 Subject: [PATCH 18/64] fix: Double fetch on refactored paginated list (#9068) --- app/components/PaginatedList.tsx | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/app/components/PaginatedList.tsx b/app/components/PaginatedList.tsx index b289db622e..00e73a5e32 100644 --- a/app/components/PaginatedList.tsx +++ b/app/components/PaginatedList.tsx @@ -195,21 +195,27 @@ const PaginatedList = <T extends PaginatedItem>({ } }, [allowLoadMore, isFetching, items?.length, renderCount, fetchResults]); - React.useEffect(() => { - void fetchResults(); - // eslint-disable-next-line react-hooks/exhaustive-deps - }, []); - const prevFetch = usePrevious(fetch); const prevOptions = usePrevious(options); - // Equivalent to componentDidUpdate + // Initial fetch on mount React.useEffect(() => { + if (fetch) { + void fetchResults(); + } + }, [fetch]); + + // Handle updates to fetch or options + React.useEffect(() => { + if (!prevFetch || !prevOptions) { + return; // Skip on initial mount since it's handled by the above effect + } + if (prevFetch !== fetch || !isEqual(prevOptions, options)) { reset(); void fetchResults(); } - }, [fetch, options, reset, prevFetch, prevOptions, fetchResults]); + }, [fetch, options, reset, fetchResults, prevFetch, prevOptions]); // Computed property equivalent const itemsToRender = React.useMemo( From 7f513a69500b507e11f8acd6f68fcd30a5d5b03c Mon Sep 17 00:00:00 2001 From: Hemachandar <132386067+hmacr@users.noreply.github.com> Date: Sun, 27 Apr 2025 18:56:36 +0530 Subject: [PATCH 19/64] fix: Store Linear workspace logo only when it's available (#9072) --- plugins/linear/server/api/linear.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/plugins/linear/server/api/linear.ts b/plugins/linear/server/api/linear.ts index 033c2fde88..db8469b176 100644 --- a/plugins/linear/server/api/linear.ts +++ b/plugins/linear/server/api/linear.ts @@ -106,12 +106,14 @@ router.get( { transaction } ); - transaction.afterCommit(async () => { - await UploadLinearWorkspaceLogoTask.schedule({ - integrationId: integration.id, - logoUrl: workspace.logoUrl, + if (workspace.logoUrl) { + transaction.afterCommit(async () => { + await UploadLinearWorkspaceLogoTask.schedule({ + integrationId: integration.id, + logoUrl: workspace.logoUrl, + }); }); - }); + } ctx.redirect(LinearUtils.successUrl()); } From e2dd6221f86fd83a72cc2c3e6b65cedbe9b018be Mon Sep 17 00:00:00 2001 From: Tom Moor <tom@getoutline.com> Date: Sun, 27 Apr 2025 10:55:05 -0400 Subject: [PATCH 20/64] Extract subdomain auth redirect (#9070) * Extract subdomain auth redirect * docs --- plugins/github/server/api/github.ts | 45 ++++++--------------- plugins/linear/server/api/linear.ts | 53 ++++++------------------- plugins/notion/server/api/notion.ts | 53 ++++++------------------- plugins/slack/server/auth/slack.ts | 38 ++++++------------ server/middlewares/apexAuthRedirect.ts | 54 ++++++++++++++++++++++++++ 5 files changed, 101 insertions(+), 142 deletions(-) create mode 100644 server/middlewares/apexAuthRedirect.ts diff --git a/plugins/github/server/api/github.ts b/plugins/github/server/api/github.ts index 993b630b94..b961df3132 100644 --- a/plugins/github/server/api/github.ts +++ b/plugins/github/server/api/github.ts @@ -1,13 +1,12 @@ import Router from "koa-router"; import find from "lodash/find"; import { IntegrationService, IntegrationType } from "@shared/types"; -import { parseDomain } from "@shared/utils/domains"; import { createContext } from "@server/context"; -import Logger from "@server/logging/Logger"; +import apexAuthRedirect from "@server/middlewares/apexAuthRedirect"; import auth from "@server/middlewares/authentication"; import { transaction } from "@server/middlewares/transaction"; import validate from "@server/middlewares/validate"; -import { IntegrationAuthentication, Integration, Team } from "@server/models"; +import { IntegrationAuthentication, Integration } from "@server/models"; import { APIContext } from "@server/types"; import { GitHubUtils } from "../../shared/GitHubUtils"; import { GitHub } from "../github"; @@ -17,10 +16,17 @@ const router = new Router(); router.get( "github.callback", - auth({ - optional: true, - }), + auth({ optional: true }), validate(T.GitHubCallbackSchema), + apexAuthRedirect<T.GitHubCallbackReq>({ + getTeamId: (ctx) => ctx.input.query.state, + getRedirectPath: (ctx, team) => + GitHubUtils.callbackUrl({ + baseUrl: team.url, + params: ctx.request.querystring, + }), + getErrorPath: () => GitHubUtils.errorUrl("unauthenticated"), + }), transaction(), async (ctx: APIContext<T.GitHubCallbackReq>) => { const { @@ -43,33 +49,6 @@ router.get( return; } - // this code block accounts for the root domain being unable to - // access authentication for subdomains. We must forward to the appropriate - // subdomain to complete the oauth flow - if (!user) { - if (teamId) { - try { - const team = await Team.findByPk(teamId, { - rejectOnEmpty: true, - transaction, - }); - return parseDomain(ctx.host).teamSubdomain === team.subdomain - ? ctx.redirect("/") - : ctx.redirectOnClient( - GitHubUtils.callbackUrl({ - baseUrl: team.url, - params: ctx.request.querystring, - }) - ); - } catch (err) { - Logger.error(`Error fetching team for teamId: ${teamId}!`, err); - return ctx.redirect(GitHubUtils.errorUrl("unauthenticated")); - } - } else { - return ctx.redirect(GitHubUtils.errorUrl("unauthenticated")); - } - } - const client = await GitHub.authenticateAsUser(code!, teamId); const installationsByUser = await client.requestAppInstallations(); const installation = find( diff --git a/plugins/linear/server/api/linear.ts b/plugins/linear/server/api/linear.ts index db8469b176..4b879a4f97 100644 --- a/plugins/linear/server/api/linear.ts +++ b/plugins/linear/server/api/linear.ts @@ -1,11 +1,10 @@ import Router from "koa-router"; import { IntegrationService, IntegrationType } from "@shared/types"; -import { parseDomain } from "@shared/utils/domains"; -import Logger from "@server/logging/Logger"; +import apexAuthRedirect from "@server/middlewares/apexAuthRedirect"; import auth from "@server/middlewares/authentication"; import { transaction } from "@server/middlewares/transaction"; import validate from "@server/middlewares/validate"; -import { IntegrationAuthentication, Integration, Team } from "@server/models"; +import { IntegrationAuthentication, Integration } from "@server/models"; import { APIContext } from "@server/types"; import { Linear } from "../linear"; import UploadLinearWorkspaceLogoTask from "../tasks/UploadLinearWorkspaceLogoTask"; @@ -20,49 +19,21 @@ router.get( optional: true, }), validate(T.LinearCallbackSchema), + apexAuthRedirect<T.LinearCallbackReq>({ + getTeamId: (ctx) => LinearUtils.parseState(ctx.input.query.state)?.teamId, + getRedirectPath: (ctx, team) => + LinearUtils.callbackUrl({ + baseUrl: team.url, + params: ctx.request.querystring, + }), + getErrorPath: () => LinearUtils.errorUrl("unauthenticated"), + }), transaction(), async (ctx: APIContext<T.LinearCallbackReq>) => { - const { code, state, error } = ctx.input.query; + const { code, error } = ctx.input.query; const { user } = ctx.state.auth; const { transaction } = ctx.state; - let parsedState; - try { - parsedState = LinearUtils.parseState(state); - } catch { - ctx.redirect(LinearUtils.errorUrl("invalid_state")); - return; - } - - const { teamId } = parsedState; - - // this code block accounts for the root domain being unable to - // access authentication for subdomains. We must forward to the appropriate - // subdomain to complete the oauth flow - if (!user) { - if (teamId) { - try { - const team = await Team.findByPk(teamId, { - rejectOnEmpty: true, - transaction, - }); - return parseDomain(ctx.host).teamSubdomain === team.subdomain - ? ctx.redirect("/") - : ctx.redirectOnClient( - LinearUtils.callbackUrl({ - baseUrl: team.url, - params: ctx.request.querystring, - }) - ); - } catch (err) { - Logger.error(`Error fetching team for teamId: ${teamId}!`, err); - return ctx.redirect(LinearUtils.errorUrl("unauthenticated")); - } - } else { - return ctx.redirect(LinearUtils.errorUrl("unauthenticated")); - } - } - // Check error after any sub-domain redirection. Otherwise, the user will be redirected to the root domain. if (error) { ctx.redirect(LinearUtils.errorUrl(error)); diff --git a/plugins/notion/server/api/notion.ts b/plugins/notion/server/api/notion.ts index 7a59eb7c4d..e9b534f204 100644 --- a/plugins/notion/server/api/notion.ts +++ b/plugins/notion/server/api/notion.ts @@ -1,11 +1,10 @@ import Router from "koa-router"; import { IntegrationService, IntegrationType } from "@shared/types"; -import { parseDomain } from "@shared/utils/domains"; -import Logger from "@server/logging/Logger"; +import apexAuthRedirect from "@server/middlewares/apexAuthRedirect"; import auth from "@server/middlewares/authentication"; import { transaction } from "@server/middlewares/transaction"; import validate from "@server/middlewares/validate"; -import { Integration, IntegrationAuthentication, Team } from "@server/models"; +import { Integration, IntegrationAuthentication } from "@server/models"; import { APIContext } from "@server/types"; import { NotionClient } from "../notion"; import * as T from "./schema"; @@ -17,49 +16,21 @@ router.get( "notion.callback", auth({ optional: true }), validate(T.NotionCallbackSchema), + apexAuthRedirect<T.NotionCallbackReq>({ + getTeamId: (ctx) => NotionUtils.parseState(ctx.input.query.state)?.teamId, + getRedirectPath: (ctx, team) => + NotionUtils.callbackUrl({ + baseUrl: team.url, + params: ctx.request.querystring, + }), + getErrorPath: () => NotionUtils.errorUrl("unauthenticated"), + }), transaction(), async (ctx: APIContext<T.NotionCallbackReq>) => { - const { code, state, error } = ctx.input.query; + const { code, error } = ctx.input.query; const { user } = ctx.state.auth; const { transaction } = ctx.state; - let parsedState; - try { - parsedState = NotionUtils.parseState(state); - } catch { - ctx.redirect(NotionUtils.errorUrl("invalid_state")); - return; - } - - const { teamId } = parsedState; - - // This code block accounts for the root domain being unable to access authentication for subdomains. - // We must forward to the appropriate subdomain to complete the oauth flow. - if (!user) { - if (teamId) { - try { - const team = await Team.findByPk(teamId, { - rejectOnEmpty: true, - transaction, - }); - - return parseDomain(ctx.host).teamSubdomain === team.subdomain - ? ctx.redirect("/") - : ctx.redirectOnClient( - NotionUtils.callbackUrl({ - baseUrl: team.url, - params: ctx.request.querystring, - }) - ); - } catch (err) { - Logger.error(`Error fetching team for teamId: ${teamId}!`, err); - return ctx.redirect(NotionUtils.errorUrl("unauthenticated")); - } - } else { - return ctx.redirect(NotionUtils.errorUrl("unauthenticated")); - } - } - // Check error after any sub-domain redirection. Otherwise, the user will be redirected to the root domain. if (error) { ctx.redirect(NotionUtils.errorUrl(error)); diff --git a/plugins/slack/server/auth/slack.ts b/plugins/slack/server/auth/slack.ts index 58064c779b..e703193353 100644 --- a/plugins/slack/server/auth/slack.ts +++ b/plugins/slack/server/auth/slack.ts @@ -4,16 +4,15 @@ import Router from "koa-router"; import { Profile } from "passport"; import { Strategy as SlackStrategy } from "passport-slack-oauth2"; import { IntegrationService, IntegrationType } from "@shared/types"; -import { parseDomain } from "@shared/utils/domains"; import accountProvisioner from "@server/commands/accountProvisioner"; import { ValidationError } from "@server/errors"; +import apexAuthRedirect from "@server/middlewares/apexAuthRedirect"; import auth from "@server/middlewares/authentication"; import passportMiddleware from "@server/middlewares/passport"; import validate from "@server/middlewares/validate"; import { IntegrationAuthentication, Integration, - Team, User, Collection, } from "@server/models"; @@ -126,6 +125,15 @@ if (env.SLACK_CLIENT_ID && env.SLACK_CLIENT_SECRET) { "slack.post", auth({ optional: true }), validate(T.SlackPostSchema), + apexAuthRedirect<T.SlackPostReq>({ + getTeamId: (ctx) => SlackUtils.parseState(ctx.input.query.state)?.teamId, + getRedirectPath: (ctx, team) => + SlackUtils.connectUrl({ + baseUrl: team.url, + params: ctx.request.querystring, + }), + getErrorPath: () => SlackUtils.errorUrl("unauthenticated"), + }), async (ctx: APIContext<T.SlackPostReq>) => { const { code, error, state } = ctx.input.query; const { user } = ctx.state.auth; @@ -144,31 +152,7 @@ if (env.SLACK_CLIENT_ID && env.SLACK_CLIENT_SECRET) { throw ValidationError("Invalid state"); } - const { teamId, collectionId, type } = parsedState; - - // This code block accounts for the root domain being unable to access authentication for - // subdomains. We must forward to the appropriate subdomain to complete the OAuth flow. - if (!user) { - if (teamId) { - try { - const team = await Team.findByPk(teamId, { - rejectOnEmpty: true, - }); - return parseDomain(ctx.host).teamSubdomain === team.subdomain - ? ctx.redirect("/") - : ctx.redirectOnClient( - SlackUtils.connectUrl({ - baseUrl: team.url, - params: ctx.request.querystring, - }) - ); - } catch (err) { - return ctx.redirect(SlackUtils.errorUrl("unauthenticated")); - } - } else { - return ctx.redirect(SlackUtils.errorUrl("unauthenticated")); - } - } + const { collectionId, type } = parsedState; switch (type) { case IntegrationType.Post: { diff --git a/server/middlewares/apexAuthRedirect.ts b/server/middlewares/apexAuthRedirect.ts new file mode 100644 index 0000000000..6b959b7273 --- /dev/null +++ b/server/middlewares/apexAuthRedirect.ts @@ -0,0 +1,54 @@ +import { Next } from "koa"; +import { parseDomain } from "@shared/utils/domains"; +import { Team } from "@server/models"; +import { APIContext } from "@server/types"; + +/** + * An authentication middleware that should be used on routes that return from external auth flows + * to the apex domain. In these cases the user will be redirected to the correct subdomain where + * they are authenticated. + * + * @param options Options for the middleware + * @returns Koa middleware function + */ +export default function apexAuthRedirect<T>({ + getTeamId, + getRedirectPath, + getErrorPath, +}: { + /** Get the team ID for the current request */ + getTeamId: (ctx: APIContext<T>) => string | null | undefined; + /** Get the redirect URL for the given team ID */ + getRedirectPath: (ctx: APIContext<T>, team: Team) => string; + /** Get the error URL for the current request */ + getErrorPath: (ctx: APIContext<T>) => string; +}) { + return async function apexAuthRedirectMiddleware( + ctx: APIContext<T>, + next: Next + ) { + const { user } = ctx.state.auth; + if (user) { + return next(); + } + + const teamId = getTeamId(ctx); + + if (teamId) { + try { + const team = await Team.findByPk(teamId, { + attributes: ["id", "subdomain"], + rejectOnEmpty: true, + }); + + return parseDomain(ctx.host).teamSubdomain === team.subdomain + ? ctx.redirect("/") + : ctx.redirectOnClient(getRedirectPath(ctx, team)); + } catch (err) { + return ctx.redirect(getErrorPath(ctx)); + } + } else { + return ctx.redirect(getErrorPath(ctx)); + } + }; +} From 4885612661dc492e90d9872fdece4d70cdee37b5 Mon Sep 17 00:00:00 2001 From: Tom Moor <tom@getoutline.com> Date: Sun, 27 Apr 2025 11:01:23 -0400 Subject: [PATCH 21/64] Switch Linear to actor=app method (#9074) --- plugins/linear/shared/LinearUtils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/linear/shared/LinearUtils.ts b/plugins/linear/shared/LinearUtils.ts index 0ebee10724..f600980ad0 100644 --- a/plugins/linear/shared/LinearUtils.ts +++ b/plugins/linear/shared/LinearUtils.ts @@ -46,7 +46,7 @@ export class LinearUtils { scope: this.oauthScopes, response_type: "code", prompt: "consent", - actor: "application", + actor: "app", }; return `${this.authBaseUrl}?${queryString.stringify(params)}`; } From 2bb9b506373763af3bf52676d469cf7ecd120584 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 28 Apr 2025 17:26:18 -0400 Subject: [PATCH 22/64] chore(deps): bump react-portal from 4.2.2 to 4.3.0 (#9087) Bumps [react-portal](https://github.com/tajo/react-portal) from 4.2.2 to 4.3.0. - [Release notes](https://github.com/tajo/react-portal/releases) - [Commits](https://github.com/tajo/react-portal/commits) --- updated-dependencies: - dependency-name: react-portal dependency-version: 4.3.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index d77fd0ba93..cfb5ec3656 100644 --- a/package.json +++ b/package.json @@ -209,7 +209,7 @@ "react-i18next": "^12.3.1", "react-medium-image-zoom": "5.2.13", "react-merge-refs": "^2.1.1", - "react-portal": "^4.2.2", + "react-portal": "^4.3.0", "react-router-dom": "^5.3.4", "react-virtualized-auto-sizer": "^1.0.26", "react-waypoint": "^10.3.0", diff --git a/yarn.lock b/yarn.lock index 9b57cf96d1..922e527124 100644 --- a/yarn.lock +++ b/yarn.lock @@ -13521,10 +13521,10 @@ react-merge-refs@^2.1.1: resolved "https://registry.yarnpkg.com/react-merge-refs/-/react-merge-refs-2.1.1.tgz#e46763f8f1b881c0226ee54a1a2a10ffefba0233" integrity sha512-jLQXJ/URln51zskhgppGJ2ub7b2WFKGq3cl3NYKtlHoTG+dN2q7EzWrn3hN3EgPsTMvpR9tpq5ijdp7YwFZkag== -react-portal@^4.2.2: - version "4.2.2" - resolved "https://registry.yarnpkg.com/react-portal/-/react-portal-4.2.2.tgz#bff1e024147d6041ba8c530ffc99d4c8248f49fa" - integrity "sha1-v/HgJBR9YEG6jFMP/JnUyCSPSfo= sha512-vS18idTmevQxyQpnde0Td6ZcUlv+pD8GTyR42n3CHUQq9OHi1C4jDE4ZWEbEsrbrLRhSECYiao58cvocwMtP7Q==" +react-portal@^4.3.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/react-portal/-/react-portal-4.3.0.tgz#92ca3492b1309883134f317a6aa88004534c860f" + integrity sha512-qs/2uKq1ifB3J1+K8ExfgUvCDZqlqCkfOEhqTELEDTfosloKiuzOzc7hl7IQ/7nohiFZD41BUYU0boAsIsGYHw== dependencies: prop-types "^15.5.8" From 19e40cf814e19c70a395542a510c8fdd039b4a90 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 28 Apr 2025 17:26:28 -0400 Subject: [PATCH 23/64] chore(deps-dev): bump nodemon from 3.1.9 to 3.1.10 (#9085) Bumps [nodemon](https://github.com/remy/nodemon) from 3.1.9 to 3.1.10. - [Release notes](https://github.com/remy/nodemon/releases) - [Commits](https://github.com/remy/nodemon/compare/v3.1.9...v3.1.10) --- updated-dependencies: - dependency-name: nodemon dependency-version: 3.1.10 dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index cfb5ec3656..f3e060465a 100644 --- a/package.json +++ b/package.json @@ -356,7 +356,7 @@ "jest-environment-jsdom": "^29.7.0", "jest-fetch-mock": "^3.0.3", "lint-staged": "^13.3.0", - "nodemon": "^3.1.9", + "nodemon": "^3.1.10", "postinstall-postinstall": "^2.1.0", "prettier": "^2.8.8", "react-refresh": "^0.14.2", diff --git a/yarn.lock b/yarn.lock index 922e527124..e68e82f077 100644 --- a/yarn.lock +++ b/yarn.lock @@ -12246,10 +12246,10 @@ nodemailer@^6.10.0: resolved "https://registry.yarnpkg.com/nodemailer/-/nodemailer-6.10.0.tgz#1f24c9de94ad79c6206f66d132776b6503003912" integrity sha512-SQ3wZCExjeSatLE/HBaXS5vqUOQk6GtBdIIKxiFdmm01mOQZX/POJkO3SUX1wDiYcwUOJwT23scFSC9fY2H8IA== -nodemon@^3.1.9: - version "3.1.9" - resolved "https://registry.yarnpkg.com/nodemon/-/nodemon-3.1.9.tgz#df502cdc3b120e1c3c0c6e4152349019efa7387b" - integrity sha512-hdr1oIb2p6ZSxu3PB2JWWYS7ZQ0qvaZsc3hK8DR8f02kRzc8rjYmxAIvdz+aYC+8F2IjNaB7HMcSDg8nQpJxyg== +nodemon@^3.1.10: + version "3.1.10" + resolved "https://registry.yarnpkg.com/nodemon/-/nodemon-3.1.10.tgz#5015c5eb4fffcb24d98cf9454df14f4fecec9bc1" + integrity sha512-WDjw3pJ0/0jMFmyNDp3gvY2YizjLmmOUQo6DEBY+JgdvW/yQ9mEeSw6H5ythl5Ny2ytb7f9C2nIbjSxMNzbJXw== dependencies: chokidar "^3.5.2" debug "^4" From 8d05e2b09586a75380069e7863eb0d2e2531fc9f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 28 Apr 2025 17:26:54 -0400 Subject: [PATCH 24/64] chore(deps): bump pg from 8.14.1 to 8.15.6 (#9084) Bumps [pg](https://github.com/brianc/node-postgres/tree/HEAD/packages/pg) from 8.14.1 to 8.15.6. - [Changelog](https://github.com/brianc/node-postgres/blob/master/CHANGELOG.md) - [Commits](https://github.com/brianc/node-postgres/commits/pg@8.15.6/packages/pg) --- updated-dependencies: - dependency-name: pg dependency-version: 8.15.6 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 48 ++++++++++++++++++++++++------------------------ 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/package.json b/package.json index f3e060465a..c67806d4fe 100644 --- a/package.json +++ b/package.json @@ -174,7 +174,7 @@ "passport-oauth2": "^1.8.0", "passport-slack-oauth2": "^1.2.0", "patch-package": "^7.0.2", - "pg": "^8.14.1", + "pg": "^8.15.6", "pg-tsquery": "^8.4.2", "pluralize": "^8.0.0", "png-chunks-extract": "^1.0.0", diff --git a/yarn.lock b/yarn.lock index e68e82f077..1c01265437 100644 --- a/yarn.lock +++ b/yarn.lock @@ -12830,30 +12830,30 @@ performance-now@^2.1.0: resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b" integrity "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns= sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==" -pg-cloudflare@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/pg-cloudflare/-/pg-cloudflare-1.1.1.tgz#e6d5833015b170e23ae819e8c5d7eaedb472ca98" - integrity "sha1-5tWDMBWxcOI66Bnoxdfq7bRyypg= sha512-xWPagP/4B6BgFO+EKz3JONXv3YDgvkbVrGw2mTo3D6tVDQRh1e7cqVGvyR3BE+eQgAvx1XhW/iEASj4/jCWl3Q==" +pg-cloudflare@^1.2.5: + version "1.2.5" + resolved "https://registry.yarnpkg.com/pg-cloudflare/-/pg-cloudflare-1.2.5.tgz#2e3649c38a7a9c74a7e5327c8098a2fd9af595bd" + integrity sha512-OOX22Vt0vOSRrdoUPKJ8Wi2OpE/o/h9T8X1s4qSkCedbNah9ei2W2765be8iMVxQUsvgT7zIAT2eIa9fs5+vtg== -pg-connection-string@^2.6.1, pg-connection-string@^2.7.0: - version "2.7.0" - resolved "https://registry.yarnpkg.com/pg-connection-string/-/pg-connection-string-2.7.0.tgz#f1d3489e427c62ece022dba98d5262efcb168b37" - integrity sha512-PI2W9mv53rXJQEOb8xNR8lH7Hr+EKa6oJa38zsK0S/ky2er16ios1wLKhZyxzD7jUReiWokc9WK5nxSnC7W1TA== +pg-connection-string@^2.6.1, pg-connection-string@^2.8.5: + version "2.8.5" + resolved "https://registry.yarnpkg.com/pg-connection-string/-/pg-connection-string-2.8.5.tgz#82cefd0269cb64a09603342d9b69e8392e6eb6cd" + integrity sha512-Ni8FuZ8yAF+sWZzojvtLE2b03cqjO5jNULcHFfM9ZZ0/JXrgom5pBREbtnAw7oxsxJqHw9Nz/XWORUEL3/IFow== pg-int8@1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/pg-int8/-/pg-int8-1.0.1.tgz#943bd463bf5b71b4170115f80f8efc9a0c0eb78c" integrity "sha1-lDvUY79bcbQXARX4D478mgwOt4w= sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw==" -pg-pool@^3.8.0: - version "3.8.0" - resolved "https://registry.yarnpkg.com/pg-pool/-/pg-pool-3.8.0.tgz#e6bce7fc4506a8d6106551363fc5283e5445b776" - integrity sha512-VBw3jiVm6ZOdLBTIcXLNdSotb6Iy3uOCwDGFAksZCXmi10nyRvnP2v3jl4d+IsLYRyXf6o9hIm/ZtUzlByNUdw== +pg-pool@^3.9.6: + version "3.9.6" + resolved "https://registry.yarnpkg.com/pg-pool/-/pg-pool-3.9.6.tgz#c6fde89dee615d6c262724e68a3a37e9593157fc" + integrity sha512-rFen0G7adh1YmgvrmE5IPIqbb+IgEzENUm+tzm6MLLDSlPRoZVhzU1WdML9PV2W5GOdRA9qBKURlbt1OsXOsPw== -pg-protocol@^1.8.0: - version "1.8.0" - resolved "https://registry.yarnpkg.com/pg-protocol/-/pg-protocol-1.8.0.tgz#c707101dd07813868035a44571488e4b98639d48" - integrity sha512-jvuYlEkL03NRvOoyoRktBK7+qU5kOvlAwvmrH8sr3wbLrOdVWsRxQfz8mMy9sZFsqJ1hEWNfdWKI4SAmoL+j7g== +pg-protocol@^1.9.5: + version "1.9.5" + resolved "https://registry.yarnpkg.com/pg-protocol/-/pg-protocol-1.9.5.tgz#e544eff37d6ab79c26281d7c0b59ac9be4862686" + integrity sha512-DYTWtWpfd5FOro3UnAfwvhD8jh59r2ig8bPtc9H8Ds7MscE/9NYruUQWFAOuraRl29jwcT2kyMFQ3MxeaVjUhg== pg-tsquery@^8.4.2: version "8.4.2" @@ -12871,18 +12871,18 @@ pg-types@^2.1.0: postgres-date "~1.0.4" postgres-interval "^1.1.0" -pg@^8.14.1: - version "8.14.1" - resolved "https://registry.yarnpkg.com/pg/-/pg-8.14.1.tgz#2e3d1f287b64797cdfc8d1ba000f61a7ff8d66ed" - integrity sha512-0TdbqfjwIun9Fm/r89oB7RFQ0bLgduAhiIqIXOsyKoiC/L54DbuAAzIEN/9Op0f1Po9X7iCPXGoa/Ah+2aI8Xw== +pg@^8.15.6: + version "8.15.6" + resolved "https://registry.yarnpkg.com/pg/-/pg-8.15.6.tgz#2a28e98fb6cab18b886ce58b2c184d712a94880a" + integrity sha512-yvao7YI3GdmmrslNVsZgx9PfntfWrnXwtR+K/DjI0I/sTKif4Z623um+sjVZ1hk5670B+ODjvHDAckKdjmPTsg== dependencies: - pg-connection-string "^2.7.0" - pg-pool "^3.8.0" - pg-protocol "^1.8.0" + pg-connection-string "^2.8.5" + pg-pool "^3.9.6" + pg-protocol "^1.9.5" pg-types "^2.1.0" pgpass "1.x" optionalDependencies: - pg-cloudflare "^1.1.1" + pg-cloudflare "^1.2.5" pgpass@1.x: version "1.0.4" From ce001547b51d88a15ccb751715fa17aa6376f9b4 Mon Sep 17 00:00:00 2001 From: Hemachandar <132386067+hmacr@users.noreply.github.com> Date: Tue, 29 Apr 2025 02:57:12 +0530 Subject: [PATCH 25/64] fix: Check pasted text is url before creating an URL object (#9082) --- app/editor/components/PasteMenu.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/editor/components/PasteMenu.tsx b/app/editor/components/PasteMenu.tsx index 9042f50a4f..8f6f74c69b 100644 --- a/app/editor/components/PasteMenu.tsx +++ b/app/editor/components/PasteMenu.tsx @@ -6,6 +6,7 @@ import { v4 } from "uuid"; import { EmbedDescriptor } from "@shared/editor/embeds"; import { MenuItem } from "@shared/editor/types"; import { MentionType } from "@shared/types"; +import { isUrl } from "@shared/utils/urls"; import Integration from "~/models/Integration"; import useCurrentUser from "~/hooks/useCurrentUser"; import useStores from "~/hooks/useStores"; @@ -29,9 +30,9 @@ export const PasteMenu = observer(({ pastedText, embeds, ...props }: Props) => { const user = useCurrentUser({ rejectOnEmpty: false }); let mentionType: MentionType | undefined; - const url = pastedText ? new URL(pastedText) : undefined; - if (url) { + if (pastedText && isUrl(pastedText)) { + const url = new URL(pastedText); const integration = integrations.find((intg: Integration) => isURLMentionable({ url, integration: intg }) ); From 722d10e7dec96fd8ce518ebd38667a30437c9d0e Mon Sep 17 00:00:00 2001 From: Hemachandar <132386067+hmacr@users.noreply.github.com> Date: Tue, 29 Apr 2025 02:57:24 +0530 Subject: [PATCH 26/64] Implement type-safe `schedule` method for tasks (#9079) * Implement type-safe task scheduler * introduce 'schedule' instance method * typo --- plugins/linear/server/api/linear.ts | 10 +++++----- .../processors/IntegrationCreatedProcessor.ts | 2 +- server/queues/tasks/BaseTask.ts | 19 ++++++++++++++++++- 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/plugins/linear/server/api/linear.ts b/plugins/linear/server/api/linear.ts index 4b879a4f97..2c271aa746 100644 --- a/plugins/linear/server/api/linear.ts +++ b/plugins/linear/server/api/linear.ts @@ -77,14 +77,14 @@ router.get( { transaction } ); - if (workspace.logoUrl) { - transaction.afterCommit(async () => { - await UploadLinearWorkspaceLogoTask.schedule({ + transaction.afterCommit(async () => { + if (workspace.logoUrl) { + await new UploadLinearWorkspaceLogoTask().schedule({ integrationId: integration.id, logoUrl: workspace.logoUrl, }); - }); - } + } + }); ctx.redirect(LinearUtils.successUrl()); } diff --git a/server/queues/processors/IntegrationCreatedProcessor.ts b/server/queues/processors/IntegrationCreatedProcessor.ts index 8dc45bd8a4..3582883e08 100644 --- a/server/queues/processors/IntegrationCreatedProcessor.ts +++ b/server/queues/processors/IntegrationCreatedProcessor.ts @@ -20,7 +20,7 @@ export default class IntegrationCreatedProcessor extends BaseProcessor { } // Store the available issue sources in the integration record. - await CacheIssueSourcesTask.schedule({ + await new CacheIssueSourcesTask().schedule({ integrationId: integration.id, }); diff --git a/server/queues/tasks/BaseTask.ts b/server/queues/tasks/BaseTask.ts index 30c66fe9c0..ac1b75155a 100644 --- a/server/queues/tasks/BaseTask.ts +++ b/server/queues/tasks/BaseTask.ts @@ -21,7 +21,7 @@ export default abstract class BaseTask<T extends Record<string, any>> { static cron: TaskSchedule | undefined; /** - * Schedule this task type to be processed asyncronously by a worker. + * Schedule this task type to be processed asynchronously by a worker. * * @param props Properties to be used by the task * @returns A promise that resolves once the job is placed on the task queue @@ -39,6 +39,23 @@ export default abstract class BaseTask<T extends Record<string, any>> { ); } + /** + * Schedule this task type to be processed asynchronously by a worker. + * + * @param props Properties to be used by the task + * @param options Job options such as priority and retry strategy, as defined by Bull. + * @returns A promise that resolves once the job is placed on the task queue + */ + public schedule(props: T, options?: JobOptions): Promise<Job> { + return taskQueue.add( + { + name: this.constructor.name, + props, + }, + { ...options, ...this.options } + ); + } + /** * Execute the task. * From f5c659f90201d9f34ffca2f9b132d1f538184886 Mon Sep 17 00:00:00 2001 From: Tom Moor <tom@getoutline.com> Date: Mon, 28 Apr 2025 17:27:40 -0400 Subject: [PATCH 27/64] fix: Prevent cross-domain websocket connections to on-premise instances (#9064) --- server/services/websockets.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/server/services/websockets.ts b/server/services/websockets.ts index f17c132fb3..5d19a2e086 100644 --- a/server/services/websockets.ts +++ b/server/services/websockets.ts @@ -4,6 +4,7 @@ import cookie from "cookie"; import Koa from "koa"; import IO from "socket.io"; import { createAdapter } from "socket.io-redis"; +import env from "@server/env"; import { AuthenticationError } from "@server/errors"; import Logger from "@server/logging/Logger"; import Metrics from "@server/logging/Metrics"; @@ -38,7 +39,8 @@ export default function init( pingInterval: 15000, pingTimeout: 30000, cors: { - origin: "*", + // Included for completeness, though CORS does not apply to websocket transport. + origin: env.isCloudHosted ? "*" : env.URL, methods: ["GET", "POST"], }, }); @@ -60,6 +62,16 @@ export default function init( "upgrade", function (req: IncomingMessage, socket: Duplex, head: Buffer) { if (req.url?.startsWith(path) && ioHandleUpgrade) { + // For on-premise deployments, ensure the websocket origin matches the deployed URL. + // In cloud-hosted we support any origin for custom domains. + if ( + !env.isCloudHosted && + (!req.headers.origin || !env.URL.startsWith(req.headers.origin)) + ) { + socket.end(`HTTP/1.1 400 Bad Request\r\n`); + return; + } + ioHandleUpgrade(req, socket, head); return; } From 347f0338022dd75922ca1a483c9798aa9bd7515c Mon Sep 17 00:00:00 2001 From: Tom Moor <tom@getoutline.com> Date: Tue, 29 Apr 2025 06:45:15 -0400 Subject: [PATCH 28/64] fix: Notifications received for draft with access but no subscription (#9099) --- .../models/helpers/NotificationHelper.test.ts | 76 ++++++++++++++++++- server/models/helpers/NotificationHelper.ts | 14 +++- 2 files changed, 85 insertions(+), 5 deletions(-) diff --git a/server/models/helpers/NotificationHelper.test.ts b/server/models/helpers/NotificationHelper.test.ts index 71b624efa8..6013601dc9 100644 --- a/server/models/helpers/NotificationHelper.test.ts +++ b/server/models/helpers/NotificationHelper.test.ts @@ -1,7 +1,9 @@ -import { NotificationEventType } from "@shared/types"; +import { DocumentPermission, NotificationEventType } from "@shared/types"; +import { UserMembership } from "@server/models"; import { buildComment, buildDocument, + buildDraftDocument, buildSubscription, buildUser, } from "@server/test/factories"; @@ -54,6 +56,78 @@ describe("NotificationHelper", () => { expect(recipients[0].id).toEqual(notificationEnabledUser.id); }); + it("should only return users who have notification enabled for comment creation and are subscribed to the document in case of new thread in draft", async () => { + const documentAuthor = await buildUser(); + + // create a draft + const document = await buildDraftDocument({ + userId: documentAuthor.id, + teamId: documentAuthor.teamId, + collectionId: null, + }); + + // add a bunch of users as direct members + const user = await buildUser({ + teamId: document.teamId, + notificationSettings: { [NotificationEventType.CreateComment]: true }, + }); + const user2 = await buildUser({ + teamId: document.teamId, + notificationSettings: { [NotificationEventType.CreateComment]: true }, + }); + const user3 = await buildUser({ + teamId: document.teamId, + notificationSettings: { [NotificationEventType.CreateComment]: true }, + }); + await UserMembership.create({ + documentId: document.id, + userId: user.id, + permission: DocumentPermission.Read, + createdById: user.id, + }); + await UserMembership.create({ + documentId: document.id, + userId: user2.id, + permission: DocumentPermission.Read, + createdById: user.id, + }); + await UserMembership.create({ + documentId: document.id, + userId: user3.id, + permission: DocumentPermission.Read, + createdById: user.id, + }); + + // Add a subscription for only one of those users + await Promise.all([ + buildSubscription({ + userId: user.id, + }), + buildSubscription({ + userId: user2.id, + }), + buildSubscription({ + userId: user3.id, + documentId: document.id, + }), + ]); + + const comment = await buildComment({ + documentId: document.id, + userId: documentAuthor.id, + }); + + const recipients = + await NotificationHelper.getCommentNotificationRecipients( + document, + comment, + comment.createdById + ); + + expect(recipients.length).toEqual(1); + expect(recipients[0].id).toEqual(user3.id); + }); + it("should only return users who have notification enabled for comment creation and are in the thread in case of child comment", async () => { const documentAuthor = await buildUser(); const document = await buildDocument({ diff --git a/server/models/helpers/NotificationHelper.ts b/server/models/helpers/NotificationHelper.ts index 7f33e8a296..e02be38e40 100644 --- a/server/models/helpers/NotificationHelper.ts +++ b/server/models/helpers/NotificationHelper.ts @@ -193,10 +193,16 @@ export default class NotificationHelper { [Op.ne]: actorId, }, event: SubscriptionType.Document, - [Op.or]: [ - { collectionId: document.collectionId }, - { documentId: document.id }, - ], + ...(document.collectionId + ? { + [Op.or]: [ + { collectionId: document.collectionId }, + { documentId: document.id }, + ], + } + : { + documentId: document.id, + }), }, include: [ { From a226889143127c8cea6d18fa6c1576f9fd698a16 Mon Sep 17 00:00:00 2001 From: "codegen-sh[bot]" <131295404+codegen-sh[bot]@users.noreply.github.com> Date: Tue, 29 Apr 2025 06:47:51 -0400 Subject: [PATCH 29/64] Update task scheduling to use instance method (#9092) * Update task scheduling to use instance method * Delete update_task_schedule.sh * Applied automatic fixes * tsc --------- Co-authored-by: codegen-sh[bot] <131295404+codegen-sh[bot]@users.noreply.github.com> Co-authored-by: Tom Moor <tom@getoutline.com> --- .../processors/NotionImportsProcessor.ts | 2 +- .../server/tasks/NotionAPIImportTask.ts | 2 +- .../processors/WebhookProcessor.test.ts | 28 ++++++++++++++----- .../server/processors/WebhookProcessor.ts | 5 +++- server/commands/documentMover.ts | 2 +- .../commands/documentPermanentDeleter.test.ts | 12 +++++--- server/commands/documentPermanentDeleter.ts | 2 +- server/commands/userSuspender.ts | 2 +- server/models/Team.ts | 2 +- server/models/User.ts | 2 +- server/queues/processors/AvatarProcessor.ts | 4 +-- .../queues/processors/CollectionsProcessor.ts | 2 +- .../DocumentSubscriptionProcessor.ts | 12 ++++---- .../FileOperationCreatedProcessor.ts | 10 +++---- .../processors/NotificationsProcessor.ts | 16 +++++------ .../queues/processors/RevisionsProcessor.ts | 2 +- .../queues/processors/UserDemotedProcessor.ts | 2 +- server/queues/tasks/APIImportTask.ts | 4 ++- .../queues/tasks/CleanupDeletedTeamsTask.ts | 2 +- .../tasks/DetachDraftsFromCollectionTask.ts | 2 +- .../DocumentAddGroupNotificationsTask.ts | 7 +++-- server/queues/tasks/DocumentImportTask.ts | 2 +- .../tasks/UpdateTeamsAttachmentsSizeTask.ts | 2 +- server/routes/api/attachments/attachments.ts | 2 +- server/routes/api/auth/auth.ts | 2 +- server/routes/api/cron/cron.ts | 9 ++++-- server/routes/api/documents/documents.ts | 5 ++-- server/services/cron.ts | 3 +- 28 files changed, 88 insertions(+), 59 deletions(-) diff --git a/plugins/notion/server/processors/NotionImportsProcessor.ts b/plugins/notion/server/processors/NotionImportsProcessor.ts index 1ec642ba8e..527f36ebcf 100644 --- a/plugins/notion/server/processors/NotionImportsProcessor.ts +++ b/plugins/notion/server/processors/NotionImportsProcessor.ts @@ -66,6 +66,6 @@ export class NotionImportsProcessor extends ImportsProcessor<IntegrationService. protected async scheduleTask( importTask: ImportTask<IntegrationService.Notion> ): Promise<void> { - await NotionAPIImportTask.schedule({ importTaskId: importTask.id }); + await new NotionAPIImportTask().schedule({ importTaskId: importTask.id }); } } diff --git a/plugins/notion/server/tasks/NotionAPIImportTask.ts b/plugins/notion/server/tasks/NotionAPIImportTask.ts index 0538583455..7cc291b78f 100644 --- a/plugins/notion/server/tasks/NotionAPIImportTask.ts +++ b/plugins/notion/server/tasks/NotionAPIImportTask.ts @@ -77,7 +77,7 @@ export default class NotionAPIImportTask extends APIImportTask<IntegrationServic protected async scheduleNextTask( importTask: ImportTask<IntegrationService.Notion> ) { - await NotionAPIImportTask.schedule({ importTaskId: importTask.id }); + await new NotionAPIImportTask().schedule({ importTaskId: importTask.id }); return; } diff --git a/plugins/webhooks/server/processors/WebhookProcessor.test.ts b/plugins/webhooks/server/processors/WebhookProcessor.test.ts index 63d37d7f95..f8b6028375 100644 --- a/plugins/webhooks/server/processors/WebhookProcessor.test.ts +++ b/plugins/webhooks/server/processors/WebhookProcessor.test.ts @@ -29,8 +29,12 @@ describe("WebhookProcessor", () => { await processor.perform(event); - expect(DeliverWebhookTask.schedule).toHaveBeenCalled(); - expect(DeliverWebhookTask.schedule).toHaveBeenCalledWith({ + expect( + jest.mocked(DeliverWebhookTask.prototype.schedule) + ).toHaveBeenCalled(); + expect( + jest.mocked(DeliverWebhookTask.prototype.schedule) + ).toHaveBeenCalledWith({ event, subscriptionId: subscription.id, }); @@ -53,7 +57,9 @@ describe("WebhookProcessor", () => { await processor.perform(event); - expect(DeliverWebhookTask.schedule).toHaveBeenCalledTimes(0); + expect( + jest.mocked(DeliverWebhookTask.prototype.schedule) + ).toHaveBeenCalledTimes(0); }); it("it schedules a delivery for the event for each subscription", async () => { @@ -79,13 +85,21 @@ describe("WebhookProcessor", () => { await processor.perform(event); - expect(DeliverWebhookTask.schedule).toHaveBeenCalled(); - expect(DeliverWebhookTask.schedule).toHaveBeenCalledTimes(2); - expect(DeliverWebhookTask.schedule).toHaveBeenCalledWith({ + expect( + jest.mocked(DeliverWebhookTask.prototype.schedule) + ).toHaveBeenCalled(); + expect( + jest.mocked(DeliverWebhookTask.prototype.schedule) + ).toHaveBeenCalledTimes(2); + expect( + jest.mocked(DeliverWebhookTask.prototype.schedule) + ).toHaveBeenCalledWith({ event, subscriptionId: subscription.id, }); - expect(DeliverWebhookTask.schedule).toHaveBeenCalledWith({ + expect( + jest.mocked(DeliverWebhookTask.prototype.schedule) + ).toHaveBeenCalledWith({ event, subscriptionId: subscriptionTwo.id, }); diff --git a/plugins/webhooks/server/processors/WebhookProcessor.ts b/plugins/webhooks/server/processors/WebhookProcessor.ts index 012157b0b7..fbc9cf4d5e 100644 --- a/plugins/webhooks/server/processors/WebhookProcessor.ts +++ b/plugins/webhooks/server/processors/WebhookProcessor.ts @@ -24,7 +24,10 @@ export default class WebhookProcessor extends BaseProcessor { await Promise.all( applicableSubscriptions.map((subscription) => - DeliverWebhookTask.schedule({ event, subscriptionId: subscription.id }) + new DeliverWebhookTask().schedule({ + event, + subscriptionId: subscription.id, + }) ) ); } diff --git a/server/commands/documentMover.ts b/server/commands/documentMover.ts index 01ab23aad5..cf1b150783 100644 --- a/server/commands/documentMover.ts +++ b/server/commands/documentMover.ts @@ -24,7 +24,7 @@ type Props = { /** Position of moved document within document structure */ index?: number; /** The IP address of the user moving the document */ - ip: string; + ip: string | null; /** The database transaction to run within */ transaction?: Transaction; }; diff --git a/server/commands/documentPermanentDeleter.test.ts b/server/commands/documentPermanentDeleter.test.ts index e397f69804..ab0ad273db 100644 --- a/server/commands/documentPermanentDeleter.test.ts +++ b/server/commands/documentPermanentDeleter.test.ts @@ -4,9 +4,11 @@ import DeleteAttachmentTask from "@server/queues/tasks/DeleteAttachmentTask"; import { buildAttachment, buildDocument } from "@server/test/factories"; import documentPermanentDeleter from "./documentPermanentDeleter"; -jest.mock("@server/queues/tasks/DeleteAttachmentTask", () => ({ - schedule: jest.fn(), -})); +jest.mock("@server/queues/tasks/DeleteAttachmentTask"); + +beforeEach(() => { + jest.resetAllMocks(); +}); describe("documentPermanentDeleter", () => { it("should destroy documents", async () => { @@ -60,7 +62,9 @@ describe("documentPermanentDeleter", () => { await document.save(); const countDeletedDoc = await documentPermanentDeleter([document]); expect(countDeletedDoc).toEqual(1); - expect(DeleteAttachmentTask.schedule).toHaveBeenCalledTimes(2); + expect( + jest.mocked(DeleteAttachmentTask.prototype.schedule) + ).toHaveBeenCalledTimes(2); expect( await Document.unscoped().count({ where: { diff --git a/server/commands/documentPermanentDeleter.ts b/server/commands/documentPermanentDeleter.ts index ac583a3f31..006454add3 100644 --- a/server/commands/documentPermanentDeleter.ts +++ b/server/commands/documentPermanentDeleter.ts @@ -67,7 +67,7 @@ export default async function documentPermanentDeleter(documents: Document[]) { "commands", `Attachment ${attachmentId} scheduled for deletion` ); - await DeleteAttachmentTask.schedule({ + await new DeleteAttachmentTask().schedule({ attachmentId, teamId: document.teamId, }); diff --git a/server/commands/userSuspender.ts b/server/commands/userSuspender.ts index 3f781f2b07..5849b90f7b 100644 --- a/server/commands/userSuspender.ts +++ b/server/commands/userSuspender.ts @@ -56,5 +56,5 @@ export default async function userSuspender({ } ); - await CleanupDemotedUserTask.schedule({ userId: user.id }); + await new CleanupDemotedUserTask().schedule({ userId: user.id }); } diff --git a/server/models/Team.ts b/server/models/Team.ts index 39fc72f381..42822bfb64 100644 --- a/server/models/Team.ts +++ b/server/models/Team.ts @@ -408,7 +408,7 @@ class Team extends ParanoidModel< }); if (attachment) { - await DeleteAttachmentTask.schedule({ + await new DeleteAttachmentTask().schedule({ attachmentId: attachment.id, teamId: model.id, }); diff --git a/server/models/User.ts b/server/models/User.ts index a4d7e9df9d..5e152fa24c 100644 --- a/server/models/User.ts +++ b/server/models/User.ts @@ -717,7 +717,7 @@ class User extends ParanoidModel< }); if (attachment) { - await DeleteAttachmentTask.schedule({ + await new DeleteAttachmentTask().schedule({ attachmentId: attachment.id, teamId: model.teamId, }); diff --git a/server/queues/processors/AvatarProcessor.ts b/server/queues/processors/AvatarProcessor.ts index a0b21b00f7..6b23a0d236 100644 --- a/server/queues/processors/AvatarProcessor.ts +++ b/server/queues/processors/AvatarProcessor.ts @@ -17,7 +17,7 @@ export default class AvatarProcessor extends BaseProcessor { }); if (user.avatarUrl) { - await UploadUserAvatarTask.schedule({ + await new UploadUserAvatarTask().schedule({ userId: event.userId, avatarUrl: user.avatarUrl, }); @@ -30,7 +30,7 @@ export default class AvatarProcessor extends BaseProcessor { }); if (team.avatarUrl) { - await UploadTeamAvatarTask.schedule({ + await new UploadTeamAvatarTask().schedule({ teamId: event.teamId, avatarUrl: team.avatarUrl, }); diff --git a/server/queues/processors/CollectionsProcessor.ts b/server/queues/processors/CollectionsProcessor.ts index fbf46b54d2..114448fb63 100644 --- a/server/queues/processors/CollectionsProcessor.ts +++ b/server/queues/processors/CollectionsProcessor.ts @@ -12,7 +12,7 @@ export default class CollectionsProcessor extends BaseProcessor { ]; async perform(event: CollectionEvent) { - await DetachDraftsFromCollectionTask.schedule({ + await new DetachDraftsFromCollectionTask().schedule({ collectionId: event.collectionId, actorId: event.actorId, ip: event.ip, diff --git a/server/queues/processors/DocumentSubscriptionProcessor.ts b/server/queues/processors/DocumentSubscriptionProcessor.ts index 3de75892f3..4b138d98de 100644 --- a/server/queues/processors/DocumentSubscriptionProcessor.ts +++ b/server/queues/processors/DocumentSubscriptionProcessor.ts @@ -27,7 +27,7 @@ export default class DocumentSubscriptionProcessor extends BaseProcessor { async perform(event: ReceivedEvent) { switch (event.name) { case "collections.remove_user": { - await CollectionSubscriptionRemoveUserTask.schedule(event); + await new CollectionSubscriptionRemoveUserTask().schedule(event); return; } @@ -35,7 +35,7 @@ export default class DocumentSubscriptionProcessor extends BaseProcessor { return this.handleRemoveGroupFromCollection(event); case "documents.remove_user": { - await DocumentSubscriptionRemoveUserTask.schedule(event); + await new DocumentSubscriptionRemoveUserTask().schedule(event); return; } @@ -57,11 +57,11 @@ export default class DocumentSubscriptionProcessor extends BaseProcessor { async (groupUsers) => { await Promise.all( groupUsers.map((groupUser) => - CollectionSubscriptionRemoveUserTask.schedule({ + new CollectionSubscriptionRemoveUserTask().schedule({ ...event, name: "collections.remove_user", userId: groupUser.userId, - }) + } as CollectionUserEvent) ) ); } @@ -79,11 +79,11 @@ export default class DocumentSubscriptionProcessor extends BaseProcessor { async (groupUsers) => { await Promise.all( groupUsers.map((groupUser) => - DocumentSubscriptionRemoveUserTask.schedule({ + new DocumentSubscriptionRemoveUserTask().schedule({ ...event, name: "documents.remove_user", userId: groupUser.userId, - }) + } as DocumentUserEvent) ) ); } diff --git a/server/queues/processors/FileOperationCreatedProcessor.ts b/server/queues/processors/FileOperationCreatedProcessor.ts index ed0ef08871..2d9a5d4853 100644 --- a/server/queues/processors/FileOperationCreatedProcessor.ts +++ b/server/queues/processors/FileOperationCreatedProcessor.ts @@ -20,12 +20,12 @@ export default class FileOperationCreatedProcessor extends BaseProcessor { if (fileOperation.type === FileOperationType.Import) { switch (fileOperation.format) { case FileOperationFormat.MarkdownZip: - await ImportMarkdownZipTask.schedule({ + await new ImportMarkdownZipTask().schedule({ fileOperationId: event.modelId, }); break; case FileOperationFormat.JSON: - await ImportJSONTask.schedule({ + await new ImportJSONTask().schedule({ fileOperationId: event.modelId, }); break; @@ -36,17 +36,17 @@ export default class FileOperationCreatedProcessor extends BaseProcessor { if (fileOperation.type === FileOperationType.Export) { switch (fileOperation.format) { case FileOperationFormat.HTMLZip: - await ExportHTMLZipTask.schedule({ + await new ExportHTMLZipTask().schedule({ fileOperationId: event.modelId, }); break; case FileOperationFormat.MarkdownZip: - await ExportMarkdownZipTask.schedule({ + await new ExportMarkdownZipTask().schedule({ fileOperationId: event.modelId, }); break; case FileOperationFormat.JSON: - await ExportJSONTask.schedule({ + await new ExportJSONTask().schedule({ fileOperationId: event.modelId, }); break; diff --git a/server/queues/processors/NotificationsProcessor.ts b/server/queues/processors/NotificationsProcessor.ts index e2b267be51..28ad685388 100644 --- a/server/queues/processors/NotificationsProcessor.ts +++ b/server/queues/processors/NotificationsProcessor.ts @@ -62,25 +62,25 @@ export default class NotificationsProcessor extends BaseProcessor { return; } - await DocumentPublishedNotificationsTask.schedule(event); + await new DocumentPublishedNotificationsTask().schedule(event); } async documentAddUser(event: DocumentUserEvent) { if (!event.data.isNew || event.userId === event.actorId) { return; } - await DocumentAddUserNotificationsTask.schedule(event); + await new DocumentAddUserNotificationsTask().schedule(event); } async documentAddGroup(event: DocumentGroupEvent) { if (!event.data.isNew) { return; } - await DocumentAddGroupNotificationsTask.schedule(event); + await new DocumentAddGroupNotificationsTask().schedule(event); } async revisionCreated(event: RevisionEvent) { - await RevisionCreatedNotificationsTask.schedule(event); + await new RevisionCreatedNotificationsTask().schedule(event); } async collectionCreated(event: CollectionEvent) { @@ -93,7 +93,7 @@ export default class NotificationsProcessor extends BaseProcessor { return; } - await CollectionCreatedNotificationsTask.schedule(event); + await new CollectionCreatedNotificationsTask().schedule(event); } async collectionAddUser(event: CollectionUserEvent) { @@ -101,14 +101,14 @@ export default class NotificationsProcessor extends BaseProcessor { return; } - await CollectionAddUserNotificationsTask.schedule(event); + await new CollectionAddUserNotificationsTask().schedule(event); } async commentCreated(event: CommentEvent) { - await CommentCreatedNotificationsTask.schedule(event); + await new CommentCreatedNotificationsTask().schedule(event); } async commentUpdated(event: CommentEvent) { - await CommentUpdatedNotificationsTask.schedule(event); + await new CommentUpdatedNotificationsTask().schedule(event); } } diff --git a/server/queues/processors/RevisionsProcessor.ts b/server/queues/processors/RevisionsProcessor.ts index 6f23cd505e..6fb50f79eb 100644 --- a/server/queues/processors/RevisionsProcessor.ts +++ b/server/queues/processors/RevisionsProcessor.ts @@ -37,7 +37,7 @@ export default class RevisionsProcessor extends BaseProcessor { return; } - await DocumentUpdateTextTask.schedule(event); + await new DocumentUpdateTextTask().schedule(event); const user = await User.findByPk(event.actorId, { paranoid: false, diff --git a/server/queues/processors/UserDemotedProcessor.ts b/server/queues/processors/UserDemotedProcessor.ts index a2bc23c561..a68945815c 100644 --- a/server/queues/processors/UserDemotedProcessor.ts +++ b/server/queues/processors/UserDemotedProcessor.ts @@ -6,6 +6,6 @@ export default class UserDemotedProcessor extends BaseProcessor { static applicableEvents: TEvent["name"][] = ["users.demote"]; async perform(event: UserEvent) { - await CleanupDemotedUserTask.schedule({ userId: event.userId }); + await new CleanupDemotedUserTask().schedule({ userId: event.userId }); } } diff --git a/server/queues/tasks/APIImportTask.ts b/server/queues/tasks/APIImportTask.ts index 54856a8d69..391a649c01 100644 --- a/server/queues/tasks/APIImportTask.ts +++ b/server/queues/tasks/APIImportTask.ts @@ -325,7 +325,9 @@ export default abstract class APIImportTask< ([url, attachment]) => ({ attachmentId: attachment.id, url }) ); // publish task after attachments are persisted in DB. - const job = await UploadAttachmentsForImportTask.schedule(uploadItems); + const job = await new UploadAttachmentsForImportTask().schedule( + uploadItems + ); await job.finished(); } catch (err) { // upload attachments failure is not critical enough to fail the whole import. diff --git a/server/queues/tasks/CleanupDeletedTeamsTask.ts b/server/queues/tasks/CleanupDeletedTeamsTask.ts index daaa9d4ab6..ed27c066d3 100644 --- a/server/queues/tasks/CleanupDeletedTeamsTask.ts +++ b/server/queues/tasks/CleanupDeletedTeamsTask.ts @@ -29,7 +29,7 @@ export default class CleanupDeletedTeamsTask extends BaseTask<Props> { }); for (const team of teams) { - await CleanupDeletedTeamTask.schedule({ + await new CleanupDeletedTeamTask().schedule({ teamId: team.id, }); } diff --git a/server/queues/tasks/DetachDraftsFromCollectionTask.ts b/server/queues/tasks/DetachDraftsFromCollectionTask.ts index 8920098671..b6b720ebfb 100644 --- a/server/queues/tasks/DetachDraftsFromCollectionTask.ts +++ b/server/queues/tasks/DetachDraftsFromCollectionTask.ts @@ -7,7 +7,7 @@ import BaseTask from "./BaseTask"; type Props = { collectionId: string; actorId: string; - ip: string; + ip: string | null; }; export default class DetachDraftsFromCollectionTask extends BaseTask<Props> { diff --git a/server/queues/tasks/DocumentAddGroupNotificationsTask.ts b/server/queues/tasks/DocumentAddGroupNotificationsTask.ts index a0eda5641a..8a7c3746cc 100644 --- a/server/queues/tasks/DocumentAddGroupNotificationsTask.ts +++ b/server/queues/tasks/DocumentAddGroupNotificationsTask.ts @@ -1,6 +1,6 @@ import { Op } from "sequelize"; import { GroupUser } from "@server/models"; -import { DocumentGroupEvent } from "@server/types"; +import { DocumentGroupEvent, DocumentUserEvent } from "@server/types"; import BaseTask, { TaskPriority } from "./BaseTask"; import DocumentAddUserNotificationsTask from "./DocumentAddUserNotificationsTask"; @@ -19,11 +19,12 @@ export default class DocumentAddGroupNotificationsTask extends BaseTask<Document async (groupUsers) => { await Promise.all( groupUsers.map(async (groupUser) => { - await DocumentAddUserNotificationsTask.schedule({ + await new DocumentAddUserNotificationsTask().schedule({ ...event, + name: "documents.add_user", modelId: event.data.membershipId, userId: groupUser.userId, - }); + } as DocumentUserEvent); }) ); } diff --git a/server/queues/tasks/DocumentImportTask.ts b/server/queues/tasks/DocumentImportTask.ts index 630c02b8a0..82fc2e64c5 100644 --- a/server/queues/tasks/DocumentImportTask.ts +++ b/server/queues/tasks/DocumentImportTask.ts @@ -12,7 +12,7 @@ type Props = { sourceMetadata: Pick<Required<SourceMetadata>, "fileName" | "mimeType">; publish?: boolean; collectionId?: string; - parentDocumentId?: string; + parentDocumentId?: string | null; ip: string; key: string; }; diff --git a/server/queues/tasks/UpdateTeamsAttachmentsSizeTask.ts b/server/queues/tasks/UpdateTeamsAttachmentsSizeTask.ts index 48c7055033..d91d1b0694 100644 --- a/server/queues/tasks/UpdateTeamsAttachmentsSizeTask.ts +++ b/server/queues/tasks/UpdateTeamsAttachmentsSizeTask.ts @@ -38,7 +38,7 @@ export default class UpdateTeamsAttachmentsSizeTask extends BaseTask<Props> { const teamIds = rows.map((row) => row.teamId); for (const teamId of teamIds) { - await UpdateTeamAttachmentsSizeTask.schedule({ teamId }); + await new UpdateTeamAttachmentsSizeTask().schedule({ teamId }); } } ); diff --git a/server/routes/api/attachments/attachments.ts b/server/routes/api/attachments/attachments.ts index 120052231b..e2147daf0f 100644 --- a/server/routes/api/attachments/attachments.ts +++ b/server/routes/api/attachments/attachments.ts @@ -166,7 +166,7 @@ router.post( ) ); - const job = await UploadAttachmentFromUrlTask.schedule({ + const job = await new UploadAttachmentFromUrlTask().schedule({ attachmentId: attachment.id, url, }); diff --git a/server/routes/api/auth/auth.ts b/server/routes/api/auth/auth.ts index 61b7373c93..ccde1d0c0f 100644 --- a/server/routes/api/auth/auth.ts +++ b/server/routes/api/auth/auth.ts @@ -135,7 +135,7 @@ router.post("auth.info", auth(), async (ctx: APIContext<T.AuthInfoReq>) => { // If the user did not _just_ sign in then we need to check if they continue // to have access to the workspace they are signed into. if (user.lastSignedInAt && user.lastSignedInAt < subHours(new Date(), 1)) { - await ValidateSSOAccessTask.schedule({ userId: user.id }); + await new ValidateSSOAccessTask().schedule({ userId: user.id }); } ctx.body = { diff --git a/server/routes/api/cron/cron.ts b/server/routes/api/cron/cron.ts index 7b4f5f9fd9..c2e072be3c 100644 --- a/server/routes/api/cron/cron.ts +++ b/server/routes/api/cron/cron.ts @@ -29,7 +29,8 @@ const cronHandler = async (ctx: APIContext<T.CronSchemaReq>) => { for (const name in tasks) { const TaskClass = tasks[name]; if (TaskClass.cron === period) { - await TaskClass.schedule({ limit }); + // @ts-expect-error We won't instantiate an abstract class + await new TaskClass().schedule({ limit }); // Backwards compatibility for installations that have not set up // cron jobs periods other than daily. @@ -38,13 +39,15 @@ const cronHandler = async (ctx: APIContext<T.CronSchemaReq>) => { !receivedPeriods.has(TaskSchedule.Minute) && (period === TaskSchedule.Hour || period === TaskSchedule.Day) ) { - await TaskClass.schedule({ limit }); + // @ts-expect-error We won't instantiate an abstract class + await new TaskClass().schedule({ limit }); } else if ( TaskClass.cron === TaskSchedule.Hour && !receivedPeriods.has(TaskSchedule.Hour) && period === TaskSchedule.Day ) { - await TaskClass.schedule({ limit }); + // @ts-expect-error We won't instantiate an abstract class + await new TaskClass().schedule({ limit }); } } diff --git a/server/routes/api/documents/documents.ts b/server/routes/api/documents/documents.ts index a6a015c134..084e766e0e 100644 --- a/server/routes/api/documents/documents.ts +++ b/server/routes/api/documents/documents.ts @@ -1539,7 +1539,7 @@ router.post( acl, }); - const job = await DocumentImportTask.schedule({ + const job = await new DocumentImportTask().schedule({ key, sourceMetadata: { fileName, @@ -1549,6 +1549,7 @@ router.post( collectionId, parentDocumentId, publish, + ip: ctx.request.ip, }); const response: DocumentImportTaskResponse = await job.finished(); if ("error" in response) { @@ -2062,7 +2063,7 @@ router.post( }); if (documents.length) { - await EmptyTrashTask.schedule({ + await new EmptyTrashTask().schedule({ documentIds: documents.map((doc) => doc.id), }); } diff --git a/server/services/cron.ts b/server/services/cron.ts index cd418ea159..7f43f229e8 100644 --- a/server/services/cron.ts +++ b/server/services/cron.ts @@ -7,7 +7,8 @@ export default function init() { for (const name in tasks) { const TaskClass = tasks[name]; if (TaskClass.cron === schedule) { - await TaskClass.schedule({ limit: 10000 }); + // @ts-expect-error We won't instantiate an abstract class + await new TaskClass().schedule({ limit: 10000 }); } } } From fe1307d7e715e2b985b7e1ceac6949ae77f928ea Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 29 Apr 2025 06:48:04 -0400 Subject: [PATCH 30/64] chore(deps): bump the aws group with 5 updates (#9086) Bumps the aws group with 5 updates: | Package | From | To | | --- | --- | --- | | [@aws-sdk/client-s3](https://github.com/aws/aws-sdk-js-v3/tree/HEAD/clients/client-s3) | `3.787.0` | `3.797.0` | | [@aws-sdk/lib-storage](https://github.com/aws/aws-sdk-js-v3/tree/HEAD/lib/lib-storage) | `3.787.0` | `3.797.0` | | [@aws-sdk/s3-presigned-post](https://github.com/aws/aws-sdk-js-v3/tree/HEAD/packages/s3-presigned-post) | `3.787.0` | `3.797.0` | | [@aws-sdk/s3-request-presigner](https://github.com/aws/aws-sdk-js-v3/tree/HEAD/packages/s3-request-presigner) | `3.787.0` | `3.797.0` | | [@aws-sdk/signature-v4-crt](https://github.com/aws/aws-sdk-js-v3/tree/HEAD/packages/signature-v4-crt) | `3.787.0` | `3.796.0` | Updates `@aws-sdk/client-s3` from 3.787.0 to 3.797.0 - [Release notes](https://github.com/aws/aws-sdk-js-v3/releases) - [Changelog](https://github.com/aws/aws-sdk-js-v3/blob/main/clients/client-s3/CHANGELOG.md) - [Commits](https://github.com/aws/aws-sdk-js-v3/commits/v3.797.0/clients/client-s3) Updates `@aws-sdk/lib-storage` from 3.787.0 to 3.797.0 - [Release notes](https://github.com/aws/aws-sdk-js-v3/releases) - [Changelog](https://github.com/aws/aws-sdk-js-v3/blob/main/lib/lib-storage/CHANGELOG.md) - [Commits](https://github.com/aws/aws-sdk-js-v3/commits/v3.797.0/lib/lib-storage) Updates `@aws-sdk/s3-presigned-post` from 3.787.0 to 3.797.0 - [Release notes](https://github.com/aws/aws-sdk-js-v3/releases) - [Changelog](https://github.com/aws/aws-sdk-js-v3/blob/main/packages/s3-presigned-post/CHANGELOG.md) - [Commits](https://github.com/aws/aws-sdk-js-v3/commits/v3.797.0/packages/s3-presigned-post) Updates `@aws-sdk/s3-request-presigner` from 3.787.0 to 3.797.0 - [Release notes](https://github.com/aws/aws-sdk-js-v3/releases) - [Changelog](https://github.com/aws/aws-sdk-js-v3/blob/main/packages/s3-request-presigner/CHANGELOG.md) - [Commits](https://github.com/aws/aws-sdk-js-v3/commits/v3.797.0/packages/s3-request-presigner) Updates `@aws-sdk/signature-v4-crt` from 3.787.0 to 3.796.0 - [Release notes](https://github.com/aws/aws-sdk-js-v3/releases) - [Changelog](https://github.com/aws/aws-sdk-js-v3/blob/main/packages/signature-v4-crt/CHANGELOG.md) - [Commits](https://github.com/aws/aws-sdk-js-v3/commits/v3.796.0/packages/signature-v4-crt) --- updated-dependencies: - dependency-name: "@aws-sdk/client-s3" dependency-version: 3.797.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: aws - dependency-name: "@aws-sdk/lib-storage" dependency-version: 3.797.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: aws - dependency-name: "@aws-sdk/s3-presigned-post" dependency-version: 3.797.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: aws - dependency-name: "@aws-sdk/s3-request-presigner" dependency-version: 3.797.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: aws - dependency-name: "@aws-sdk/signature-v4-crt" dependency-version: 3.796.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: aws ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 10 +- yarn.lock | 284 +++++++++++++++++++++++++-------------------------- 2 files changed, 147 insertions(+), 147 deletions(-) diff --git a/package.json b/package.json index c67806d4fe..3de8ac8f96 100644 --- a/package.json +++ b/package.json @@ -48,11 +48,11 @@ "> 0.25%, not dead" ], "dependencies": { - "@aws-sdk/client-s3": "3.787.0", - "@aws-sdk/lib-storage": "3.787.0", - "@aws-sdk/s3-presigned-post": "3.787.0", - "@aws-sdk/s3-request-presigner": "3.787.0", - "@aws-sdk/signature-v4-crt": "^3.787.0", + "@aws-sdk/client-s3": "3.797.0", + "@aws-sdk/lib-storage": "3.797.0", + "@aws-sdk/s3-presigned-post": "3.797.0", + "@aws-sdk/s3-request-presigner": "3.797.0", + "@aws-sdk/signature-v4-crt": "^3.796.0", "@babel/core": "^7.26.10", "@babel/plugin-proposal-decorators": "^7.25.9", "@babel/plugin-transform-class-properties": "^7.25.9", diff --git a/yarn.lock b/yarn.lock index 1c01265437..908adf2f4c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -105,32 +105,32 @@ "@smithy/util-utf8" "^2.0.0" tslib "^2.6.2" -"@aws-sdk/client-s3@3.787.0": - version "3.787.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/client-s3/-/client-s3-3.787.0.tgz#ebb55ec36cd8f0b7e5e89e48c4d1b6ed1f6156dc" - integrity sha512-eGLCWkN0NlntJ9yPU6OKUggVS4cFvuZJog+cFg1KD5hniLqz7Y0YRtB4uBxW212fK3XCfddgyscEOEeHaTQQTw== +"@aws-sdk/client-s3@3.797.0": + version "3.797.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/client-s3/-/client-s3-3.797.0.tgz#27d809ddc08b4f026bdf3b01c1c43c5cb5d06e43" + integrity sha512-N7pB94mXi4fCt+rYmR9TzfbbwZsWs6Mnk/jDNX9sAZyWkZQnS3AZ/nRtnUmdCimdnOPOMNVjmAoZ4mW3Ff8LDw== dependencies: "@aws-crypto/sha1-browser" "5.2.0" "@aws-crypto/sha256-browser" "5.2.0" "@aws-crypto/sha256-js" "5.2.0" - "@aws-sdk/core" "3.775.0" - "@aws-sdk/credential-provider-node" "3.787.0" + "@aws-sdk/core" "3.796.0" + "@aws-sdk/credential-provider-node" "3.797.0" "@aws-sdk/middleware-bucket-endpoint" "3.775.0" "@aws-sdk/middleware-expect-continue" "3.775.0" - "@aws-sdk/middleware-flexible-checksums" "3.787.0" + "@aws-sdk/middleware-flexible-checksums" "3.796.0" "@aws-sdk/middleware-host-header" "3.775.0" "@aws-sdk/middleware-location-constraint" "3.775.0" "@aws-sdk/middleware-logger" "3.775.0" "@aws-sdk/middleware-recursion-detection" "3.775.0" - "@aws-sdk/middleware-sdk-s3" "3.775.0" + "@aws-sdk/middleware-sdk-s3" "3.796.0" "@aws-sdk/middleware-ssec" "3.775.0" - "@aws-sdk/middleware-user-agent" "3.787.0" + "@aws-sdk/middleware-user-agent" "3.796.0" "@aws-sdk/region-config-resolver" "3.775.0" - "@aws-sdk/signature-v4-multi-region" "3.775.0" + "@aws-sdk/signature-v4-multi-region" "3.796.0" "@aws-sdk/types" "3.775.0" "@aws-sdk/util-endpoints" "3.787.0" "@aws-sdk/util-user-agent-browser" "3.775.0" - "@aws-sdk/util-user-agent-node" "3.787.0" + "@aws-sdk/util-user-agent-node" "3.796.0" "@aws-sdk/xml-builder" "3.775.0" "@smithy/config-resolver" "^4.1.0" "@smithy/core" "^3.2.0" @@ -167,23 +167,23 @@ "@smithy/util-waiter" "^4.0.3" tslib "^2.6.2" -"@aws-sdk/client-sso@3.787.0": - version "3.787.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/client-sso/-/client-sso-3.787.0.tgz#39f1182296b586cb957b449b5f0dabd8f378cf1a" - integrity sha512-L8R+Mh258G0DC73ktpSVrG4TT9i2vmDLecARTDR/4q5sRivdDQSL5bUp3LKcK80Bx+FRw3UETIlX6mYMLL9PJQ== +"@aws-sdk/client-sso@3.797.0": + version "3.797.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/client-sso/-/client-sso-3.797.0.tgz#94d123568830788980cc8712a94d3b20de735e4c" + integrity sha512-9xuR918p7tShR67ZL+AOSbydpJxSHAOdXcQswxxWR/hKCF7tULX7tyL3gNo3l/ETp0CDcStvorOdH/nCbzEOjw== dependencies: "@aws-crypto/sha256-browser" "5.2.0" "@aws-crypto/sha256-js" "5.2.0" - "@aws-sdk/core" "3.775.0" + "@aws-sdk/core" "3.796.0" "@aws-sdk/middleware-host-header" "3.775.0" "@aws-sdk/middleware-logger" "3.775.0" "@aws-sdk/middleware-recursion-detection" "3.775.0" - "@aws-sdk/middleware-user-agent" "3.787.0" + "@aws-sdk/middleware-user-agent" "3.796.0" "@aws-sdk/region-config-resolver" "3.775.0" "@aws-sdk/types" "3.775.0" "@aws-sdk/util-endpoints" "3.787.0" "@aws-sdk/util-user-agent-browser" "3.775.0" - "@aws-sdk/util-user-agent-node" "3.787.0" + "@aws-sdk/util-user-agent-node" "3.796.0" "@smithy/config-resolver" "^4.1.0" "@smithy/core" "^3.2.0" "@smithy/fetch-http-handler" "^5.0.2" @@ -211,40 +211,40 @@ "@smithy/util-utf8" "^4.0.0" tslib "^2.6.2" -"@aws-sdk/core@3.775.0": - version "3.775.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/core/-/core-3.775.0.tgz#5d22ba78f07c07b48fb4d5b18172b9a896c0cbd0" - integrity sha512-8vpW4WihVfz0DX+7WnnLGm3GuQER++b0IwQG35JlQMlgqnc44M//KbJPsIHA0aJUJVwJAEShgfr5dUbY8WUzaA== +"@aws-sdk/core@3.796.0": + version "3.796.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/core/-/core-3.796.0.tgz#6076b78772c1eb97ec6ea9064c85ce500e0aa889" + integrity sha512-tH8Sp7lCxISVoLnkyv4AouuXs2CDlMhTuesWa0lq2NX1f+DXsMwSBtN37ttZdpFMw3F8mWdsJt27X9h2Oq868A== dependencies: "@aws-sdk/types" "3.775.0" "@smithy/core" "^3.2.0" "@smithy/node-config-provider" "^4.0.2" "@smithy/property-provider" "^4.0.2" "@smithy/protocol-http" "^5.1.0" - "@smithy/signature-v4" "^5.0.2" + "@smithy/signature-v4" "^5.1.0" "@smithy/smithy-client" "^4.2.0" "@smithy/types" "^4.2.0" "@smithy/util-middleware" "^4.0.2" fast-xml-parser "4.4.1" tslib "^2.6.2" -"@aws-sdk/credential-provider-env@3.775.0": - version "3.775.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/credential-provider-env/-/credential-provider-env-3.775.0.tgz#b8c81818f4c62d89b5f04dc410ab9b48e954f22c" - integrity sha512-6ESVxwCbGm7WZ17kY1fjmxQud43vzJFoLd4bmlR+idQSWdqlzGDYdcfzpjDKTcivdtNrVYmFvcH1JBUwCRAZhw== +"@aws-sdk/credential-provider-env@3.796.0": + version "3.796.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/credential-provider-env/-/credential-provider-env-3.796.0.tgz#4ed6903814868b0f9daa8c8db449b1f1adcda041" + integrity sha512-kQzGKm4IOYYO6vUrai2JocNwhJm4Aml2BsAV+tBhFhhkutE7khf9PUucoVjB78b0J48nF+kdSacqzY+gB81/Uw== dependencies: - "@aws-sdk/core" "3.775.0" + "@aws-sdk/core" "3.796.0" "@aws-sdk/types" "3.775.0" "@smithy/property-provider" "^4.0.2" "@smithy/types" "^4.2.0" tslib "^2.6.2" -"@aws-sdk/credential-provider-http@3.775.0": - version "3.775.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/credential-provider-http/-/credential-provider-http-3.775.0.tgz#0fbc7f4e6cada37fc9b647de0d7c12a42a44bcc6" - integrity sha512-PjDQeDH/J1S0yWV32wCj2k5liRo0ssXMseCBEkCsD3SqsU8o5cU82b0hMX4sAib/RkglCSZqGO0xMiN0/7ndww== +"@aws-sdk/credential-provider-http@3.796.0": + version "3.796.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/credential-provider-http/-/credential-provider-http-3.796.0.tgz#7f36074021b2605dba4b758b4b0ca98fb5b965ad" + integrity sha512-wWOT6VAHIKOuHdKFGm1iyKvx7f6+Kc/YTzFWJPuT+l+CPlXR6ylP1UMIDsHHLKpMzsrh3CH77QDsjkhQrnKkfg== dependencies: - "@aws-sdk/core" "3.775.0" + "@aws-sdk/core" "3.796.0" "@aws-sdk/types" "3.775.0" "@smithy/fetch-http-handler" "^5.0.2" "@smithy/node-http-handler" "^4.0.4" @@ -255,18 +255,18 @@ "@smithy/util-stream" "^4.2.0" tslib "^2.6.2" -"@aws-sdk/credential-provider-ini@3.787.0": - version "3.787.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/credential-provider-ini/-/credential-provider-ini-3.787.0.tgz#906ece004141462ae695504b6c07d1200688fd6c" - integrity sha512-hc2taRoDlXn2uuNuHWDJljVWYrp3r9JF1a/8XmOAZhVUNY+ImeeStylHXhXXKEA4JOjW+5PdJj0f1UDkVCHJiQ== +"@aws-sdk/credential-provider-ini@3.797.0": + version "3.797.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/credential-provider-ini/-/credential-provider-ini-3.797.0.tgz#e617edac6dbd761e13826d49092b85a337bf29a2" + integrity sha512-Zpj6pJ2hnebrhLDr+x61ArMUkjHG6mfJRfamHxeVTgZkhLcwHjC5aM4u9pWTVugIaPY+VBtgkKPbi3TRbHlt2g== dependencies: - "@aws-sdk/core" "3.775.0" - "@aws-sdk/credential-provider-env" "3.775.0" - "@aws-sdk/credential-provider-http" "3.775.0" - "@aws-sdk/credential-provider-process" "3.775.0" - "@aws-sdk/credential-provider-sso" "3.787.0" - "@aws-sdk/credential-provider-web-identity" "3.787.0" - "@aws-sdk/nested-clients" "3.787.0" + "@aws-sdk/core" "3.796.0" + "@aws-sdk/credential-provider-env" "3.796.0" + "@aws-sdk/credential-provider-http" "3.796.0" + "@aws-sdk/credential-provider-process" "3.796.0" + "@aws-sdk/credential-provider-sso" "3.797.0" + "@aws-sdk/credential-provider-web-identity" "3.797.0" + "@aws-sdk/nested-clients" "3.797.0" "@aws-sdk/types" "3.775.0" "@smithy/credential-provider-imds" "^4.0.2" "@smithy/property-provider" "^4.0.2" @@ -274,17 +274,17 @@ "@smithy/types" "^4.2.0" tslib "^2.6.2" -"@aws-sdk/credential-provider-node@3.787.0": - version "3.787.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/credential-provider-node/-/credential-provider-node-3.787.0.tgz#3e5cdafb0fecca25b7430f848cbca85000b25c33" - integrity sha512-JioVi44B1vDMaK2CdzqimwvJD3uzvzbQhaEWXsGMBcMcNHajXAXf08EF50JG3ZhLrhhUsT1ObXpbTaPINOhh+g== +"@aws-sdk/credential-provider-node@3.797.0": + version "3.797.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/credential-provider-node/-/credential-provider-node-3.797.0.tgz#bf82e239b14c8fcc7da660c2bc1ec042123638d9" + integrity sha512-xJSWvvnmzEfHbqbpN4F3E3mI9+zJ/VWLGiKOjzX1Inbspa5WqNn2GoMamolZR2TvvZS4F3Hp73TD1WoBzkIjuw== dependencies: - "@aws-sdk/credential-provider-env" "3.775.0" - "@aws-sdk/credential-provider-http" "3.775.0" - "@aws-sdk/credential-provider-ini" "3.787.0" - "@aws-sdk/credential-provider-process" "3.775.0" - "@aws-sdk/credential-provider-sso" "3.787.0" - "@aws-sdk/credential-provider-web-identity" "3.787.0" + "@aws-sdk/credential-provider-env" "3.796.0" + "@aws-sdk/credential-provider-http" "3.796.0" + "@aws-sdk/credential-provider-ini" "3.797.0" + "@aws-sdk/credential-provider-process" "3.796.0" + "@aws-sdk/credential-provider-sso" "3.797.0" + "@aws-sdk/credential-provider-web-identity" "3.797.0" "@aws-sdk/types" "3.775.0" "@smithy/credential-provider-imds" "^4.0.2" "@smithy/property-provider" "^4.0.2" @@ -292,57 +292,57 @@ "@smithy/types" "^4.2.0" tslib "^2.6.2" -"@aws-sdk/credential-provider-process@3.775.0": - version "3.775.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/credential-provider-process/-/credential-provider-process-3.775.0.tgz#7ab90383f12461c5d20546e933924e654660542b" - integrity sha512-A6k68H9rQp+2+7P7SGO90Csw6nrUEm0Qfjpn9Etc4EboZhhCLs9b66umUsTsSBHus4FDIe5JQxfCUyt1wgNogg== +"@aws-sdk/credential-provider-process@3.796.0": + version "3.796.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/credential-provider-process/-/credential-provider-process-3.796.0.tgz#d22d8adf73985fb218ff74365cd86b71bbd64513" + integrity sha512-r4e8/4AdKn/qQbRVocW7oXkpoiuXdTv0qty8AASNLnbQnT1vjD1bvmP6kp4fbHPWgwY8I9h0Dqjp49uy9Bqyuw== dependencies: - "@aws-sdk/core" "3.775.0" + "@aws-sdk/core" "3.796.0" "@aws-sdk/types" "3.775.0" "@smithy/property-provider" "^4.0.2" "@smithy/shared-ini-file-loader" "^4.0.2" "@smithy/types" "^4.2.0" tslib "^2.6.2" -"@aws-sdk/credential-provider-sso@3.787.0": - version "3.787.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/credential-provider-sso/-/credential-provider-sso-3.787.0.tgz#77ab6c01e4497d7ff2e6c7f081f3d8695744884b" - integrity sha512-fHc08bsvwm4+dEMEQKnQ7c1irEQmmxbgS+Fq41y09pPvPh31nAhoMcjBSTWAaPHvvsRbTYvmP4Mf12ZGr8/nfg== +"@aws-sdk/credential-provider-sso@3.797.0": + version "3.797.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/credential-provider-sso/-/credential-provider-sso-3.797.0.tgz#ea22714498157c937acd3170660b10ae0348366a" + integrity sha512-VlyWnjTsTnBXqXcEW0nw3S7nj00n9fYwF6uU6HPO9t860yIySG01lNPAWTvAt3DfVL5SRS0GANriCZF6ohcMcQ== dependencies: - "@aws-sdk/client-sso" "3.787.0" - "@aws-sdk/core" "3.775.0" - "@aws-sdk/token-providers" "3.787.0" + "@aws-sdk/client-sso" "3.797.0" + "@aws-sdk/core" "3.796.0" + "@aws-sdk/token-providers" "3.797.0" "@aws-sdk/types" "3.775.0" "@smithy/property-provider" "^4.0.2" "@smithy/shared-ini-file-loader" "^4.0.2" "@smithy/types" "^4.2.0" tslib "^2.6.2" -"@aws-sdk/credential-provider-web-identity@3.787.0": - version "3.787.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/credential-provider-web-identity/-/credential-provider-web-identity-3.787.0.tgz#d492d1f4a90b70f3a71a65f11b8d3ef79fb2759e" - integrity sha512-SobmCwNbk6TfEsF283mZPQEI5vV2j6eY5tOCj8Er4Lzraxu9fBPADV+Bib2A8F6jlB1lMPJzOuDCbEasSt/RIw== +"@aws-sdk/credential-provider-web-identity@3.797.0": + version "3.797.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/credential-provider-web-identity/-/credential-provider-web-identity-3.797.0.tgz#e52b5a054a71f83ffafe3461b41851d5008d84de" + integrity sha512-DIb05FEmdOX7bNsqSVEAB3UkaDgrYHonQ2+gcBLqZ7LoDNnovHIlvC5jii93usgEStxITZstnzw+49keNEgVWw== dependencies: - "@aws-sdk/core" "3.775.0" - "@aws-sdk/nested-clients" "3.787.0" + "@aws-sdk/core" "3.796.0" + "@aws-sdk/nested-clients" "3.797.0" "@aws-sdk/types" "3.775.0" "@smithy/property-provider" "^4.0.2" "@smithy/types" "^4.2.0" tslib "^2.6.2" -"@aws-sdk/crt-loader@3.787.0": - version "3.787.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/crt-loader/-/crt-loader-3.787.0.tgz#570c7e3cc79d20b2391beb1dafe2215343a9ac29" - integrity sha512-NQWFDkYF/lzz2m3icdVr+a0Ua/fN4dij3GPwU+Hr/nzrFR6z7txG3U4m2zkSELJ0PDT4k/1NsgmnQlpyxg0NDg== +"@aws-sdk/crt-loader@3.796.0": + version "3.796.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/crt-loader/-/crt-loader-3.796.0.tgz#1cba5b2ea9f50b7a904cb5902a7751b90b65b1b3" + integrity sha512-dfTl4hCDKJSJTq4mPSQsv65p9XlYof+SVWKxQRu6OQBCOuhGPEhr7vN0byONBdwjhiY0WECjCANDi84lDVysdQ== dependencies: - "@aws-sdk/util-user-agent-node" "3.787.0" + "@aws-sdk/util-user-agent-node" "3.796.0" aws-crt "^1.24.0" tslib "^2.6.2" -"@aws-sdk/lib-storage@3.787.0": - version "3.787.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/lib-storage/-/lib-storage-3.787.0.tgz#fb7af2a869c31948073e7480ed1003c9755d35c4" - integrity sha512-iIMbmd9uASD3KFfGeH/OeVo4oxAeqbuXDmhoVEJb4M0hZ4yJ2o9v1V0TEaHwIXcrdlc0H8rCpd9opmV74MBxrA== +"@aws-sdk/lib-storage@3.797.0": + version "3.797.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/lib-storage/-/lib-storage-3.797.0.tgz#8947c3f27fcd7b77ce171929b2ee96feed9ba3b7" + integrity sha512-hGacJXiFBnhkDhDuirptViR0ZfpvE6ENt+xJFV76F5OX8RvO7UhEkq9wdq/GzlSwrPB2XBfoYQgdtHJpjHs2zA== dependencies: "@smithy/abort-controller" "^4.0.2" "@smithy/middleware-endpoint" "^4.1.0" @@ -375,15 +375,15 @@ "@smithy/types" "^4.2.0" tslib "^2.6.2" -"@aws-sdk/middleware-flexible-checksums@3.787.0": - version "3.787.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/middleware-flexible-checksums/-/middleware-flexible-checksums-3.787.0.tgz#bc887dcfd0193a41eef6b58c18c682478a108b07" - integrity sha512-X71qEwWoixFmwowWzlPoZUR3u1CWJ7iAzU0EzIxqmPhQpQJLFmdL1+SRjqATynDPZQzLs1a5HBtPT++EnZ+Quw== +"@aws-sdk/middleware-flexible-checksums@3.796.0": + version "3.796.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/middleware-flexible-checksums/-/middleware-flexible-checksums-3.796.0.tgz#c5a13c5dc7fd217e3d3514d3a75ae71c4b0ce5c6" + integrity sha512-JTqnyzGlbvXDcEnBtd5LFNrCFKUHnGyp/V9+BkvzNP02WXABLWzYvj1TCaf5pQySwK/b4kVn5lvbpTi0rXqjZw== dependencies: "@aws-crypto/crc32" "5.2.0" "@aws-crypto/crc32c" "5.2.0" "@aws-crypto/util" "5.2.0" - "@aws-sdk/core" "3.775.0" + "@aws-sdk/core" "3.796.0" "@aws-sdk/types" "3.775.0" "@smithy/is-array-buffer" "^4.0.0" "@smithy/node-config-provider" "^4.0.2" @@ -432,18 +432,18 @@ "@smithy/types" "^4.2.0" tslib "^2.6.2" -"@aws-sdk/middleware-sdk-s3@3.775.0": - version "3.775.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/middleware-sdk-s3/-/middleware-sdk-s3-3.775.0.tgz#7b65832ec5a9ccccc8c7337780f722fa59f09d41" - integrity sha512-zsvcu7cWB28JJ60gVvjxPCI7ZU7jWGcpNACPiZGyVtjYXwcxyhXbYEVDSWKsSA6ERpz9XrpLYod8INQWfW3ECg== +"@aws-sdk/middleware-sdk-s3@3.796.0": + version "3.796.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/middleware-sdk-s3/-/middleware-sdk-s3-3.796.0.tgz#f20d77f02f27fd47178500581ae340f012652004" + integrity sha512-5o78oE79sGOtYkL7Up02h2nmr9UhGQZJgxE29EBdTw4dZ1EaA46L+C8oA+fBCmAB5xPQsjQqvhRrsr4Lcp+jZQ== dependencies: - "@aws-sdk/core" "3.775.0" + "@aws-sdk/core" "3.796.0" "@aws-sdk/types" "3.775.0" "@aws-sdk/util-arn-parser" "3.723.0" "@smithy/core" "^3.2.0" "@smithy/node-config-provider" "^4.0.2" "@smithy/protocol-http" "^5.1.0" - "@smithy/signature-v4" "^5.0.2" + "@smithy/signature-v4" "^5.1.0" "@smithy/smithy-client" "^4.2.0" "@smithy/types" "^4.2.0" "@smithy/util-config-provider" "^4.0.0" @@ -461,12 +461,12 @@ "@smithy/types" "^4.2.0" tslib "^2.6.2" -"@aws-sdk/middleware-user-agent@3.787.0": - version "3.787.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/middleware-user-agent/-/middleware-user-agent-3.787.0.tgz#3d657c0ba1aec72bca079f4691ba20f25569fcfc" - integrity sha512-Lnfj8SmPLYtrDFthNIaNj66zZsBCam+E4XiUDr55DIHTGstH6qZ/q6vg0GfbukxwSmUcGMwSR4Qbn8rb8yd77g== +"@aws-sdk/middleware-user-agent@3.796.0": + version "3.796.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/middleware-user-agent/-/middleware-user-agent-3.796.0.tgz#80149d7f9034d41d35de88d96a6b73c1cb06413b" + integrity sha512-IeNg+3jNWT37J45opi5Jx89hGF0lOnZjiNwlMp3rKq7PlOqy8kWq5J1Gxk0W3tIkPpuf68CtBs/QFrRXWOjsZw== dependencies: - "@aws-sdk/core" "3.775.0" + "@aws-sdk/core" "3.796.0" "@aws-sdk/types" "3.775.0" "@aws-sdk/util-endpoints" "3.787.0" "@smithy/core" "^3.2.0" @@ -474,23 +474,23 @@ "@smithy/types" "^4.2.0" tslib "^2.6.2" -"@aws-sdk/nested-clients@3.787.0": - version "3.787.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/nested-clients/-/nested-clients-3.787.0.tgz#e8a5a6e7d0b599a7f9f15b900d3223ad080b0a81" - integrity sha512-xk03q1xpKNHgbuo+trEf1dFrI239kuMmjKKsqLEsHlAZbuFq4yRGMlHBrVMnKYOPBhVFDS/VineM991XI52fKg== +"@aws-sdk/nested-clients@3.797.0": + version "3.797.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/nested-clients/-/nested-clients-3.797.0.tgz#59699196a9b3fa43b021bdf1715e531d74885f75" + integrity sha512-xCsRKdsv0GAg9E28fvYBdC3JR2xdtZ2o41MVknOs+pSFtMsZm3SsgxObN35p1OTMk/o/V0LORGVLnFQMlc5QiA== dependencies: "@aws-crypto/sha256-browser" "5.2.0" "@aws-crypto/sha256-js" "5.2.0" - "@aws-sdk/core" "3.775.0" + "@aws-sdk/core" "3.796.0" "@aws-sdk/middleware-host-header" "3.775.0" "@aws-sdk/middleware-logger" "3.775.0" "@aws-sdk/middleware-recursion-detection" "3.775.0" - "@aws-sdk/middleware-user-agent" "3.787.0" + "@aws-sdk/middleware-user-agent" "3.796.0" "@aws-sdk/region-config-resolver" "3.775.0" "@aws-sdk/types" "3.775.0" "@aws-sdk/util-endpoints" "3.787.0" "@aws-sdk/util-user-agent-browser" "3.775.0" - "@aws-sdk/util-user-agent-node" "3.787.0" + "@aws-sdk/util-user-agent-node" "3.796.0" "@smithy/config-resolver" "^4.1.0" "@smithy/core" "^3.2.0" "@smithy/fetch-http-handler" "^5.0.2" @@ -530,27 +530,27 @@ "@smithy/util-middleware" "^4.0.2" tslib "^2.6.2" -"@aws-sdk/s3-presigned-post@3.787.0": - version "3.787.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/s3-presigned-post/-/s3-presigned-post-3.787.0.tgz#06b73ff35afc165a3208fc9a858b12a1e53d5148" - integrity sha512-/mM9VvdjC5fBa1WqlygmjTZ4R2fNsMjSc03JfdtcLWDShFZ61gungGZVSvsBbwh/YcVe1sKOnJz4qBQxl/ey8g== +"@aws-sdk/s3-presigned-post@3.797.0": + version "3.797.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/s3-presigned-post/-/s3-presigned-post-3.797.0.tgz#37f87d205bbb649c82ecd0ce1831755e4ff25d7b" + integrity sha512-imfnmmH4P6hVh7NE51wP5FoBzyzph2dYqzAC/bF2bXjCv+/FaiPEt598K0A1mt4BUB5Y+0J3GcigOwzWHFU/SA== dependencies: - "@aws-sdk/client-s3" "3.787.0" + "@aws-sdk/client-s3" "3.797.0" "@aws-sdk/types" "3.775.0" "@aws-sdk/util-format-url" "3.775.0" "@smithy/middleware-endpoint" "^4.1.0" - "@smithy/signature-v4" "^5.0.2" + "@smithy/signature-v4" "^5.1.0" "@smithy/types" "^4.2.0" "@smithy/util-hex-encoding" "^4.0.0" "@smithy/util-utf8" "^4.0.0" tslib "^2.6.2" -"@aws-sdk/s3-request-presigner@3.787.0": - version "3.787.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/s3-request-presigner/-/s3-request-presigner-3.787.0.tgz#1a8eadf330446e53cdca11fa0c08ae3d45a00f9c" - integrity sha512-WBm0AS3RRURNN0yjYXHaiI692boVwWXGt3RLdI7tYBX58E1Zb5nzC8rlk81O9Xe7ZTgTC1KCr8y4+jcBD+zwJg== +"@aws-sdk/s3-request-presigner@3.797.0": + version "3.797.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/s3-request-presigner/-/s3-request-presigner-3.797.0.tgz#f375beb8a892f2b8452d0d6da38bd60f46afc4ab" + integrity sha512-ncEsGwmQIkXi3IREbGLC6X5sY38WM1WUAdaU5uQmBPOGEVQHtDyrIObBsIzK99j83SGWi8RqO7/n0jMGZPmeQw== dependencies: - "@aws-sdk/signature-v4-multi-region" "3.775.0" + "@aws-sdk/signature-v4-multi-region" "3.796.0" "@aws-sdk/types" "3.775.0" "@aws-sdk/util-format-url" "3.775.0" "@smithy/middleware-endpoint" "^4.1.0" @@ -559,38 +559,38 @@ "@smithy/types" "^4.2.0" tslib "^2.6.2" -"@aws-sdk/signature-v4-crt@^3.787.0": - version "3.787.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/signature-v4-crt/-/signature-v4-crt-3.787.0.tgz#6932f0f437536fc528d4cc45a79daf08819d64a3" - integrity sha512-TATbx7B/54UIyLawAM0eTkQfnfn9KlEXV1jymniEHQtsfL68VND9/uFdOp51Ob9eTo5Q3qghH0RMHZaOpRVuGA== +"@aws-sdk/signature-v4-crt@^3.796.0": + version "3.796.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/signature-v4-crt/-/signature-v4-crt-3.796.0.tgz#28df0cf702aa7e2c5e50e359776bf0f36b648e0b" + integrity sha512-RCYhLuRE8mhzpE5DzU3Mu11M1KdC480OQ+coB/h0c39VlYkcE8MGTB+eOjGOoYQx3RtFBs/y0RTSR4kj8Oo21Q== dependencies: - "@aws-sdk/crt-loader" "3.787.0" - "@aws-sdk/signature-v4-multi-region" "3.775.0" + "@aws-sdk/crt-loader" "3.796.0" + "@aws-sdk/signature-v4-multi-region" "3.796.0" "@aws-sdk/types" "3.775.0" "@smithy/querystring-parser" "^4.0.2" - "@smithy/signature-v4" "^5.0.2" + "@smithy/signature-v4" "^5.1.0" "@smithy/types" "^4.2.0" "@smithy/util-middleware" "^4.0.2" tslib "^2.6.2" -"@aws-sdk/signature-v4-multi-region@3.775.0": - version "3.775.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/signature-v4-multi-region/-/signature-v4-multi-region-3.775.0.tgz#80cf60f3c9a9ea00f86529f2c4497a8ce936960a" - integrity sha512-cnGk8GDfTMJ8p7+qSk92QlIk2bmTmFJqhYxcXZ9PysjZtx0xmfCMxnG3Hjy1oU2mt5boPCVSOptqtWixayM17g== +"@aws-sdk/signature-v4-multi-region@3.796.0": + version "3.796.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/signature-v4-multi-region/-/signature-v4-multi-region-3.796.0.tgz#b32b0ee252c87a7c18c215407b1f189927ef850c" + integrity sha512-JAOLdvazTc9HlTFslSrIOrKRMuOruuM3FeGw0hyfLP/RIbjd9bqe/xLIzDSJr3wpCpJs0sXoofwJgXtgTipvjA== dependencies: - "@aws-sdk/middleware-sdk-s3" "3.775.0" + "@aws-sdk/middleware-sdk-s3" "3.796.0" "@aws-sdk/types" "3.775.0" "@smithy/protocol-http" "^5.1.0" - "@smithy/signature-v4" "^5.0.2" + "@smithy/signature-v4" "^5.1.0" "@smithy/types" "^4.2.0" tslib "^2.6.2" -"@aws-sdk/token-providers@3.787.0": - version "3.787.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/token-providers/-/token-providers-3.787.0.tgz#18c761fb21ee25c8c3a35703876f0c733b4ae743" - integrity sha512-d7/NIqxq308Zg0RPMNrmn0QvzniL4Hx8Qdwzr6YZWLYAbUSvZYS2ppLR3BFWSkV6SsTJUx8BuDaj3P8vttkrog== +"@aws-sdk/token-providers@3.797.0": + version "3.797.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/token-providers/-/token-providers-3.797.0.tgz#9f8c316f1adfda592c8dc6e69082879896720696" + integrity sha512-TLFkP4BBdkH2zCXhG3JjaYrRft25MMZ+6/YDz1C/ikq2Zk8krUbVoSmhtYMVz10JtxAPiQ++w0vI/qbz2JSDXg== dependencies: - "@aws-sdk/nested-clients" "3.787.0" + "@aws-sdk/nested-clients" "3.797.0" "@aws-sdk/types" "3.775.0" "@smithy/property-provider" "^4.0.2" "@smithy/shared-ini-file-loader" "^4.0.2" @@ -649,12 +649,12 @@ bowser "^2.11.0" tslib "^2.6.2" -"@aws-sdk/util-user-agent-node@3.787.0": - version "3.787.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/util-user-agent-node/-/util-user-agent-node-3.787.0.tgz#58e63e99586cde1c1314f74b94596780321442f5" - integrity sha512-mG7Lz8ydfG4SF9e8WSXiPQ/Lsn3n8A5B5jtPROidafi06I3ckV2WxyMLdwG14m919NoS6IOfWHyRGSqWIwbVKA== +"@aws-sdk/util-user-agent-node@3.796.0": + version "3.796.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/util-user-agent-node/-/util-user-agent-node-3.796.0.tgz#72c2ea1f32d2eb1200e111f48fd8a3c005f5202c" + integrity sha512-9fQpNcHgVFitf1tbTT8V1xGRoRHSmOAWjrhevo6Tc0WoINMAKz+4JNqfVGWRE5Tmtpq0oHKo1RmvxXQQtJYciA== dependencies: - "@aws-sdk/middleware-user-agent" "3.787.0" + "@aws-sdk/middleware-user-agent" "3.796.0" "@aws-sdk/types" "3.775.0" "@smithy/node-config-provider" "^4.0.2" "@smithy/types" "^4.2.0" @@ -4372,10 +4372,10 @@ "@smithy/types" "^4.2.0" tslib "^2.6.2" -"@smithy/signature-v4@^5.0.2": - version "5.0.2" - resolved "https://registry.yarnpkg.com/@smithy/signature-v4/-/signature-v4-5.0.2.tgz#363854e946fbc5bc206ff82e79ada5d5c14be640" - integrity sha512-Mz+mc7okA73Lyz8zQKJNyr7lIcHLiPYp0+oiqiMNc/t7/Kf2BENs5d63pEj7oPqdjaum6g0Fc8wC78dY1TgtXw== +"@smithy/signature-v4@^5.1.0": + version "5.1.0" + resolved "https://registry.yarnpkg.com/@smithy/signature-v4/-/signature-v4-5.1.0.tgz#2c56e5b278482b04383d84ea2c07b7f0a8eb8f63" + integrity sha512-4t5WX60sL3zGJF/CtZsUQTs3UrZEDO2P7pEaElrekbLqkWPYkgqNW1oeiNYC6xXifBnT9dVBOnNQRvOE9riU9w== dependencies: "@smithy/is-array-buffer" "^4.0.0" "@smithy/protocol-http" "^5.1.0" From 18743da2fce683697106f2614574d3b0b72023cc Mon Sep 17 00:00:00 2001 From: Tom Moor <tom@getoutline.com> Date: Tue, 29 Apr 2025 21:50:52 -0400 Subject: [PATCH 31/64] fix: bold inline code marks cause formatting to split (#9105) * fix: Inline code mark split around bold * Show inline formatting options + code in toolbar --- app/editor/menus/formatting.tsx | 6 +++--- shared/editor/nodes/index.ts | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/editor/menus/formatting.tsx b/app/editor/menus/formatting.tsx index 3baf9e0044..e453a01228 100644 --- a/app/editor/menus/formatting.tsx +++ b/app/editor/menus/formatting.tsx @@ -67,7 +67,7 @@ export default function formattingMenuItems( shortcut: `${metaDisplay}+B`, icon: <BoldIcon />, active: isMarkActive(schema.marks.strong), - visible: !isCode && (!isMobile || !isEmpty), + visible: !isCodeBlock && (!isMobile || !isEmpty), }, { name: "em", @@ -75,7 +75,7 @@ export default function formattingMenuItems( shortcut: `${metaDisplay}+I`, icon: <ItalicIcon />, active: isMarkActive(schema.marks.em), - visible: !isCode && (!isMobile || !isEmpty), + visible: !isCodeBlock && (!isMobile || !isEmpty), }, { name: "strikethrough", @@ -83,7 +83,7 @@ export default function formattingMenuItems( shortcut: `${metaDisplay}+D`, icon: <StrikethroughIcon />, active: isMarkActive(schema.marks.strikethrough), - visible: !isCode && (!isMobile || !isEmpty), + visible: !isCodeBlock && (!isMobile || !isEmpty), }, { tooltip: dictionary.mark, diff --git a/shared/editor/nodes/index.ts b/shared/editor/nodes/index.ts index 1cf9efff98..aa228a1f4b 100644 --- a/shared/editor/nodes/index.ts +++ b/shared/editor/nodes/index.ts @@ -56,8 +56,8 @@ export const basicExtensions: Nodes = [ Emoji, Text, SimpleImage, - Bold, Code, + Bold, Italic, Underline, Link, From 3ef2b7cf42991fb4a735c4390e6e3b4515ee1c07 Mon Sep 17 00:00:00 2001 From: Tom Moor <tom@getoutline.com> Date: Tue, 29 Apr 2025 22:17:03 -0400 Subject: [PATCH 32/64] fix: Backlinks should be ordered alphabetically (#9106) --- app/models/Document.ts | 10 ++++++++++ app/scenes/Document/components/References.tsx | 8 +++----- app/stores/DocumentsStore.ts | 4 ++-- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/app/models/Document.ts b/app/models/Document.ts index 0e4a4d0a64..2501ae9e80 100644 --- a/app/models/Document.ts +++ b/app/models/Document.ts @@ -331,6 +331,16 @@ export default class Document extends ArchivableModel implements Searchable { ); } + /** + * Returns the documents that link to this document. + * + * @returns documents that link to this document + */ + @computed + get backlinks(): Document[] { + return this.store.getBacklinkedDocuments(this.id); + } + /** * Returns users that have been individually given access to the document. * diff --git a/app/scenes/Document/components/References.tsx b/app/scenes/Document/components/References.tsx index 8ed91d1df1..591ecf9587 100644 --- a/app/scenes/Document/components/References.tsx +++ b/app/scenes/Document/components/References.tsx @@ -18,7 +18,7 @@ type Props = { }; function References({ document }: Props) { - const { collections, documents } = useStores(); + const { documents } = useStores(); const user = useCurrentUser(); const location = useLocation(); const locationSidebarContext = useLocationSidebarContext(); @@ -27,10 +27,8 @@ function References({ document }: Props) { void documents.fetchBacklinks(document.id); }, [documents, document.id]); - const backlinks = documents.getBacklinkedDocuments(document.id); - const collection = document.collectionId - ? collections.get(document.collectionId) - : undefined; + const backlinks = document.backlinks; + const collection = document.collection; const children = collection ? collection.getChildrenForDocument(document.id) : []; diff --git a/app/stores/DocumentsStore.ts b/app/stores/DocumentsStore.ts index 32ede115a2..13d249ccc8 100644 --- a/app/stores/DocumentsStore.ts +++ b/app/stores/DocumentsStore.ts @@ -300,8 +300,8 @@ export default class DocumentsStore extends Store<Document> { const documentIds = this.backlinks.get(documentId) || []; return orderBy( compact(documentIds.map((id) => this.data.get(id))), - "updatedAt", - "desc" + "title", + "asc" ); } From 00bab31cffdc5e2f784bb229b9029fc0e2e85eb1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 30 Apr 2025 18:16:38 -0400 Subject: [PATCH 33/64] chore(deps): bump vite from 6.3.3 to 6.3.4 (#9112) Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 6.3.3 to 6.3.4. - [Release notes](https://github.com/vitejs/vite/releases) - [Changelog](https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md) - [Commits](https://github.com/vitejs/vite/commits/v6.3.4/packages/vite) --- updated-dependencies: - dependency-name: vite dependency-version: 6.3.4 dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 3de8ac8f96..55385e8b4f 100644 --- a/package.json +++ b/package.json @@ -249,7 +249,7 @@ "uuid": "^8.3.2", "validator": "13.12.0", "vaul": "^1.1.2", - "vite": "^6.3.3", + "vite": "^6.3.4", "vite-plugin-pwa": "^0.21.2", "winston": "^3.17.0", "ws": "^7.5.10", diff --git a/yarn.lock b/yarn.lock index 908adf2f4c..f820f25cf6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -15745,10 +15745,10 @@ vite-plugin-static-copy@^0.17.0: fs-extra "^11.1.0" picocolors "^1.0.0" -vite@^6.3.3: - version "6.3.3" - resolved "https://registry.yarnpkg.com/vite/-/vite-6.3.3.tgz#497392c3f2243194e4dbf09ea83e9a3dddf49b88" - integrity sha512-5nXH+QsELbFKhsEfWLkHrvgRpTdGJzqOZ+utSdmPTvwHmvU6ITTm3xx+mRusihkcI8GeC7lCDyn3kDtiki9scw== +vite@^6.3.4: + version "6.3.4" + resolved "https://registry.yarnpkg.com/vite/-/vite-6.3.4.tgz#d441a72c7cd9a93b719bb851250a4e6c119c9cff" + integrity sha512-BiReIiMS2fyFqbqNT/Qqt4CVITDU9M9vE+DKcVAsB+ZV0wvTKd+3hMbkpxz1b+NmEDMegpVbisKiAZOnvO92Sw== dependencies: esbuild "^0.25.0" fdir "^6.4.4" From 3602198cd8c34d6f17b7a8caf87280d3a8ce2791 Mon Sep 17 00:00:00 2001 From: Tom Moor <tom@getoutline.com> Date: Fri, 2 May 2025 08:19:41 -0400 Subject: [PATCH 34/64] fix: Subtle collection loading bug (#9120) --- app/scenes/Collection/index.tsx | 18 ++++++------------ app/stores/CollectionsStore.ts | 7 +++++++ 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/app/scenes/Collection/index.tsx b/app/scenes/Collection/index.tsx index 7568a8c174..b3c5597714 100644 --- a/app/scenes/Collection/index.tsx +++ b/app/scenes/Collection/index.tsx @@ -66,7 +66,6 @@ const CollectionScene = observer(function _CollectionScene() { const location = useLocation(); const { t } = useTranslation(); const { documents, collections, ui } = useStores(); - const [isFetching, setFetching] = React.useState(false); const [error, setError] = React.useState<Error | undefined>(); const currentPath = location.pathname; const [, setLastVisitedPath] = useLastVisitedPath(); @@ -120,21 +119,16 @@ const CollectionScene = observer(function _CollectionScene() { React.useEffect(() => { async function fetchData() { - if ((!can || !collection) && !error && !isFetching) { - try { - setError(undefined); - setFetching(true); - await collections.fetch(id); - } catch (err) { - setError(err); - } finally { - setFetching(false); - } + try { + setError(undefined); + await collections.fetch(id); + } catch (err) { + setError(err); } } void fetchData(); - }, [collections, isFetching, collection, error, id, can]); + }, []); useCommandBarActions([editCollection], [ui.activeCollectionId ?? "none"]); diff --git a/app/stores/CollectionsStore.ts b/app/stores/CollectionsStore.ts index dbc8140419..e50e334063 100644 --- a/app/stores/CollectionsStore.ts +++ b/app/stores/CollectionsStore.ts @@ -186,6 +186,13 @@ export default class CollectionsStore extends Store<Collection> { statusFilter: [CollectionStatusFilter.Archived], }); + get(id: string): Collection | undefined { + return ( + this.data.get(id) ?? + this.orderedData.find((collection) => id.endsWith(collection.urlId)) + ); + } + @computed get archived(): Collection[] { return orderBy(this.orderedData, "archivedAt", "desc").filter( From 96d698785854604f64363e0790cfab6ed9dc8cbe Mon Sep 17 00:00:00 2001 From: Tom Moor <tom@getoutline.com> Date: Fri, 2 May 2025 08:19:48 -0400 Subject: [PATCH 35/64] fix: Mobile toolbar overlaps with home indicator (#9119) --- app/components/Sidebar/Sidebar.tsx | 1 + app/editor/components/FloatingToolbar.tsx | 7 +++++- shared/styles/globals.ts | 7 ++++++ shared/utils/browser.ts | 26 +++++++++++++++++++++++ 4 files changed, 40 insertions(+), 1 deletion(-) diff --git a/app/components/Sidebar/Sidebar.tsx b/app/components/Sidebar/Sidebar.tsx index b475e10de1..975d7c73bf 100644 --- a/app/components/Sidebar/Sidebar.tsx +++ b/app/components/Sidebar/Sidebar.tsx @@ -321,6 +321,7 @@ const Container = styled(Flex)<ContainerProps>` z-index: ${depths.mobileSidebar}; max-width: 80%; min-width: 280px; + padding-left: var(--sal); ${fadeOnDesktopBackgrounded()} @media print { diff --git a/app/editor/components/FloatingToolbar.tsx b/app/editor/components/FloatingToolbar.tsx index 5aaa082cf1..be304adc86 100644 --- a/app/editor/components/FloatingToolbar.tsx +++ b/app/editor/components/FloatingToolbar.tsx @@ -7,6 +7,7 @@ import { isCode } from "@shared/editor/lib/isCode"; import { findParentNode } from "@shared/editor/queries/findParentNode"; import { EditorStyleHelper } from "@shared/editor/styles/EditorStyleHelper"; import { depths, s } from "@shared/styles"; +import { getSafeAreaInsets } from "@shared/utils/browser"; import { HEADER_HEIGHT } from "~/components/Header"; import { Portal } from "~/components/Portal"; import useEventListener from "~/hooks/useEventListener"; @@ -241,12 +242,16 @@ const FloatingToolbar = React.forwardRef(function FloatingToolbar_( if (props.active) { const rect = document.body.getBoundingClientRect(); + const safeAreaInsets = getSafeAreaInsets(); + return ( <ReactPortal> <MobileWrapper ref={menuRef} style={{ - bottom: `calc(100% - ${height - rect.y}px)`, + bottom: `calc(100% - ${ + height - rect.y - safeAreaInsets.bottom + }px)`, }} > {props.children} diff --git a/shared/styles/globals.ts b/shared/styles/globals.ts index 37cc45956b..cef435efd7 100644 --- a/shared/styles/globals.ts +++ b/shared/styles/globals.ts @@ -113,4 +113,11 @@ export default createGlobalStyle<Props>` outline-offset: -1px; outline-width: initial; } + + :root { + --sat: env(safe-area-inset-top); + --sar: env(safe-area-inset-right); + --sab: env(safe-area-inset-bottom); + --sal: env(safe-area-inset-left); + } `; diff --git a/shared/utils/browser.ts b/shared/utils/browser.ts index f159989bfe..e9d9218ceb 100644 --- a/shared/utils/browser.ts +++ b/shared/utils/browser.ts @@ -13,6 +13,32 @@ export function isTouchDevice(): boolean { return window.matchMedia?.("(hover: none) and (pointer: coarse)")?.matches; } +/** + * Returns the safe area insets for the current device. + */ +export function getSafeAreaInsets(): { + top: number; + right: number; + bottom: number; + left: number; +} { + // Check if CSS environment variables are supported + const style = getComputedStyle(document.documentElement); + const supportsEnv = window.CSS?.supports?.("top", "env(safe-area-inset-top)"); + + if (supportsEnv) { + return { + top: parseFloat(style.getPropertyValue("--sat") || "0"), + right: parseFloat(style.getPropertyValue("--sar") || "0"), + bottom: parseFloat(style.getPropertyValue("--sab") || "0"), + left: parseFloat(style.getPropertyValue("--sal") || "0"), + }; + } + + // Fallback to zero if not supported + return { top: 0, right: 0, bottom: 0, left: 0 }; +} + /** * Returns true if the client is running on a Mac. */ From 5ebb1e8a613fe4a16b90e677dc7108b9ddba30ee Mon Sep 17 00:00:00 2001 From: Tom Moor <tom@getoutline.com> Date: Fri, 2 May 2025 08:19:57 -0400 Subject: [PATCH 36/64] feat: Add input rule to create new tables (#9118) --- app/editor/extensions/SmartText.ts | 3 ++- shared/editor/commands/table.ts | 4 ++-- shared/editor/nodes/Table.ts | 15 +++++++++++++++ 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/app/editor/extensions/SmartText.ts b/app/editor/extensions/SmartText.ts index 4ed503ad8e..4090cb8c9a 100644 --- a/app/editor/extensions/SmartText.ts +++ b/app/editor/extensions/SmartText.ts @@ -2,7 +2,8 @@ import Extension from "@shared/editor/lib/Extension"; import { InputRule } from "@shared/editor/lib/InputRule"; const rightArrow = new InputRule(/->$/, "→"); -const emdash = new InputRule(/--$/, "—"); +// Note that the suppression of pipe here prevents conflict with table creation rule. +const emdash = new InputRule(/(?:^|[^\|])(--)$/, "—"); const oneHalf = new InputRule(/(?:^|\s)(1\/2)$/, "½"); const threeQuarters = new InputRule(/(?:^|\s)(3\/4)$/, "¾"); const copyright = new InputRule(/\(c\)$/, "©️"); diff --git a/shared/editor/commands/table.ts b/shared/editor/commands/table.ts index d3dc9625f2..0222d2d248 100644 --- a/shared/editor/commands/table.ts +++ b/shared/editor/commands/table.ts @@ -44,11 +44,11 @@ export function createTable({ }; } -function createTableInner( +export function createTableInner( state: EditorState, rowsCount: number, colsCount: number, - colWidth: number, + colWidth?: number, withHeaderRow = true, cellContent?: Node ) { diff --git a/shared/editor/nodes/Table.ts b/shared/editor/nodes/Table.ts index 03ff223d50..708c794385 100644 --- a/shared/editor/nodes/Table.ts +++ b/shared/editor/nodes/Table.ts @@ -1,5 +1,7 @@ import { chainCommands } from "prosemirror-commands"; +import { InputRule } from "prosemirror-inputrules"; import { NodeSpec, Node as ProsemirrorNode } from "prosemirror-model"; +import { TextSelection } from "prosemirror-state"; import { addColumnAfter, addRowAfter, @@ -23,6 +25,7 @@ import { deleteColSelection, deleteRowSelection, moveOutOfTable, + createTableInner, } from "../commands/table"; import { MarkdownSerializerState } from "../lib/markdown/serializer"; import { FixTablesPlugin } from "../plugins/FixTables"; @@ -101,6 +104,18 @@ export default class Table extends Node { }; } + inputRules() { + return [ + new InputRule(/^(\|--)$/, (state, _, start, end) => { + const nodes = createTableInner(state, 2, 2); + const tr = state.tr.replaceWith(start - 1, end, nodes).scrollIntoView(); + const resolvedPos = tr.doc.resolve(start + 1); + tr.setSelection(TextSelection.near(resolvedPos)); + return tr; + }), + ]; + } + toMarkdown(state: MarkdownSerializerState, node: ProsemirrorNode) { state.renderTable(node); state.closeBlock(node); From 7bd1ea7c40aeb8fe269203f96a26eaf88e083443 Mon Sep 17 00:00:00 2001 From: Tom Moor <tom@getoutline.com> Date: Fri, 2 May 2025 22:15:39 -0400 Subject: [PATCH 37/64] chore/attachments-sw-cache (#9122) --- vite.config.ts | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/vite.config.ts b/vite.config.ts index 63b28afc16..32b52d44ef 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -94,6 +94,9 @@ export default () => modifyURLPrefix: { "": `${environment.CDN_URL ?? ""}/static/`, }, + skipWaiting: true, + clientsClaim: true, + cleanupOutdatedCaches: true, runtimeCaching: [ { urlPattern: /api\/urls\.unfurl$/, @@ -109,6 +112,34 @@ export default () => }, }, }, + { + urlPattern: /api\/attachments\.redirect/, + handler: "CacheFirst", + options: { + cacheName: "attachments-redirect-cache", + expiration: { + maxEntries: 100, + maxAgeSeconds: 120, // 120 seconds + }, + cacheableResponse: { + statuses: [0, 200, 302], // Include redirects + }, + }, + }, + { + urlPattern: /api\/files\.get/, + handler: "CacheFirst", + options: { + cacheName: "files-cache", + expiration: { + maxEntries: 50, + maxAgeSeconds: 604800, // 7 days + }, + cacheableResponse: { + statuses: [0, 200, 206], // Include partial content for range requests + }, + }, + }, ], }, manifest: { From c0c36bacbb79b1f3a4f2a39bec2a206411eb7382 Mon Sep 17 00:00:00 2001 From: Tom Moor <tom@getoutline.com> Date: Fri, 2 May 2025 22:18:56 -0400 Subject: [PATCH 38/64] fix: Error loading collection (#9123) --- app/components/Sidebar/components/StarredLink.tsx | 4 ++-- app/models/Star.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/components/Sidebar/components/StarredLink.tsx b/app/components/Sidebar/components/StarredLink.tsx index 335170206d..be0fc7645d 100644 --- a/app/components/Sidebar/components/StarredLink.tsx +++ b/app/components/Sidebar/components/StarredLink.tsx @@ -38,10 +38,10 @@ function StarredLink({ star }: Props) { const { ui, collections, documents } = useStores(); const [menuOpen, handleMenuOpen, handleMenuClose] = useBoolean(); const { documentId, collectionId } = star; - const collection = collections.get(collectionId); + const collection = collectionId ? collections.get(collectionId) : undefined; const locationSidebarContext = useLocationSidebarContext(); const sidebarContext = starredSidebarContext( - star.documentId ?? star.collectionId + star.documentId ?? star.collectionId ?? "" ); const [expanded, setExpanded] = useState( (star.documentId diff --git a/app/models/Star.ts b/app/models/Star.ts index 347f6385b0..4c6c76651d 100644 --- a/app/models/Star.ts +++ b/app/models/Star.ts @@ -22,7 +22,7 @@ class Star extends Model { document?: Document; /** The collection ID that is starred. */ - collectionId: string; + collectionId?: string; /** The collection that is starred. */ @Relation(() => Collection, { onDelete: "cascade" }) From fd3c21d28bfb1a74702e76e764d0b058266cc441 Mon Sep 17 00:00:00 2001 From: Tom Moor <tom@getoutline.com> Date: Sat, 3 May 2025 12:00:54 -0400 Subject: [PATCH 39/64] Remove `withCollectionPermissions` scope (#9124) * Remove withCollectionPermissions scope * defaultScopeWithUser -> withUserScope * fix: Include withDrafts in groupMemberships.list * rename --- server/models/Document.ts | 56 +++++++------------ server/models/helpers/SearchHelper.ts | 54 ++++++------------ server/routes/api/documents/documents.ts | 30 ++++------ .../api/groupMemberships/groupMemberships.ts | 19 +++---- server/routes/api/pins/pins.ts | 2 +- server/routes/api/stars/stars.ts | 2 +- .../api/userMemberships/userMemberships.ts | 11 +--- server/utils/permissions.ts | 5 +- 8 files changed, 63 insertions(+), 116 deletions(-) diff --git a/server/models/Document.ts b/server/models/Document.ts index 719c528df8..1b4e89f3e0 100644 --- a/server/models/Document.ts +++ b/server/models/Document.ts @@ -13,7 +13,6 @@ import { Transaction, Op, FindOptions, - ScopeOptions, WhereOptions, EmptyResultError, } from "sequelize"; @@ -106,20 +105,6 @@ type AdditionalFindOptions = { }, })) @Scopes(() => ({ - withCollectionPermissions: (userId: string, paranoid = true) => ({ - include: [ - { - attributes: ["id", "permission", "sharing", "teamId", "deletedAt"], - model: userId - ? Collection.scope({ - method: ["withMembership", userId], - }) - : Collection, - as: "collection", - paranoid, - }, - ], - }), withoutState: { attributes: { exclude: ["state"], @@ -169,13 +154,23 @@ type AdditionalFindOptions = { ], }; }, - withMembership: (userId: string) => { + withMembership: (userId: string, paranoid = true) => { if (!userId) { return {}; } return { include: [ + { + attributes: ["id", "permission", "sharing", "teamId", "deletedAt"], + model: userId + ? Collection.scope({ + method: ["withMembership", userId], + }) + : Collection, + as: "collection", + paranoid, + }, { association: "memberships", where: { @@ -637,21 +632,15 @@ class Document extends ArchivableModel< return uniq(membershipUserIds); } - static defaultScopeWithUser(userId: string) { - const collectionScope: Readonly<ScopeOptions> = { - method: ["withCollectionPermissions", userId], - }; - const viewScope: Readonly<ScopeOptions> = { - method: ["withViews", userId], - }; - const membershipScope: Readonly<ScopeOptions> = { - method: ["withMembership", userId], - }; + static withMembershipScope(userId: string, options?: FindOptions<Document>) { return this.scope([ "defaultScope", - collectionScope, - viewScope, - membershipScope, + { + method: ["withViews", userId], + }, + { + method: ["withMembership", userId, options?.paranoid], + }, ]); } @@ -685,14 +674,12 @@ class Document extends ArchivableModel< // almost every endpoint needs the collection membership to determine policy permissions. const scope = this.scope([ "withDrafts", - { - method: ["withCollectionPermissions", userId, rest.paranoid], - }, + options.includeState ? "withState" : "withoutState", { method: ["withViews", userId], }, { - method: ["withMembership", userId], + method: ["withMembership", userId, rest.paranoid], }, ]); @@ -750,9 +737,6 @@ class Document extends ArchivableModel< const user = userId ? await User.findByPk(userId) : null; const documents = await this.scope([ "withDrafts", - { - method: ["withCollectionPermissions", userId, rest.paranoid], - }, { method: ["withViews", userId], }, diff --git a/server/models/helpers/SearchHelper.ts b/server/models/helpers/SearchHelper.ts index e8a85d83b0..026c0e21d7 100644 --- a/server/models/helpers/SearchHelper.ts +++ b/server/models/helpers/SearchHelper.ts @@ -182,25 +182,16 @@ export default class SearchHelper { }, ]; - return Document.scope([ - "withDrafts", - { - method: ["withViews", user.id], - }, - { - method: ["withCollectionPermissions", user.id], - }, - { - method: ["withMembership", user.id], - }, - ]).findAll({ - where, - subQuery: false, - order: [["updatedAt", "DESC"]], - include, - offset, - limit, - }); + return Document.withMembershipScope(user.id) + .scope("withDrafts") + .findAll({ + where, + subQuery: false, + order: [["updatedAt", "DESC"]], + include, + offset, + limit, + }); } public static async searchCollectionsForUser( @@ -273,23 +264,14 @@ export default class SearchHelper { // Final query to get associated document data const [documents, count] = await Promise.all([ - Document.scope([ - "withDrafts", - { - method: ["withViews", user.id], - }, - { - method: ["withCollectionPermissions", user.id], - }, - { - method: ["withMembership", user.id], - }, - ]).findAll({ - where: { - teamId: user.teamId, - id: map(results, "id"), - }, - }), + Document.withMembershipScope(user.id) + .scope("withDrafts") + .findAll({ + where: { + teamId: user.teamId, + id: map(results, "id"), + }, + }), results.length < limit && offset === 0 ? Promise.resolve(results.length) : countQuery, diff --git a/server/routes/api/documents/documents.ts b/server/routes/api/documents/documents.ts index 084e766e0e..7c5e2248da 100644 --- a/server/routes/api/documents/documents.ts +++ b/server/routes/api/documents/documents.ts @@ -268,7 +268,7 @@ router.post( } const [documents, total] = await Promise.all([ - Document.defaultScopeWithUser(user.id).findAll({ + Document.withMembershipScope(user.id).findAll({ where, order: [ [ @@ -348,7 +348,7 @@ router.post( }; } - const documents = await Document.defaultScopeWithUser(user.id).findAll({ + const documents = await Document.withMembershipScope(user.id).findAll({ where, order: [ [ @@ -397,15 +397,11 @@ router.post( const membershipScope: Readonly<ScopeOptions> = { method: ["withMembership", user.id], }; - const collectionScope: Readonly<ScopeOptions> = { - method: ["withCollectionPermissions", user.id], - }; const viewScope: Readonly<ScopeOptions> = { method: ["withViews", user.id], }; const documents = await Document.scope([ membershipScope, - collectionScope, viewScope, "withDrafts", ]).findAll({ @@ -539,12 +535,14 @@ router.post( delete where.updatedAt; } - const documents = await Document.defaultScopeWithUser(user.id).findAll({ - where, - order: [[sort, direction]], - offset: ctx.state.pagination.offset, - limit: ctx.state.pagination.limit, - }); + const documents = await Document.withMembershipScope(user.id) + .scope("withDrafts") + .findAll({ + where, + order: [[sort, direction]], + offset: ctx.state.pagination.offset, + limit: ctx.state.pagination.limit, + }); const data = await Promise.all( documents.map((document) => presentDocument(ctx, document)) ); @@ -2033,13 +2031,7 @@ router.post( const collectionIds = await user.collectionIds({ paranoid: false, }); - const collectionScope: Readonly<ScopeOptions> = { - method: ["withCollectionPermissions", user.id], - }; - const documents = await Document.scope([ - collectionScope, - "withDrafts", - ]).findAll({ + const documents = await Document.scope("withDrafts").findAll({ attributes: ["id"], where: { deletedAt: { diff --git a/server/routes/api/groupMemberships/groupMemberships.ts b/server/routes/api/groupMemberships/groupMemberships.ts index 4fdd3f239c..f6917166a0 100644 --- a/server/routes/api/groupMemberships/groupMemberships.ts +++ b/server/routes/api/groupMemberships/groupMemberships.ts @@ -24,6 +24,7 @@ router.post( async (ctx: APIContext<T.GroupMembershipsListReq>) => { const { groupId } = ctx.input.body; const { user } = ctx.state.auth; + const userId = user.id; const memberships = await GroupMembership.findAll({ where: { @@ -44,7 +45,7 @@ router.post( association: "groupUsers", required: true, where: { - userId: user.id, + userId, }, }, ], @@ -57,15 +58,13 @@ router.post( const documentIds = memberships .map((p) => p.documentId) .filter(Boolean) as string[]; - const documents = await Document.scope([ - "withDrafts", - { method: ["withMembership", user.id] }, - { method: ["withCollectionPermissions", user.id] }, - ]).findAll({ - where: { - id: documentIds, - }, - }); + const documents = await Document.withMembershipScope(userId) + .scope("withDrafts") + .findAll({ + where: { + id: documentIds, + }, + }); const groups = uniqBy( memberships.map((membership) => membership.group), diff --git a/server/routes/api/pins/pins.ts b/server/routes/api/pins/pins.ts index 676ea8a1c8..633549d0b5 100644 --- a/server/routes/api/pins/pins.ts +++ b/server/routes/api/pins/pins.ts @@ -113,7 +113,7 @@ router.post( user.collectionIds(), ]); - const documents = await Document.defaultScopeWithUser(user.id).findAll({ + const documents = await Document.withMembershipScope(user.id).findAll({ where: { id: pins.map((pin) => pin.documentId), collectionId: collectionIds, diff --git a/server/routes/api/stars/stars.ts b/server/routes/api/stars/stars.ts index 6f80056c7b..533446162a 100644 --- a/server/routes/api/stars/stars.ts +++ b/server/routes/api/stars/stars.ts @@ -94,7 +94,7 @@ router.post( .map((star) => star.documentId) .filter(Boolean) as string[]; const documents = documentIds.length - ? await Document.defaultScopeWithUser(user.id).findAll({ + ? await Document.withMembershipScope(user.id).findAll({ where: { id: documentIds, collectionId: collectionIds, diff --git a/server/routes/api/userMemberships/userMemberships.ts b/server/routes/api/userMemberships/userMemberships.ts index f2ea70c647..962b8a2e33 100644 --- a/server/routes/api/userMemberships/userMemberships.ts +++ b/server/routes/api/userMemberships/userMemberships.ts @@ -1,5 +1,4 @@ import Router from "koa-router"; - import { Op, Sequelize } from "sequelize"; import auth from "@server/middlewares/authentication"; import { transaction } from "@server/middlewares/transaction"; @@ -46,14 +45,8 @@ router.post( const documentIds = memberships .map((p) => p.documentId) .filter(Boolean) as string[]; - const documents = await Document.scope([ - "withDrafts", - { method: ["withMembership", user.id] }, - { method: ["withCollectionPermissions", user.id] }, - ]).findAll({ - where: { - id: documentIds, - }, + const documents = await Document.findByIds(documentIds, { + userId: user.id, }); const policies = presentPolicies(user, [...documents, ...memberships]); diff --git a/server/utils/permissions.ts b/server/utils/permissions.ts index 2737f99add..397af7a041 100644 --- a/server/utils/permissions.ts +++ b/server/utils/permissions.ts @@ -99,10 +99,7 @@ export const getDocumentPermission = async ({ documentId: string; skipMembershipId?: string; }): Promise<DocumentPermission | undefined> => { - const document = await Document.scope({ - method: ["withCollectionPermissions", userId], - }).findOne({ where: { id: documentId } }); - + const document = await Document.findByPk(documentId, { userId }); const permissions: DocumentPermission[] = []; const collection = document?.collection; From a06671e8cea9faafaaaea66ff2eb45fb7873993e Mon Sep 17 00:00:00 2001 From: Tom Moor <tom@getoutline.com> Date: Sat, 3 May 2025 19:40:18 -0400 Subject: [PATCH 40/64] OAuth provider (#8884) This PR contains the necessary work to make Outline an OAuth provider including: - OAuth app registration - OAuth app management - Private / public apps (Public in cloud only) - Full OAuth 2.0 spec compatible authentication flow - Granular scopes - User token management screen in settings - Associated API endpoints for programatic access --- app/actions/definitions/oauthClients.tsx | 25 ++ app/actions/definitions/teams.tsx | 4 +- app/components/Avatar/Avatar.tsx | 31 +- app/components/Avatar/Initials.tsx | 2 - .../OAuthClient/OAuthClientForm.tsx | 142 ++++++++ app/components/OAuthClient/OAuthClientNew.tsx | 33 ++ app/components/Sidebar/App.tsx | 6 +- app/components/TeamLogo.ts | 5 +- app/hooks/useLoggedInSessions.ts | 14 + app/hooks/useRequest.ts | 2 +- app/hooks/useSettingsConfig.ts | 22 +- app/menus/OAuthAuthenticationMenu.tsx | 57 +++ app/menus/OAuthClientMenu.tsx | 68 ++++ .../{OrganizationMenu.tsx => TeamMenu.tsx} | 8 +- app/models/oauth/OAuthAuthentication.ts | 39 +++ app/models/oauth/OAuthClient.ts | 92 +++++ app/routes/authenticated.tsx | 110 +++--- app/routes/index.tsx | 14 +- app/routes/settings.tsx | 7 + app/scenes/Login/{index.tsx => Login.tsx} | 54 +-- app/scenes/Login/OAuthAuthorize.tsx | 260 ++++++++++++++ app/scenes/Login/OAuthScopeHelper.ts | 56 +++ app/scenes/Login/components/BackButton.tsx | 11 +- app/scenes/Login/components/Background.tsx | 12 + app/scenes/Login/components/Centered.tsx | 15 + app/scenes/Login/components/ConnectHeader.tsx | 40 +++ app/scenes/Login/components/Notices.tsx | 2 +- app/scenes/Login/components/TeamSwitcher.tsx | 109 ++++++ app/scenes/Login/index.ts | 3 + app/scenes/Settings/APIAndApps.tsx | 107 ++++++ app/scenes/Settings/ApiKeys.tsx | 1 - app/scenes/Settings/Application.tsx | 325 +++++++++++++++++ .../{PersonalApiKeys.tsx => Applications.tsx} | 44 +-- app/scenes/Settings/Details.tsx | 11 +- app/scenes/Settings/components/CopyButton.tsx | 50 +++ app/scenes/Settings/components/ImageInput.tsx | 20 +- .../OAuthAuthenticationListItem.tsx | 61 ++++ .../components/OAuthClientDeleteDialog.tsx | 37 ++ .../components/OAuthClientListItem.tsx | 55 +++ app/scenes/Settings/components/SettingRow.tsx | 2 +- app/stores/OAuthAuthenticationsStore.ts | 11 + app/stores/OAuthClientsStore.ts | 11 + app/stores/RootStore.ts | 25 +- app/utils/routeHelpers.ts | 4 +- package.json | 1 + .../server/api/webhookSubscriptions.ts | 17 +- .../server/tasks/DeliverWebhookTask.ts | 5 + server/env.ts | 26 ++ server/middlewares/authentication.test.ts | 118 ++++++- server/middlewares/authentication.ts | 56 ++- .../requestTracer.ts} | 4 +- .../20250331231413-add-oauth-server-models.js | 212 ++++++++++++ server/models/ApiKey.ts | 40 +-- .../helpers/AuthenticationHelper.test.ts | 126 +++++++ server/models/helpers/AuthenticationHelper.ts | 58 ++++ server/models/index.ts | 6 + server/models/oauth/OAuthAuthentication.ts | 212 ++++++++++++ server/models/oauth/OAuthAuthorizationCode.ts | 104 ++++++ server/models/oauth/OAuthClient.ts | 159 +++++++++ server/policies/index.ts | 4 +- server/policies/oauthAuthentication.ts | 14 + server/policies/oauthClient.ts | 19 + server/presenters/index.ts | 3 + server/presenters/oauthAuthentication.ts | 16 + server/presenters/oauthClient.ts | 42 +++ .../processors/OAuthClientDeletedProcessor.ts | 15 + .../OAuthClientUnpublishedProcessor.ts | 36 ++ .../queues/processors/UserDeletedProcessor.ts | 7 + .../processors/UserSuspendedProcessor.ts | 14 + .../CleanupOAuthAuthorizationCodeTask.test.ts | 37 ++ .../CleanupOAuthAuthorizationCodeTask.ts | 33 ++ server/routes/api/apiKeys/apiKeys.ts | 10 +- server/routes/api/index.ts | 8 +- .../oauthAuthentications.test.ts.snap | 19 + .../routes/api/oauthAuthentications/index.ts | 1 + .../oauthAuthentications.test.ts | 194 +++++++++++ .../oauthAuthentications.ts | 90 +++++ .../routes/api/oauthAuthentications/schema.ts | 21 ++ .../__snapshots__/oauthClients.test.ts.snap | 55 +++ server/routes/api/oauthClients/index.ts | 1 + .../api/oauthClients/oauthClients.test.ts | 326 ++++++++++++++++++ .../routes/api/oauthClients/oauthClients.ts | 181 ++++++++++ server/routes/api/oauthClients/schema.ts | 128 +++++++ server/routes/oauth/index.test.ts | 47 +++ server/routes/oauth/index.ts | 132 +++++++ .../oauth/middlewares/oauthErrorHandler.ts | 41 +++ server/routes/oauth/schema.ts | 11 + .../scripts/20240930113921-hash-api-keys.ts | 3 +- server/services/web.ts | 3 + server/test/factories.ts | 112 +++++- server/types.ts | 10 +- server/utils/crypto.ts | 10 + server/utils/oauth/OAuthInterface.test.ts | 104 ++++++ server/utils/oauth/OAuthInterface.ts | 294 ++++++++++++++++ shared/i18n/locales/en_US/translation.json | 79 ++++- shared/types.ts | 9 + shared/utils/urls.ts | 13 +- shared/validations.ts | 20 ++ yarn.lock | 23 +- 99 files changed, 5115 insertions(+), 221 deletions(-) create mode 100644 app/actions/definitions/oauthClients.tsx create mode 100644 app/components/OAuthClient/OAuthClientForm.tsx create mode 100644 app/components/OAuthClient/OAuthClientNew.tsx create mode 100644 app/hooks/useLoggedInSessions.ts create mode 100644 app/menus/OAuthAuthenticationMenu.tsx create mode 100644 app/menus/OAuthClientMenu.tsx rename app/menus/{OrganizationMenu.tsx => TeamMenu.tsx} (91%) create mode 100644 app/models/oauth/OAuthAuthentication.ts create mode 100644 app/models/oauth/OAuthClient.ts rename app/scenes/Login/{index.tsx => Login.tsx} (90%) create mode 100644 app/scenes/Login/OAuthAuthorize.tsx create mode 100644 app/scenes/Login/OAuthScopeHelper.ts create mode 100644 app/scenes/Login/components/Background.tsx create mode 100644 app/scenes/Login/components/Centered.tsx create mode 100644 app/scenes/Login/components/ConnectHeader.tsx create mode 100644 app/scenes/Login/components/TeamSwitcher.tsx create mode 100644 app/scenes/Login/index.ts create mode 100644 app/scenes/Settings/APIAndApps.tsx create mode 100644 app/scenes/Settings/Application.tsx rename app/scenes/Settings/{PersonalApiKeys.tsx => Applications.tsx} (53%) create mode 100644 app/scenes/Settings/components/CopyButton.tsx create mode 100644 app/scenes/Settings/components/OAuthAuthenticationListItem.tsx create mode 100644 app/scenes/Settings/components/OAuthClientDeleteDialog.tsx create mode 100644 app/scenes/Settings/components/OAuthClientListItem.tsx create mode 100644 app/stores/OAuthAuthenticationsStore.ts create mode 100644 app/stores/OAuthClientsStore.ts rename server/{routes/api/middlewares/apiTracer.ts => middlewares/requestTracer.ts} (81%) create mode 100644 server/migrations/20250331231413-add-oauth-server-models.js create mode 100644 server/models/helpers/AuthenticationHelper.test.ts create mode 100644 server/models/oauth/OAuthAuthentication.ts create mode 100644 server/models/oauth/OAuthAuthorizationCode.ts create mode 100644 server/models/oauth/OAuthClient.ts create mode 100644 server/policies/oauthAuthentication.ts create mode 100644 server/policies/oauthClient.ts create mode 100644 server/presenters/oauthAuthentication.ts create mode 100644 server/presenters/oauthClient.ts create mode 100644 server/queues/processors/OAuthClientDeletedProcessor.ts create mode 100644 server/queues/processors/OAuthClientUnpublishedProcessor.ts create mode 100644 server/queues/processors/UserSuspendedProcessor.ts create mode 100644 server/queues/tasks/CleanupOAuthAuthorizationCodeTask.test.ts create mode 100644 server/queues/tasks/CleanupOAuthAuthorizationCodeTask.ts create mode 100644 server/routes/api/oauthAuthentications/__snapshots__/oauthAuthentications.test.ts.snap create mode 100644 server/routes/api/oauthAuthentications/index.ts create mode 100644 server/routes/api/oauthAuthentications/oauthAuthentications.test.ts create mode 100644 server/routes/api/oauthAuthentications/oauthAuthentications.ts create mode 100644 server/routes/api/oauthAuthentications/schema.ts create mode 100644 server/routes/api/oauthClients/__snapshots__/oauthClients.test.ts.snap create mode 100644 server/routes/api/oauthClients/index.ts create mode 100644 server/routes/api/oauthClients/oauthClients.test.ts create mode 100644 server/routes/api/oauthClients/oauthClients.ts create mode 100644 server/routes/api/oauthClients/schema.ts create mode 100644 server/routes/oauth/index.test.ts create mode 100644 server/routes/oauth/index.ts create mode 100644 server/routes/oauth/middlewares/oauthErrorHandler.ts create mode 100644 server/routes/oauth/schema.ts create mode 100644 server/utils/oauth/OAuthInterface.test.ts create mode 100644 server/utils/oauth/OAuthInterface.ts diff --git a/app/actions/definitions/oauthClients.tsx b/app/actions/definitions/oauthClients.tsx new file mode 100644 index 0000000000..76eba98ff3 --- /dev/null +++ b/app/actions/definitions/oauthClients.tsx @@ -0,0 +1,25 @@ +import { PlusIcon } from "outline-icons"; +import * as React from "react"; +import stores from "~/stores"; +import { OAuthClientNew } from "~/components/OAuthClient/OAuthClientNew"; +import { createAction } from ".."; +import { SettingsSection } from "../sections"; + +export const createOAuthClient = createAction({ + name: ({ t }) => t("New App"), + analyticsName: "New App", + section: SettingsSection, + icon: <PlusIcon />, + keywords: "create", + visible: () => + stores.policies.abilities(stores.auth.team?.id || "").createOAuthClient, + perform: ({ t, event }) => { + event?.preventDefault(); + event?.stopPropagation(); + + stores.dialogs.openModal({ + title: t("New Application"), + content: <OAuthClientNew onSubmit={stores.dialogs.closeAllModals} />, + }); + }, +}); diff --git a/app/actions/definitions/teams.tsx b/app/actions/definitions/teams.tsx index a9847551d7..02be788fd6 100644 --- a/app/actions/definitions/teams.tsx +++ b/app/actions/definitions/teams.tsx @@ -11,7 +11,7 @@ import { ActionContext } from "~/types"; import Desktop from "~/utils/Desktop"; import { TeamSection } from "../sections"; -export const createTeamsList = ({ stores }: { stores: RootStore }) => +export const switchTeamsList = ({ stores }: { stores: RootStore }) => stores.auth.availableTeams?.map((session) => ({ id: `switch-${session.id}`, name: session.name, @@ -44,7 +44,7 @@ export const switchTeam = createAction({ section: TeamSection, visible: ({ stores }) => !!stores.auth.availableTeams && stores.auth.availableTeams?.length > 1, - children: createTeamsList, + children: switchTeamsList, }); export const createTeam = createAction({ diff --git a/app/components/Avatar/Avatar.tsx b/app/components/Avatar/Avatar.tsx index 731e132e9c..e8b730a90e 100644 --- a/app/components/Avatar/Avatar.tsx +++ b/app/components/Avatar/Avatar.tsx @@ -13,6 +13,11 @@ export enum AvatarSize { Upload = 64, } +export enum AvatarVariant { + Round = "round", + Square = "square", +} + export interface IAvatar { avatarUrl: string | null; color?: string; @@ -23,6 +28,8 @@ export interface IAvatar { type Props = { /** The size of the avatar */ size: AvatarSize; + /** The variant of the avatar */ + variant?: AvatarVariant; /** The source of the avatar image, if not passing a model. */ src?: string; /** The avatar model, if not passing a source. */ @@ -38,14 +45,14 @@ type Props = { }; function Avatar(props: Props) { - const { model, style, ...rest } = props; + const { model, style, variant = AvatarVariant.Round, ...rest } = props; const src = props.src || model?.avatarUrl; const [error, handleError] = useBoolean(false); return ( - <Relative style={style}> + <Relative style={style} $variant={variant} $size={props.size}> {src && !error ? ( - <CircleImg onError={handleError} src={src} {...rest} /> + <Image onError={handleError} src={src} {...rest} /> ) : model ? ( <Initials color={model.color} {...rest}> {model.initial} @@ -61,19 +68,19 @@ Avatar.defaultProps = { size: AvatarSize.Medium, }; -const Relative = styled.div` +const Relative = styled.div<{ $variant: AvatarVariant; $size: AvatarSize }>` position: relative; user-select: none; flex-shrink: 0; -`; - -const CircleImg = styled.img<{ size: number }>` - display: block; - width: ${(props) => props.size}px; - height: ${(props) => props.size}px; - border-radius: 50%; - flex-shrink: 0; + border-radius: ${(props) => + props.$variant === AvatarVariant.Round ? "50%" : `${props.$size / 8}px`}; overflow: hidden; `; +const Image = styled.img<{ size: number }>` + display: block; + width: ${(props) => props.size}px; + height: ${(props) => props.size}px; +`; + export default Avatar; diff --git a/app/components/Avatar/Initials.tsx b/app/components/Avatar/Initials.tsx index 775e380e0c..e6d51b9be6 100644 --- a/app/components/Avatar/Initials.tsx +++ b/app/components/Avatar/Initials.tsx @@ -13,7 +13,6 @@ const Initials = styled(Flex)<{ }>` align-items: center; justify-content: center; - border-radius: 50%; width: 100%; height: 100%; color: ${(props) => @@ -23,7 +22,6 @@ const Initials = styled(Flex)<{ background-color: ${(props) => props.color ?? props.theme.textTertiary}; width: ${(props) => props.size}px; height: ${(props) => props.size}px; - border-radius: 50%; flex-shrink: 0; // adjust font size down for each additional character diff --git a/app/components/OAuthClient/OAuthClientForm.tsx b/app/components/OAuthClient/OAuthClientForm.tsx new file mode 100644 index 0000000000..921c71c707 --- /dev/null +++ b/app/components/OAuthClient/OAuthClientForm.tsx @@ -0,0 +1,142 @@ +import { observer } from "mobx-react"; +import * as React from "react"; +import { Controller, useForm } from "react-hook-form"; +import { useTranslation } from "react-i18next"; +import { OAuthClientValidation } from "@shared/validations"; +import OAuthClient from "~/models/oauth/OAuthClient"; +import ImageInput from "~/scenes/Settings/components/ImageInput"; +import Button from "~/components/Button"; +import Flex from "~/components/Flex"; +import Input, { LabelText } from "~/components/Input"; +import isCloudHosted from "~/utils/isCloudHosted"; +import Switch from "../Switch"; + +export interface FormData { + name: string; + developerName: string; + developerUrl: string; + description: string; + avatarUrl: string; + redirectUris: string[]; + published: boolean; +} + +export const OAuthClientForm = observer(function OAuthClientForm_({ + handleSubmit, + oauthClient, +}: { + handleSubmit: (data: FormData) => void; + oauthClient?: OAuthClient; +}) { + const { t } = useTranslation(); + + const { + register, + handleSubmit: formHandleSubmit, + formState, + getValues, + setFocus, + setError, + control, + } = useForm<FormData>({ + mode: "all", + defaultValues: { + name: oauthClient?.name ?? "", + description: oauthClient?.description ?? "", + avatarUrl: oauthClient?.avatarUrl ?? "", + redirectUris: oauthClient?.redirectUris ?? [], + published: oauthClient?.published ?? false, + }, + }); + + React.useEffect(() => { + setTimeout(() => setFocus("name", { shouldSelect: true }), 100); + }, [setFocus]); + + return ( + <form onSubmit={formHandleSubmit(handleSubmit)}> + <> + <label style={{ marginBottom: "1em" }}> + <LabelText>{t("Icon")}</LabelText> + <Controller + control={control} + name="avatarUrl" + render={({ field }) => ( + <ImageInput + onSuccess={(url) => field.onChange(url)} + onError={(err) => setError("avatarUrl", { message: err })} + model={{ + id: oauthClient?.id, + avatarUrl: field.value, + initial: getValues().name[0], + }} + borderRadius={0} + /> + )} + /> + </label> + <Input + type="text" + label={t("Name")} + placeholder={t("My App")} + {...register("name", { + required: true, + maxLength: OAuthClientValidation.maxNameLength, + })} + autoComplete="off" + autoFocus + flex + /> + <Input + type="text" + label={t("Tagline")} + placeholder={t("A short description")} + {...register("description", { + maxLength: OAuthClientValidation.maxDescriptionLength, + })} + flex + /> + <Controller + control={control} + name="redirectUris" + render={({ field }) => ( + <Input + type="textarea" + label={t("Callback URLs")} + placeholder="https://example.com/callback" + ref={field.ref} + value={field.value.join("\n")} + rows={Math.max(2, field.value.length + 1)} + onChange={(event) => { + field.onChange(event.target.value.split("\n")); + }} + required + /> + )} + /> + {isCloudHosted && ( + <Switch + {...register("published")} + label={t("Published")} + note={t("Allow this app to be installed by other workspaces")} + /> + )} + </> + + <Flex justify="flex-end"> + <Button + type="submit" + disabled={formState.isSubmitting || !formState.isValid} + > + {oauthClient + ? formState.isSubmitting + ? `${t("Saving")}…` + : t("Save") + : formState.isSubmitting + ? `${t("Creating")}…` + : t("Create")} + </Button> + </Flex> + </form> + ); +}); diff --git a/app/components/OAuthClient/OAuthClientNew.tsx b/app/components/OAuthClient/OAuthClientNew.tsx new file mode 100644 index 0000000000..eeae134dac --- /dev/null +++ b/app/components/OAuthClient/OAuthClientNew.tsx @@ -0,0 +1,33 @@ +import { observer } from "mobx-react"; +import * as React from "react"; +import { useHistory } from "react-router-dom"; +import { toast } from "sonner"; +import useStores from "~/hooks/useStores"; +import { settingsPath } from "~/utils/routeHelpers"; +import { OAuthClientForm, FormData } from "./OAuthClientForm"; + +type Props = { + onSubmit: () => void; +}; + +export const OAuthClientNew = observer(function OAuthClientNew_({ + onSubmit, +}: Props) { + const { oauthClients } = useStores(); + const history = useHistory(); + + const handleSubmit = React.useCallback( + async (data: FormData) => { + try { + const oauthClient = await oauthClients.save(data); + onSubmit?.(); + history.push(settingsPath("applications", oauthClient.id)); + } catch (error) { + toast.error(error.message); + } + }, + [oauthClients, history, onSubmit] + ); + + return <OAuthClientForm handleSubmit={handleSubmit} />; +}); diff --git a/app/components/Sidebar/App.tsx b/app/components/Sidebar/App.tsx index 1f89d2210c..633e3781fb 100644 --- a/app/components/Sidebar/App.tsx +++ b/app/components/Sidebar/App.tsx @@ -12,7 +12,7 @@ import useCurrentTeam from "~/hooks/useCurrentTeam"; import useCurrentUser from "~/hooks/useCurrentUser"; import usePolicy from "~/hooks/usePolicy"; import useStores from "~/hooks/useStores"; -import OrganizationMenu from "~/menus/OrganizationMenu"; +import TeamMenu from "~/menus/TeamMenu"; import { homePath, searchPath } from "~/utils/routeHelpers"; import TeamLogo from "../TeamLogo"; import Tooltip from "../Tooltip"; @@ -62,7 +62,7 @@ function AppSidebar() { <DndProvider backend={HTML5Backend} options={html5Options}> <DragPlaceholder /> - <OrganizationMenu> + <TeamMenu> {(props: SidebarButtonProps) => ( <SidebarButton {...props} @@ -91,7 +91,7 @@ function AppSidebar() { </Tooltip> </SidebarButton> )} - </OrganizationMenu> + </TeamMenu> <Overflow> <Section> <SidebarLink diff --git a/app/components/TeamLogo.ts b/app/components/TeamLogo.ts index baba4b34ac..2e885472fb 100644 --- a/app/components/TeamLogo.ts +++ b/app/components/TeamLogo.ts @@ -1,8 +1,11 @@ import styled from "styled-components"; import { s } from "@shared/styles"; import { Avatar } from "./Avatar"; +import { AvatarVariant } from "./Avatar/Avatar"; -const TeamLogo = styled(Avatar)` +const TeamLogo = styled(Avatar).attrs({ + variant: AvatarVariant.Square, +})` border-radius: 4px; box-shadow: inset 0 0 0 1px ${s("divider")}; border: 0; diff --git a/app/hooks/useLoggedInSessions.ts b/app/hooks/useLoggedInSessions.ts new file mode 100644 index 0000000000..dbdbbcf719 --- /dev/null +++ b/app/hooks/useLoggedInSessions.ts @@ -0,0 +1,14 @@ +import { getCookie } from "tiny-cookie"; + +export type Sessions = Record< + string, + { + name: string; + logoUrl: string; + url: string; + } +>; + +export function useLoggedInSessions(): Sessions { + return JSON.parse(getCookie("sessions") || "{}"); +} diff --git a/app/hooks/useRequest.ts b/app/hooks/useRequest.ts index e5b6eed59a..4c40b81c68 100644 --- a/app/hooks/useRequest.ts +++ b/app/hooks/useRequest.ts @@ -59,7 +59,7 @@ export default function useRequest<T = unknown>( if (makeRequestOnMount) { void request(); } - }, [request, makeRequestOnMount]); + }, []); return { data, loading, loaded, error, request }; } diff --git a/app/hooks/useSettingsConfig.ts b/app/hooks/useSettingsConfig.ts index e564103dc7..ece9989b0e 100644 --- a/app/hooks/useSettingsConfig.ts +++ b/app/hooks/useSettingsConfig.ts @@ -13,6 +13,7 @@ import { ImportIcon, ShapesIcon, Icon, + InternetIcon, } from "outline-icons"; import React, { ComponentProps } from "react"; import { useTranslation } from "react-i18next"; @@ -28,7 +29,8 @@ import useCurrentUser from "./useCurrentUser"; import usePolicy from "./usePolicy"; const ApiKeys = lazy(() => import("~/scenes/Settings/ApiKeys")); -const PersonalApiKeys = lazy(() => import("~/scenes/Settings/PersonalApiKeys")); +const Applications = lazy(() => import("~/scenes/Settings/Applications")); +const APIAndApps = lazy(() => import("~/scenes/Settings/APIAndApps")); const Details = lazy(() => import("~/scenes/Settings/Details")); const Export = lazy(() => import("~/scenes/Settings/Export")); const Features = lazy(() => import("~/scenes/Settings/Features")); @@ -86,12 +88,12 @@ const useSettingsConfig = () => { icon: EmailIcon, }, { - name: t("API Keys"), - path: settingsPath("personal-api-keys"), - component: PersonalApiKeys, - enabled: can.createApiKey && !can.listApiKeys, + name: t("API & Apps"), + path: settingsPath("api-and-apps"), + component: APIAndApps, + enabled: true, group: t("Account"), - icon: CodeIcon, + icon: PadlockIcon, }, // Workspace { @@ -150,6 +152,14 @@ const useSettingsConfig = () => { group: t("Workspace"), icon: CodeIcon, }, + { + name: t("Applications"), + path: settingsPath("applications"), + component: Applications, + enabled: can.listOAuthClients, + group: t("Workspace"), + icon: InternetIcon, + }, { name: t("Shared Links"), path: settingsPath("shares"), diff --git a/app/menus/OAuthAuthenticationMenu.tsx b/app/menus/OAuthAuthenticationMenu.tsx new file mode 100644 index 0000000000..8b826655c7 --- /dev/null +++ b/app/menus/OAuthAuthenticationMenu.tsx @@ -0,0 +1,57 @@ +import { observer } from "mobx-react"; +import * as React from "react"; +import { useTranslation } from "react-i18next"; +import { useMenuState } from "reakit/Menu"; +import OAuthAuthentication from "~/models/oauth/OAuthAuthentication"; +import ConfirmationDialog from "~/components/ConfirmationDialog"; +import ContextMenu from "~/components/ContextMenu"; +import MenuItem from "~/components/ContextMenu/MenuItem"; +import OverflowMenuButton from "~/components/ContextMenu/OverflowMenuButton"; +import useStores from "~/hooks/useStores"; + +type Props = { + /** The OAuthAuthentication to associate with the menu */ + oauthAuthentication: OAuthAuthentication; +}; + +function OAuthAuthenticationMenu({ oauthAuthentication }: Props) { + const menu = useMenuState({ + modal: true, + }); + const { dialogs } = useStores(); + const { t } = useTranslation(); + + const handleRevoke = React.useCallback(() => { + dialogs.openModal({ + title: t("Revoke {{ appName }}", { + appName: oauthAuthentication.oauthClient.name, + }), + content: ( + <ConfirmationDialog + onSubmit={async () => { + await oauthAuthentication.deleteAll(); + dialogs.closeAllModals(); + }} + submitText={t("Revoke")} + savingText={`${t("Revoking")}…`} + danger + > + {t("Are you sure you want to revoke access?")} + </ConfirmationDialog> + ), + }); + }, [t, dialogs, oauthAuthentication]); + + return ( + <> + <OverflowMenuButton aria-label={t("Show menu")} {...menu} /> + <ContextMenu {...menu}> + <MenuItem {...menu} onClick={handleRevoke} dangerous> + {t("Revoke")} + </MenuItem> + </ContextMenu> + </> + ); +} + +export default observer(OAuthAuthenticationMenu); diff --git a/app/menus/OAuthClientMenu.tsx b/app/menus/OAuthClientMenu.tsx new file mode 100644 index 0000000000..e2177c3b8e --- /dev/null +++ b/app/menus/OAuthClientMenu.tsx @@ -0,0 +1,68 @@ +import { observer } from "mobx-react"; +import * as React from "react"; +import { useTranslation } from "react-i18next"; +import { useMenuState } from "reakit/Menu"; +import OAuthClient from "~/models/oauth/OAuthClient"; +import OAuthClientDeleteDialog from "~/scenes/Settings/components/OAuthClientDeleteDialog"; +import ContextMenu from "~/components/ContextMenu"; +import OverflowMenuButton from "~/components/ContextMenu/OverflowMenuButton"; +import Template from "~/components/ContextMenu/Template"; +import useStores from "~/hooks/useStores"; +import { settingsPath } from "~/utils/routeHelpers"; + +type Props = { + /** The oauthClient to associate with the menu */ + oauthClient: OAuthClient; + /** Whether to show the edit button */ + showEdit?: boolean; +}; + +function OAuthClientMenu({ oauthClient, showEdit }: Props) { + const menu = useMenuState({ + modal: true, + }); + const { dialogs } = useStores(); + const { t } = useTranslation(); + + const handleDelete = React.useCallback(() => { + dialogs.openModal({ + title: t("Delete app"), + content: ( + <OAuthClientDeleteDialog + onSubmit={dialogs.closeAllModals} + oauthClient={oauthClient} + /> + ), + }); + }, [t, dialogs, oauthClient]); + + return ( + <> + <OverflowMenuButton aria-label={t("Show menu")} {...menu} /> + <ContextMenu {...menu}> + <Template + {...menu} + items={[ + { + type: "route", + title: `${t("Edit")}…`, + visible: showEdit, + to: settingsPath("applications", oauthClient.id), + }, + { + type: "separator", + }, + { + type: "button", + dangerous: true, + title: `${t("Delete")}…`, + onClick: handleDelete, + }, + ]} + /> + </ContextMenu> + </> + ); +} + +export default observer(OAuthClientMenu); diff --git a/app/menus/OrganizationMenu.tsx b/app/menus/TeamMenu.tsx similarity index 91% rename from app/menus/OrganizationMenu.tsx rename to app/menus/TeamMenu.tsx index 1113476a71..6010ce7f7a 100644 --- a/app/menus/OrganizationMenu.tsx +++ b/app/menus/TeamMenu.tsx @@ -10,7 +10,7 @@ import { } from "~/actions/definitions/navigation"; import { createTeam, - createTeamsList, + switchTeamsList, desktopLoginTeam, } from "~/actions/definitions/teams"; import useActionContext from "~/hooks/useActionContext"; @@ -22,7 +22,7 @@ type Props = { children?: React.ReactNode; }; -const OrganizationMenu: React.FC = ({ children }: Props) => { +const TeamMenu: React.FC = ({ children }: Props) => { const menu = useMenuState({ unstable_offset: [4, -4], placement: "bottom-start", @@ -44,7 +44,7 @@ const OrganizationMenu: React.FC = ({ children }: Props) => { // menu is not cached at all. const actions = React.useMemo( () => [ - ...createTeamsList(context), + ...switchTeamsList(context), createTeam, desktopLoginTeam, separator(), @@ -64,4 +64,4 @@ const OrganizationMenu: React.FC = ({ children }: Props) => { ); }; -export default observer(OrganizationMenu); +export default observer(TeamMenu); diff --git a/app/models/oauth/OAuthAuthentication.ts b/app/models/oauth/OAuthAuthentication.ts new file mode 100644 index 0000000000..c982befcfe --- /dev/null +++ b/app/models/oauth/OAuthAuthentication.ts @@ -0,0 +1,39 @@ +import { action, observable } from "mobx"; +import { client } from "~/utils/ApiClient"; +import User from "../User"; +import ParanoidModel from "../base/ParanoidModel"; +import Field from "../decorators/Field"; +import Relation from "../decorators/Relation"; +import OAuthClient from "./OAuthClient"; + +class OAuthAuthentication extends ParanoidModel { + static modelName = "OAuthAuthentication"; + + /** A list of scopes that this authentication has access to */ + @Field + @observable + scope: string[]; + + @Relation(() => User) + user: User; + + userId: string; + + oauthClient: Pick<OAuthClient, "id" | "name" | "clientId" | "avatarUrl">; + + oauthClientId: string; + + lastActiveAt: string; + + @action + public async deleteAll() { + await client.post(`/${this.store.apiEndpoint}.delete`, { + oauthClientId: this.oauthClientId, + scope: this.scope, + }); + + return this.store.remove(this.id); + } +} + +export default OAuthAuthentication; diff --git a/app/models/oauth/OAuthClient.ts b/app/models/oauth/OAuthClient.ts new file mode 100644 index 0000000000..656824c4e1 --- /dev/null +++ b/app/models/oauth/OAuthClient.ts @@ -0,0 +1,92 @@ +import invariant from "invariant"; +import { observable, runInAction } from "mobx"; +import queryString from "query-string"; +import env from "~/env"; +import { client } from "~/utils/ApiClient"; +import User from "../User"; +import ParanoidModel from "../base/ParanoidModel"; +import Field from "../decorators/Field"; +import Relation from "../decorators/Relation"; + +class OAuthClient extends ParanoidModel { + static modelName = "OAuthClient"; + + /** The human-readable name of this app */ + @Field + @observable + name: string; + + /** A short description of this app */ + @Field + @observable + description: string | null; + + /** The name of the developer of this app */ + @Field + @observable + developerName: string | null; + + /** The URL of the developer of this app */ + @Field + @observable + developerUrl: string | null; + + /** The URL of the avatar of the developer of this app */ + @Field + @observable + avatarUrl: string | null; + + /** The public identifier of this app */ + @Field + clientId: string; + + /** The secret key used to authenticate this app */ + @Field + @observable + clientSecret: string; + + /** Whether this app is published (available to other workspaces) */ + @Field + @observable + published: boolean; + + /** A list of valid redirect URIs for this app */ + @Field + @observable + redirectUris: string[]; + + @Relation(() => User) + createdBy: User; + + createdById: string; + + // instance methods + + public async rotateClientSecret() { + const res = await client.post("/oauthClients.rotate_secret", { + id: this.id, + }); + invariant(res.data, "Failed to rotate client secret"); + + runInAction("OAuthClient#rotateSecret", () => { + this.clientSecret = res.data.clientSecret; + }); + } + + public get initial() { + return this.name[0]; + } + + public get authorizationUrl(): string { + const params = { + client_id: this.clientId, + redirect_uri: this.redirectUris[0], + response_type: "code", + scope: "read", + }; + + return `${env.URL}/oauth/authorize?${queryString.stringify(params)}`; + } +} + +export default OAuthClient; diff --git a/app/routes/authenticated.tsx b/app/routes/authenticated.tsx index 30f407fe9e..d778dc09f7 100644 --- a/app/routes/authenticated.tsx +++ b/app/routes/authenticated.tsx @@ -42,55 +42,77 @@ const RedirectDocument = ({ /> ); +/** + * The authenticated routes are all the routes of the application that require + * the user to be logged in. + */ function AuthenticatedRoutes() { const team = useCurrentTeam(); const can = usePolicy(team); return ( - <WebsocketProvider> - <AuthenticatedLayout> - <React.Suspense - fallback={ - <CenteredContent> - <PlaceholderDocument /> - </CenteredContent> - } - > - <Switch> - {can.createDocument && ( - <Route exact path={draftsPath()} component={Drafts} /> - )} - {can.createDocument && ( - <Route exact path={archivePath()} component={Archive} /> - )} - {can.createDocument && ( - <Route exact path={trashPath()} component={Trash} /> - )} - <Route path={`${homePath()}/:tab?`} component={Home} /> - <Redirect from="/dashboard" to={homePath()} /> - <Redirect exact from="/starred" to={homePath()} /> - <Redirect exact from="/templates" to={settingsPath("templates")} /> - <Redirect exact from="/collections/*" to="/collection/*" /> - <Route exact path="/collection/:id/new" component={DocumentNew} /> - <Route exact path="/collection/:id/:tab?" component={Collection} /> - <Route exact path="/doc/new" component={DocumentNew} /> - <Route exact path={`/d/${slug}`} component={RedirectDocument} /> - <Route - exact - path={`/doc/${slug}/history/:revisionId?`} - component={Document} - /> - <Route exact path={`/doc/${slug}/insights`} component={Document} /> - <Route exact path={`/doc/${slug}/edit`} component={Document} /> - <Route path={`/doc/${slug}`} component={Document} /> - <Route exact path={`${searchPath()}/:query?`} component={Search} /> - <Route path="/404" component={Error404} /> - <SettingsRoutes /> - <Route component={Error404} /> - </Switch> - </React.Suspense> - </AuthenticatedLayout> - </WebsocketProvider> + <Switch> + <WebsocketProvider> + <AuthenticatedLayout> + <React.Suspense + fallback={ + <CenteredContent> + <PlaceholderDocument /> + </CenteredContent> + } + > + <Switch> + {can.createDocument && ( + <Route exact path={draftsPath()} component={Drafts} /> + )} + {can.createDocument && ( + <Route exact path={archivePath()} component={Archive} /> + )} + {can.createDocument && ( + <Route exact path={trashPath()} component={Trash} /> + )} + <Route path={`${homePath()}/:tab?`} component={Home} /> + <Redirect from="/dashboard" to={homePath()} /> + <Redirect exact from="/starred" to={homePath()} /> + <Redirect + exact + from="/templates" + to={settingsPath("templates")} + /> + <Redirect exact from="/collections/*" to="/collection/*" /> + <Route exact path="/collection/:id/new" component={DocumentNew} /> + <Route + exact + path="/collection/:id/:tab?" + component={Collection} + /> + <Route exact path="/doc/new" component={DocumentNew} /> + <Route exact path={`/d/${slug}`} component={RedirectDocument} /> + <Route + exact + path={`/doc/${slug}/history/:revisionId?`} + component={Document} + /> + <Route + exact + path={`/doc/${slug}/insights`} + component={Document} + /> + <Route exact path={`/doc/${slug}/edit`} component={Document} /> + <Route path={`/doc/${slug}`} component={Document} /> + <Route + exact + path={`${searchPath()}/:query?`} + component={Search} + /> + <Route path="/404" component={Error404} /> + <SettingsRoutes /> + <Route component={Error404} /> + </Switch> + </React.Suspense> + </AuthenticatedLayout> + </WebsocketProvider> + </Switch> ); } diff --git a/app/routes/index.tsx b/app/routes/index.tsx index 3f90c125b8..a508966a4f 100644 --- a/app/routes/index.tsx +++ b/app/routes/index.tsx @@ -6,14 +6,15 @@ import FullscreenLoading from "~/components/FullscreenLoading"; import Route from "~/components/ProfiledRoute"; import env from "~/env"; import useQueryNotices from "~/hooks/useQueryNotices"; -import lazyWithRetry from "~/utils/lazyWithRetry"; +import lazy from "~/utils/lazyWithRetry"; import { matchDocumentSlug as slug } from "~/utils/routeHelpers"; -const Authenticated = lazyWithRetry(() => import("~/components/Authenticated")); -const AuthenticatedRoutes = lazyWithRetry(() => import("./authenticated")); -const SharedDocument = lazyWithRetry(() => import("~/scenes/Document/Shared")); -const Login = lazyWithRetry(() => import("~/scenes/Login")); -const Logout = lazyWithRetry(() => import("~/scenes/Logout")); +const Authenticated = lazy(() => import("~/components/Authenticated")); +const AuthenticatedRoutes = lazy(() => import("./authenticated")); +const SharedDocument = lazy(() => import("~/scenes/Document/Shared")); +const Login = lazy(() => import("~/scenes/Login")); +const Logout = lazy(() => import("~/scenes/Logout")); +const OAuthAuthorize = lazy(() => import("~/scenes/Login/OAuthAuthorize")); export default function Routes() { useQueryNotices(); @@ -43,6 +44,7 @@ export default function Routes() { <Route exact path="/create" component={Login} /> <Route exact path="/logout" component={Logout} /> <Route exact path="/desktop-redirect" component={DesktopRedirect} /> + <Route exact path="/oauth/authorize" component={OAuthAuthorize} /> <Redirect exact from="/share/:shareId" to="/s/:shareId" /> <Route exact path="/s/:shareId" component={SharedDocument} /> diff --git a/app/routes/settings.tsx b/app/routes/settings.tsx index 8a5d54b68a..f32664acb3 100644 --- a/app/routes/settings.tsx +++ b/app/routes/settings.tsx @@ -7,6 +7,7 @@ import useSettingsConfig from "~/hooks/useSettingsConfig"; import lazy from "~/utils/lazyWithRetry"; import { matchDocumentSlug, settingsPath } from "~/utils/routeHelpers"; +const Application = lazy(() => import("~/scenes/Settings/Application")); const Document = lazy(() => import("~/scenes/Document")); export default function SettingsRoutes() { @@ -22,6 +23,12 @@ export default function SettingsRoutes() { component={config.component} /> ))} + {/* TODO: Refactor these exceptions into config? */} + <Route + exact + path={`${settingsPath("applications")}/:id`} + component={Application} + /> <Route exact path={`${settingsPath("templates")}/${matchDocumentSlug}`} diff --git a/app/scenes/Login/index.tsx b/app/scenes/Login/Login.tsx similarity index 90% rename from app/scenes/Login/index.tsx rename to app/scenes/Login/Login.tsx index 96a356abe2..f41ac04f4a 100644 --- a/app/scenes/Login/index.tsx +++ b/app/scenes/Login/Login.tsx @@ -13,7 +13,6 @@ import { Config } from "~/stores/AuthStore"; import { AvatarSize } from "~/components/Avatar"; import ButtonLarge from "~/components/ButtonLarge"; import ChangeLanguage from "~/components/ChangeLanguage"; -import Fade from "~/components/Fade"; import Flex from "~/components/Flex"; import Heading from "~/components/Heading"; import OutlineIcon from "~/components/Icons/OutlineIcon"; @@ -30,21 +29,23 @@ import { } from "~/hooks/useLastVisitedPath"; import useQuery from "~/hooks/useQuery"; import useStores from "~/hooks/useStores"; -import { draggableOnDesktop } from "~/styles"; import Desktop from "~/utils/Desktop"; import isCloudHosted from "~/utils/isCloudHosted"; import { detectLanguage } from "~/utils/language"; import { homePath } from "~/utils/routeHelpers"; import AuthenticationProvider from "./components/AuthenticationProvider"; -import BackButton from "./components/BackButton"; -import Notices from "./components/Notices"; +import { BackButton } from "./components/BackButton"; +import { Background } from "./components/Background"; +import { Centered } from "./components/Centered"; +import { Notices } from "./components/Notices"; import { getRedirectUrl, navigateToSubdomain } from "./urls"; type Props = { children?: (config?: Config) => React.ReactNode; + onBack?: () => void; }; -function Login({ children }: Props) { +function Login({ children, onBack }: Props) { const location = useLocation(); const query = useQuery(); const notice = query.get("notice"); @@ -110,9 +111,9 @@ function Login({ children }: Props) { if (error) { return ( <Background> - <BackButton /> + <BackButton onBack={onBack} /> <ChangeLanguage locale={detectLanguage()} /> - <Centered align="center" justify="center" column auto> + <Centered> <PageTitle title={t("Login")} /> <Heading centered>{t("Error")}</Heading> <Note> @@ -142,9 +143,9 @@ function Login({ children }: Props) { if (isCloudHosted && isCustomDomain && !config.name) { return ( <Background> - <BackButton config={config} /> + <BackButton onBack={onBack} config={config} /> <ChangeLanguage locale={detectLanguage()} /> - <Centered align="center" justify="center" column auto> + <Centered> <PageTitle title={t("Custom domain setup")} /> <Heading centered>{t("Almost there")}…</Heading> <Note> @@ -160,17 +161,10 @@ function Login({ children }: Props) { if (Desktop.isElectron() && notice === "domain-required") { return ( <Background> - <BackButton config={config} /> + <BackButton onBack={onBack} config={config} /> <ChangeLanguage locale={detectLanguage()} /> - <Centered - as="form" - onSubmit={handleGoSubdomain} - align="center" - justify="center" - column - auto - > + <Centered as="form" onSubmit={handleGoSubdomain}> <Heading centered>{t("Choose workspace")}</Heading> <Note> {t( @@ -206,8 +200,8 @@ function Login({ children }: Props) { if (emailLinkSentTo) { return ( <Background> - <BackButton config={config} /> - <Centered align="center" justify="center" column auto> + <BackButton onBack={onBack} config={config} /> + <Centered> <PageTitle title={t("Check your email")} /> <CheckEmailIcon size={38} /> <Heading centered>{t("Check your email")}</Heading> @@ -241,10 +235,10 @@ function Login({ children }: Props) { return ( <Background> - <BackButton config={config} /> + <BackButton onBack={onBack} config={config} /> <ChangeLanguage locale={detectLanguage()} /> - <Centered align="center" justify="center" gap={12} column auto> + <Centered gap={12}> <PageTitle title={config.name ? `${config.name} – ${t("Login")}` : t("Login")} /> @@ -336,14 +330,6 @@ const CheckEmailIcon = styled(EmailIcon)` margin-bottom: -1.5em; `; -const Background = styled(Fade)` - width: 100vw; - height: 100%; - background: ${s("background")}; - display: flex; - ${draggableOnDesktop()} -`; - const Logo = styled.div` margin-bottom: -4px; `; @@ -389,12 +375,4 @@ const Or = styled.hr` } `; -const Centered = styled(Flex)` - user-select: none; - width: 90vw; - height: 100%; - max-width: 320px; - margin: 0 auto; -`; - export default observer(Login); diff --git a/app/scenes/Login/OAuthAuthorize.tsx b/app/scenes/Login/OAuthAuthorize.tsx new file mode 100644 index 0000000000..e4257bfcaf --- /dev/null +++ b/app/scenes/Login/OAuthAuthorize.tsx @@ -0,0 +1,260 @@ +import React from "react"; +import { Trans, useTranslation } from "react-i18next"; +import styled from "styled-components"; +import Flex from "@shared/components/Flex"; +import { s } from "@shared/styles"; +import { parseDomain } from "@shared/utils/domains"; +import type OAuthClient from "~/models/oauth/OAuthClient"; +import ButtonLarge from "~/components/ButtonLarge"; +import ChangeLanguage from "~/components/ChangeLanguage"; +import Heading from "~/components/Heading"; +import LoadingIndicator from "~/components/LoadingIndicator"; +import PageTitle from "~/components/PageTitle"; +import Text from "~/components/Text"; +import env from "~/env"; +import useCurrentTeam from "~/hooks/useCurrentTeam"; +import { useLoggedInSessions } from "~/hooks/useLoggedInSessions"; +import useQuery from "~/hooks/useQuery"; +import useRequest from "~/hooks/useRequest"; +import { client } from "~/utils/ApiClient"; +import { BadRequestError, NotFoundError } from "~/utils/errors"; +import isCloudHosted from "~/utils/isCloudHosted"; +import { detectLanguage } from "~/utils/language"; +import Login from "./Login"; +import { OAuthScopeHelper } from "./OAuthScopeHelper"; +import { Background } from "./components/Background"; +import { Centered } from "./components/Centered"; +import { ConnectHeader } from "./components/ConnectHeader"; +import { TeamSwitcher } from "./components/TeamSwitcher"; + +export default function OAuthAuthorize() { + const team = useCurrentTeam({ rejectOnEmpty: false }); + const sessions = useLoggedInSessions(); + + // We're self-hosted or on a team subdomain already, just show the authorize screen. + if (team) { + return <Authorize />; + } + + // Cloud hosted and on root domain – show the workspace switcher. + const isAppRoot = + parseDomain(window.location.hostname).host === parseDomain(env.URL).host; + const hasLoggedInSessions = Object.keys(sessions).length > 0; + if (isCloudHosted && hasLoggedInSessions && isAppRoot) { + return <TeamSwitcher sessions={sessions} />; + } + + return <Login />; +} + +/** + * Authorize component is responsible for handling the OAuth authorization process. + * It retrieves the OAuth client information, displays the authorization request, + * and allows the user to either authorize or cancel the request. + */ +function Authorize() { + const team = useCurrentTeam(); + const params = useQuery(); + const { t } = useTranslation(); + const [isSubmitting, setIsSubmitting] = React.useState(false); + const timeoutRef = React.useRef<number>(); + const { + client_id: clientId, + redirect_uri: redirectUri, + response_type: responseType, + code_challenge: codeChallenge, + code_challenge_method: codeChallengeMethod, + state, + scope, + } = Object.fromEntries(params); + const [scopes] = React.useState(() => scope?.split(" ") ?? []); + const { error: clientError, data: response } = useRequest<{ + data: OAuthClient; + }>(() => client.post("/oauthClients.info", { clientId, redirectUri }), true); + + const handleCancel = () => { + if (redirectUri && !clientError) { + const url = new URL(redirectUri); + url.searchParams.set("error", "access_denied"); + window.location.href = url.toString(); + return; + } + if (window.history.length) { + window.history.back(); + } else { + window.location.href = "/"; + } + }; + + const handleSubmit = () => { + setIsSubmitting(true); + timeoutRef.current = window.setTimeout(() => setIsSubmitting(false), 5000); + }; + + React.useEffect( + () => () => { + timeoutRef.current && window.clearTimeout(timeoutRef.current); + }, + [] + ); + + const missingParams = [ + !clientId && "client_id", + !redirectUri && "redirect_uri", + !responseType && "response_type", + !scope && "scope", + !state && "state", + ].filter(Boolean); + + if (missingParams.length || clientError) { + return ( + <Background> + <Centered> + <StyledHeading>{t("An error occurred")}</StyledHeading> + {clientError instanceof NotFoundError ? ( + <Text as="p" type="secondary"> + {t( + "The OAuth client could not be found, please check the provided client ID" + )} + <Pre>{clientId}</Pre> + </Text> + ) : clientError instanceof BadRequestError ? ( + <Text as="p" type="secondary"> + {t( + "The OAuth client could not be loaded, please check the redirect URI is valid" + )} + <Pre>{redirectUri}</Pre> + </Text> + ) : ( + <Text as="p" type="secondary"> + {t("Required OAuth parameters are missing")} + <Pre> + {missingParams.map((param) => ( + <> + {param} + <br /> + </> + ))} + </Pre> + </Text> + )} + </Centered> + </Background> + ); + } + + if (!response) { + return <LoadingIndicator />; + } + + const { name, developerName, developerUrl } = response.data; + + return ( + <Background> + <ChangeLanguage locale={detectLanguage()} /> + <PageTitle title={t("Authorize")} /> + <Centered gap={12}> + <ConnectHeader team={team} oauthClient={response.data} /> + <StyledHeading> + {t(`{{ appName }} wants to access {{ teamName }}`, { + appName: name, + teamName: team.name, + })} + </StyledHeading> + {developerName && ( + <Text type="secondary" as="p" style={{ marginTop: -12 }}> + <Trans + defaults="By <em>{{ developerName }}</em>" + values={{ + developerName, + }} + components={{ + em: developerUrl ? ( + <Text + as="a" + type="secondary" + weight="bold" + href={developerUrl} + target="_blank" + rel="noopener noreferrer" + /> + ) : ( + <strong /> + ), + }} + /> + </Text> + )} + <Text type="tertiary" as="p"> + {t( + "{{ appName }} will be able to access your account and perform the following actions", + { + appName: name, + } + )} + : + </Text> + <ul style={{ width: "100%", paddingLeft: "1em", marginTop: 0 }}> + {OAuthScopeHelper.normalizeScopes(scopes, t).map((item) => ( + <li key={item}> + <Text type="secondary">{item}</Text> + </li> + ))} + </ul> + <form + method="POST" + action="/oauth/authorize" + style={{ width: "100%" }} + onSubmit={handleSubmit} + > + <input type="hidden" name="client_id" value={clientId ?? ""} /> + <input type="hidden" name="redirect_uri" value={redirectUri ?? ""} /> + <input + type="hidden" + name="response_type" + value={responseType ?? ""} + /> + <input type="hidden" name="state" value={state ?? ""} /> + <input type="hidden" name="scope" value={scope ?? ""} /> + {codeChallenge && ( + <input type="hidden" name="code_challenge" value={codeChallenge} /> + )} + {codeChallengeMethod && ( + <input + type="hidden" + name="code_challenge_method" + value={codeChallengeMethod} + /> + )} + <Flex gap={8} justify="space-between"> + <Button type="button" onClick={handleCancel} neutral> + {t("Cancel")} + </Button> + <Button type="submit" disabled={isSubmitting}> + {t("Authorize")} + </Button> + </Flex> + </form> + </Centered> + </Background> + ); +} + +const Button = styled(ButtonLarge)` + width: calc(50% - 4px); +`; + +const StyledHeading = styled(Heading).attrs({ + as: "h2", + centered: true, +})` + margin-top: 0; +`; + +const Pre = styled.pre` + background: ${s("backgroundSecondary")}; + padding: 16px; + border-radius: 4px; + font-size: 12px; + white-space: pre-wrap; +`; diff --git a/app/scenes/Login/OAuthScopeHelper.ts b/app/scenes/Login/OAuthScopeHelper.ts new file mode 100644 index 0000000000..598d4ef004 --- /dev/null +++ b/app/scenes/Login/OAuthScopeHelper.ts @@ -0,0 +1,56 @@ +import type { TFunction } from "i18next"; +import capitalize from "lodash/capitalize"; +import uniq from "lodash/uniq"; +import { Scope } from "@shared/types"; + +export class OAuthScopeHelper { + public static normalizeScopes(scopes: string[], t: TFunction): string[] { + const methodToReadable = { + list: t("read"), + info: t("read"), + read: t("read"), + write: t("write"), + create: t("write"), + update: t("write"), + delete: t("write"), + "*": t("read and write"), + }; + + const translatedNamespaces = { + apiKeys: t("API keys"), + attachments: t("attachments"), + collections: t("collections"), + comments: t("comments"), + documents: t("documents"), + events: t("events"), + groups: t("groups"), + integrations: t("integrations"), + notifications: t("notifications"), + reactions: t("reactions"), + pins: t("pins"), + shares: t("shares"), + users: t("users"), + teams: t("teams"), + "*": t("workspace"), + }; + + const normalizedScopes = scopes.map((scope) => { + if (scope === Scope.Read) { + return t("Read all data"); + } + if (scope === Scope.Write) { + return t("Write all data"); + } + + const [namespace, method] = scope.replace("/api/", "").split(/[:\.]/g); + const readableMethod = + methodToReadable[method as keyof typeof methodToReadable] ?? method; + const translatedNamespace = + translatedNamespaces[namespace as keyof typeof translatedNamespaces] ?? + namespace; + return capitalize(`${readableMethod} ${translatedNamespace}`); + }); + + return uniq(normalizedScopes); + } +} diff --git a/app/scenes/Login/components/BackButton.tsx b/app/scenes/Login/components/BackButton.tsx index 28ce8aa6b2..477ce6992f 100644 --- a/app/scenes/Login/components/BackButton.tsx +++ b/app/scenes/Login/components/BackButton.tsx @@ -10,12 +10,21 @@ import isCloudHosted from "~/utils/isCloudHosted"; type Props = { config?: Config; + onBack?: () => void; }; -export default function BackButton({ config }: Props) { +export function BackButton({ onBack, config }: Props) { const { t } = useTranslation(); const isSubdomain = !!config?.hostname; + if (onBack) { + return ( + <Link onClick={onBack}> + <BackIcon /> {t("Back")} + </Link> + ); + } + if (!isCloudHosted || parseDomain(window.location.origin).custom) { return null; } diff --git a/app/scenes/Login/components/Background.tsx b/app/scenes/Login/components/Background.tsx new file mode 100644 index 0000000000..532d6e9841 --- /dev/null +++ b/app/scenes/Login/components/Background.tsx @@ -0,0 +1,12 @@ +import styled from "styled-components"; +import { s } from "@shared/styles"; +import Fade from "~/components/Fade"; +import { draggableOnDesktop } from "~/styles"; + +export const Background = styled(Fade)` + width: 100vw; + height: 100%; + background: ${s("background")}; + display: flex; + ${draggableOnDesktop()} +`; diff --git a/app/scenes/Login/components/Centered.tsx b/app/scenes/Login/components/Centered.tsx new file mode 100644 index 0000000000..4c84301af1 --- /dev/null +++ b/app/scenes/Login/components/Centered.tsx @@ -0,0 +1,15 @@ +import styled from "styled-components"; +import Flex from "@shared/components/Flex"; + +export const Centered = styled(Flex).attrs({ + align: "center", + justify: "center", + column: true, + auto: true, +})` + user-select: none; + width: 90vw; + height: 100%; + max-width: 320px; + margin: 0 auto; +`; diff --git a/app/scenes/Login/components/ConnectHeader.tsx b/app/scenes/Login/components/ConnectHeader.tsx new file mode 100644 index 0000000000..4e7bb6d97c --- /dev/null +++ b/app/scenes/Login/components/ConnectHeader.tsx @@ -0,0 +1,40 @@ +import { MoreIcon } from "outline-icons"; +import * as React from "react"; +import Flex from "@shared/components/Flex"; +import Text from "@shared/components/Text"; +import type Team from "~/models/Team"; +import type OAuthClient from "~/models/oauth/OAuthClient"; +import { Avatar } from "~/components/Avatar"; +import { AvatarSize, AvatarVariant } from "~/components/Avatar/Avatar"; + +type Props = { + team: Team; + oauthClient: OAuthClient; +}; + +export function ConnectHeader({ team, oauthClient }: Props) { + return ( + <Text type="tertiary"> + <Flex gap={12} align="center"> + <Avatar + variant={AvatarVariant.Square} + model={{ + avatarUrl: oauthClient.avatarUrl, + initial: oauthClient.name[0], + }} + size={AvatarSize.XXLarge} + alt={oauthClient.name} + /> + + <MoreIcon /> + + <Avatar + variant={AvatarVariant.Square} + model={team} + size={AvatarSize.XXLarge} + alt={team.name} + /> + </Flex> + </Text> + ); +} diff --git a/app/scenes/Login/components/Notices.tsx b/app/scenes/Login/components/Notices.tsx index 0a752b3f37..a434e7b1a6 100644 --- a/app/scenes/Login/components/Notices.tsx +++ b/app/scenes/Login/components/Notices.tsx @@ -123,7 +123,7 @@ function Message({ notice }: { notice: string }) { } } -export default function Notices() { +export function Notices() { const query = useQuery(); const notice = query.get("notice"); diff --git a/app/scenes/Login/components/TeamSwitcher.tsx b/app/scenes/Login/components/TeamSwitcher.tsx new file mode 100644 index 0000000000..a0007089ef --- /dev/null +++ b/app/scenes/Login/components/TeamSwitcher.tsx @@ -0,0 +1,109 @@ +import { ArrowIcon } from "outline-icons"; +import React from "react"; +import { useTranslation } from "react-i18next"; +import styled from "styled-components"; +import Text from "@shared/components/Text"; +import { s } from "@shared/styles"; +import { AvatarSize } from "~/components/Avatar"; +import Avatar, { AvatarVariant } from "~/components/Avatar/Avatar"; +import ChangeLanguage from "~/components/ChangeLanguage"; +import Heading from "~/components/Heading"; +import OutlineIcon from "~/components/Icons/OutlineIcon"; +import env from "~/env"; +import type { Sessions } from "~/hooks/useLoggedInSessions"; +import { detectLanguage } from "~/utils/language"; +import Login from "../Login"; +import { Background } from "./Background"; +import { Centered } from "./Centered"; + +type Props = { sessions: Sessions }; + +export function TeamSwitcher({ sessions }: Props) { + const { t } = useTranslation(); + const [showLogin, setShowLogin] = React.useState(false); + const url = new URL(window.location.href); + const appName = env.APP_NAME; + + if (showLogin) { + return <Login onBack={() => setShowLogin(false)} />; + } + + return ( + <Background> + <ChangeLanguage locale={detectLanguage()} /> + <Centered> + <OutlineIcon size={AvatarSize.XXLarge} /> + + <StyledHeading>{t("Choose a workspace")}</StyledHeading> + <Text type="tertiary" as="p"> + {t( + "Choose an {{ appName }} workspace or login to continue connecting this app", + { appName } + )} + . + </Text> + {Object.keys(sessions)?.map((teamId) => { + const session = sessions[teamId]; + const location = session.url + url.pathname + url.search; + return ( + <TeamLink href={location} key={session.url}> + <Avatar + variant={AvatarVariant.Square} + model={{ + avatarUrl: session.logoUrl, + initial: session.name[0], + }} + size={AvatarSize.Large} + alt={session.name} + /> + {session.name} + <StyledArrowIcon /> + </TeamLink> + ); + })} + <TeamLink onClick={() => setShowLogin(true)}> + <ArrowIcon size={AvatarSize.Large} /> + {t("Login to workspace")} + </TeamLink> + </Centered> + </Background> + ); +} + +const StyledArrowIcon = styled(ArrowIcon)` + position: absolute; + transition: all 0.2s ease-in-out; + opacity: 0; + right: 12px; +`; + +const TeamLink = styled.a` + position: relative; + left: -8px; + right: -8px; + display: flex; + align-items: center; + gap: 8px; + padding: 8px; + margin: 4px; + border-radius: 8px; + width: 100%; + color: ${s("text")}; + font-weight: ${s("fontWeightMedium")}; + + &:hover { + background: ${s("listItemHoverBackground")}; + + ${StyledArrowIcon} { + opacity: 1; + right: 8px; + } + } +`; + +const StyledHeading = styled(Heading).attrs({ + as: "h2", + centered: true, +})` + margin-top: 0; +`; diff --git a/app/scenes/Login/index.ts b/app/scenes/Login/index.ts new file mode 100644 index 0000000000..04230a1bd9 --- /dev/null +++ b/app/scenes/Login/index.ts @@ -0,0 +1,3 @@ +import Login from "./Login"; + +export default Login; diff --git a/app/scenes/Settings/APIAndApps.tsx b/app/scenes/Settings/APIAndApps.tsx new file mode 100644 index 0000000000..1ec53c1adb --- /dev/null +++ b/app/scenes/Settings/APIAndApps.tsx @@ -0,0 +1,107 @@ +import { observer } from "mobx-react"; +import { PadlockIcon } from "outline-icons"; +import * as React from "react"; +import { useTranslation, Trans } from "react-i18next"; +import ApiKey from "~/models/ApiKey"; +import OAuthAuthentication from "~/models/oauth/OAuthAuthentication"; +import { Action } from "~/components/Actions"; +import Button from "~/components/Button"; +import Heading from "~/components/Heading"; +import PaginatedList from "~/components/PaginatedList"; +import Scene from "~/components/Scene"; +import Text from "~/components/Text"; +import { createApiKey } from "~/actions/definitions/apiKeys"; +import env from "~/env"; +import useActionContext from "~/hooks/useActionContext"; +import useCurrentTeam from "~/hooks/useCurrentTeam"; +import useCurrentUser from "~/hooks/useCurrentUser"; +import usePolicy from "~/hooks/usePolicy"; +import useStores from "~/hooks/useStores"; +import ApiKeyListItem from "./components/ApiKeyListItem"; +import OAuthAuthenticationListItem from "./components/OAuthAuthenticationListItem"; + +function APIAndApps() { + const team = useCurrentTeam(); + const user = useCurrentUser(); + const { t } = useTranslation(); + const { apiKeys, oauthAuthentications } = useStores(); + const can = usePolicy(team); + const context = useActionContext(); + const appName = env.APP_NAME; + + return ( + <Scene + title={t("API & Apps")} + icon={<PadlockIcon />} + actions={ + <> + {can.createApiKey && ( + <Action> + <Button + type="submit" + value={`${t("New API key")}…`} + action={createApiKey} + context={context} + /> + </Action> + )} + </> + } + > + <Heading>{t("API & Apps")}</Heading> + <h2>{t("API keys")}</h2> + {can.createApiKey ? ( + <Text as="p" type="secondary"> + <Trans + defaults="Create personal API keys to authenticate with the API and programatically control + your workspace's data. For more details see the <em>developer documentation</em>." + components={{ + em: ( + <a + href="https://www.getoutline.com/developers" + target="_blank" + rel="noreferrer" + /> + ), + }} + /> + </Text> + ) : ( + <Trans> + {t("API keys have been disabled by an admin for your account")} + </Trans> + )} + <PaginatedList<ApiKey> + fetch={apiKeys.fetchPage} + items={apiKeys.personalApiKeys} + options={{ userId: user.id }} + renderItem={(apiKey) => ( + <ApiKeyListItem key={apiKey.id} apiKey={apiKey} /> + )} + /> + <PaginatedList + fetch={oauthAuthentications.fetchPage} + items={oauthAuthentications.orderedData} + heading={ + <> + <h2>{t("Application access")}</h2> + <Text as="p" type="secondary"> + {t( + "Manage which third-party and internal applications have been granted access to your {{ appName }} account.", + { appName } + )} + </Text> + </> + } + renderItem={(oauthAuthentication: OAuthAuthentication) => ( + <OAuthAuthenticationListItem + key={oauthAuthentication.id} + oauthAuthentication={oauthAuthentication} + /> + )} + /> + </Scene> + ); +} + +export default observer(APIAndApps); diff --git a/app/scenes/Settings/ApiKeys.tsx b/app/scenes/Settings/ApiKeys.tsx index b9989d7fff..09e73f9500 100644 --- a/app/scenes/Settings/ApiKeys.tsx +++ b/app/scenes/Settings/ApiKeys.tsx @@ -61,7 +61,6 @@ function ApiKeys() { <PaginatedList<ApiKey> fetch={apiKeys.fetchPage} items={apiKeys.orderedData} - heading={<h2>{t("All")}</h2>} renderItem={(apiKey) => ( <ApiKeyListItem key={apiKey.id} apiKey={apiKey} /> )} diff --git a/app/scenes/Settings/Application.tsx b/app/scenes/Settings/Application.tsx new file mode 100644 index 0000000000..4aaf1f471c --- /dev/null +++ b/app/scenes/Settings/Application.tsx @@ -0,0 +1,325 @@ +import { observer } from "mobx-react"; +import { CopyIcon, InternetIcon, ReplaceIcon } from "outline-icons"; +import * as React from "react"; +import { Controller, useForm } from "react-hook-form"; +import { useTranslation } from "react-i18next"; +import { useParams } from "react-router-dom"; +import { toast } from "sonner"; +import { OAuthClientValidation } from "@shared/validations"; +import OAuthClient from "~/models/oauth/OAuthClient"; +import Breadcrumb from "~/components/Breadcrumb"; +import Button from "~/components/Button"; +import ConfirmationDialog from "~/components/ConfirmationDialog"; +import ContentEditable from "~/components/ContentEditable"; +import Heading from "~/components/Heading"; +import Input from "~/components/Input"; +import LoadingIndicator from "~/components/LoadingIndicator"; +import NudeButton from "~/components/NudeButton"; +import { FormData } from "~/components/OAuthClient/OAuthClientForm"; +import Scene from "~/components/Scene"; +import Switch from "~/components/Switch"; +import Tooltip from "~/components/Tooltip"; +import useRequest from "~/hooks/useRequest"; +import useStores from "~/hooks/useStores"; +import OAuthClientMenu from "~/menus/OAuthClientMenu"; +import isCloudHosted from "~/utils/isCloudHosted"; +import { settingsPath } from "~/utils/routeHelpers"; +import { ActionRow } from "./components/ActionRow"; +import { CopyButton } from "./components/CopyButton"; +import ImageInput from "./components/ImageInput"; +import SettingRow from "./components/SettingRow"; + +type Props = { + oauthClient: OAuthClient; +}; + +const LoadingState = observer(function LoadingState() { + const { id } = useParams<{ id: string }>(); + const { oauthClients } = useStores(); + const oauthClient = oauthClients.get(id); + const { request } = useRequest(() => oauthClients.fetch(id)); + + React.useEffect(() => { + if (!oauthClient) { + void request(); + } + }, [oauthClient]); + + if (!oauthClient) { + return <LoadingIndicator />; + } + + return <Application oauthClient={oauthClient} />; +}); + +const Application = observer(function Application({ oauthClient }: Props) { + const { t } = useTranslation(); + const { dialogs } = useStores(); + + const { + register, + handleSubmit: formHandleSubmit, + formState, + getValues, + setError, + control, + } = useForm<FormData>({ + mode: "all", + defaultValues: { + name: oauthClient.name ?? "", + developerName: oauthClient.developerName ?? "", + developerUrl: oauthClient.developerUrl ?? "", + description: oauthClient.description ?? "", + avatarUrl: oauthClient.avatarUrl ?? "", + redirectUris: oauthClient.redirectUris ?? [], + published: oauthClient.published ?? false, + }, + }); + + const handleSubmit = React.useCallback( + async (data: FormData) => { + try { + await oauthClient.save(data); + toast.success( + oauthClient.published + ? t("Application published") + : t("Application updated") + ); + } catch (error) { + toast.error(error.message); + } + }, + [oauthClient, t] + ); + + const handleRotateSecret = React.useCallback(async () => { + const onDelete = async () => { + try { + await oauthClient.rotateClientSecret(); + toast.success(t("Client secret rotated")); + } catch (err) { + toast.error(err.message); + } + }; + + dialogs.openModal({ + title: t("Rotate secret"), + content: ( + <ConfirmationDialog onSubmit={onDelete} danger> + {t( + "Rotating the client secret will invalidate the current secret. Make sure to update any applications using these credentials." + )} + </ConfirmationDialog> + ), + }); + }, [t, dialogs, oauthClient]); + + return ( + <Scene + title={oauthClient.name} + left={ + <Breadcrumb + items={[ + { + type: "route", + title: t("Applications"), + to: settingsPath("applications"), + icon: <InternetIcon />, + }, + ]} + /> + } + actions={<OAuthClientMenu oauthClient={oauthClient} showEdit={false} />} + > + <form onSubmit={formHandleSubmit(handleSubmit)}> + <Heading> + <Controller + control={control} + name="name" + render={({ field }) => ( + <ContentEditable + value={field.value} + placeholder={t("Name")} + onChange={field.onChange} + maxLength={OAuthClientValidation.maxNameLength} + /> + )} + /> + </Heading> + + <SettingRow + label={t("Icon")} + name="avatarUrl" + description={t("Displayed to users when authorizing")} + > + <Controller + control={control} + name="avatarUrl" + render={({ field }) => ( + <ImageInput + onSuccess={(url) => field.onChange(url)} + onError={(err) => setError("avatarUrl", { message: err })} + model={{ + id: oauthClient.id, + avatarUrl: field.value, + initial: getValues().name[0], + }} + borderRadius={0} + /> + )} + /> + </SettingRow> + + <SettingRow + name="description" + label={t("Tagline")} + description={t("A short description")} + > + <Input + type="text" + {...register("description", { + maxLength: OAuthClientValidation.maxDescriptionLength, + })} + flex + /> + </SettingRow> + + <SettingRow + name="details" + label={t("Details")} + description={t( + "Developer information shown to users when authorizing" + )} + border={isCloudHosted} + > + <Input + type="text" + label={t("Developer name")} + {...register("developerName", { + maxLength: OAuthClientValidation.maxDeveloperNameLength, + })} + flex + /> + <Input + type="text" + label={t("Developer URL")} + {...register("developerUrl", { + maxLength: OAuthClientValidation.maxDeveloperUrlLength, + })} + flex + /> + </SettingRow> + {isCloudHosted && ( + <SettingRow + name="published" + label={t("Published")} + description={t( + "Allow users from other workspaces to authorize this app" + )} + border={false} + > + <Switch id="published" {...register("published")} /> + </SettingRow> + )} + + <h2>{t("Credentials")}</h2> + <SettingRow + name="clientId" + label={t("OAuth client ID")} + description={t("The public identifier for this app")} + > + <Input id="clientId" value={oauthClient.clientId} readOnly> + <CopyButton + value={oauthClient.clientId} + success={t("Copied to clipboard")} + tooltip={t("Copy")} + icon={<CopyIcon size={20} />} + /> + </Input> + </SettingRow> + <SettingRow + name="clientSecret" + label={t("OAuth client secret")} + description={t( + "Store this value securely, do not expose it publicly" + )} + > + <Input + id="clientSecret" + type="password" + value={oauthClient.clientSecret} + readOnly + > + <Tooltip content={t("Rotate secret")} placement="top"> + <NudeButton type="button" onClick={handleRotateSecret}> + <ReplaceIcon size={20} /> + </NudeButton> + </Tooltip> + + <CopyButton + value={oauthClient.clientSecret} + success={t("Copied to clipboard")} + tooltip={t("Copy")} + icon={<CopyIcon size={20} />} + /> + </Input> + </SettingRow> + <SettingRow + name="redirectUris" + label={t("Callback URLs")} + description={t( + "Where users are redirected after authorizing this app" + )} + > + <Controller + control={control} + name="redirectUris" + render={({ field }) => ( + <Input + id="redirectUris" + type="textarea" + placeholder="https://example.com/callback" + ref={field.ref} + value={field.value.join("\n")} + rows={Math.max(2, field.value.length + 1)} + onChange={(event) => { + field.onChange(event.target.value.split("\n")); + }} + required + /> + )} + /> + </SettingRow> + <SettingRow + name="authorizationUrl" + label={t("Authorization URL")} + description={t("Where users are redirected to authorize this app")} + border={false} + > + <Input + id="authorizationUrl" + value={oauthClient.authorizationUrl} + readOnly + > + <CopyButton + value={oauthClient.authorizationUrl} + success={t("Copied to clipboard")} + tooltip={t("Copy link")} + /> + </Input> + </SettingRow> + + <ActionRow> + <Button + type="submit" + disabled={formState.isSubmitting || !formState.isValid} + > + {formState.isSubmitting ? `${t("Saving")}…` : t("Save")} + </Button> + </ActionRow> + </form> + </Scene> + ); +}); + +export default LoadingState; diff --git a/app/scenes/Settings/PersonalApiKeys.tsx b/app/scenes/Settings/Applications.tsx similarity index 53% rename from app/scenes/Settings/PersonalApiKeys.tsx rename to app/scenes/Settings/Applications.tsx index 32bb83d0c6..36a68a0b75 100644 --- a/app/scenes/Settings/PersonalApiKeys.tsx +++ b/app/scenes/Settings/Applications.tsx @@ -1,42 +1,40 @@ import { observer } from "mobx-react"; -import { CodeIcon } from "outline-icons"; +import { InternetIcon } from "outline-icons"; import * as React from "react"; import { useTranslation, Trans } from "react-i18next"; -import ApiKey from "~/models/ApiKey"; +import OAuthClient from "~/models/oauth/OAuthClient"; import { Action } from "~/components/Actions"; import Button from "~/components/Button"; import Heading from "~/components/Heading"; import PaginatedList from "~/components/PaginatedList"; import Scene from "~/components/Scene"; import Text from "~/components/Text"; -import { createApiKey } from "~/actions/definitions/apiKeys"; +import { createOAuthClient } from "~/actions/definitions/oauthClients"; import useActionContext from "~/hooks/useActionContext"; import useCurrentTeam from "~/hooks/useCurrentTeam"; -import useCurrentUser from "~/hooks/useCurrentUser"; import usePolicy from "~/hooks/usePolicy"; import useStores from "~/hooks/useStores"; -import ApiKeyListItem from "./components/ApiKeyListItem"; +import OAuthClientListItem from "./components/OAuthClientListItem"; -function PersonalApiKeys() { +function Applications() { const team = useCurrentTeam(); - const user = useCurrentUser(); const { t } = useTranslation(); - const { apiKeys } = useStores(); + const { oauthClients } = useStores(); const can = usePolicy(team); const context = useActionContext(); return ( <Scene - title={t("API")} - icon={<CodeIcon />} + title={t("Applications")} + icon={<InternetIcon />} actions={ <> - {can.createApiKey && ( + {can.createOAuthClient && ( <Action> <Button type="submit" - value={`${t("New API key")}…`} - action={createApiKey} + value={`${t("New App")}…`} + action={createOAuthClient} context={context} /> </Action> @@ -44,12 +42,10 @@ function PersonalApiKeys() { </> } > - <Heading>{t("API")}</Heading> + <Heading>{t("Applications")}</Heading> <Text as="p" type="secondary"> <Trans - defaults="Create personal API keys to authenticate with the API and programatically control - your workspace's data. API keys have the same permissions as your user account. - For more details see the <em>developer documentation</em>." + defaults="Applications allow you to build internal or public integrations with Outline and provide secure access via OAuth. For more details see the <em>developer documentation</em>." components={{ em: ( <a @@ -61,17 +57,15 @@ function PersonalApiKeys() { }} /> </Text> - <PaginatedList<ApiKey> - fetch={apiKeys.fetchPage} - items={apiKeys.personalApiKeys} - options={{ userId: user.id }} - heading={<h2>{t("Personal keys")}</h2>} - renderItem={(apiKey) => ( - <ApiKeyListItem key={apiKey.id} apiKey={apiKey} /> + <PaginatedList<OAuthClient> + fetch={oauthClients.fetchPage} + items={oauthClients.orderedData} + renderItem={(oauthClient) => ( + <OAuthClientListItem key={oauthClient.id} oauthClient={oauthClient} /> )} /> </Scene> ); } -export default observer(PersonalApiKeys); +export default observer(Applications); diff --git a/app/scenes/Settings/Details.tsx b/app/scenes/Settings/Details.tsx index 1d9bb69f40..ba3b4449a0 100644 --- a/app/scenes/Settings/Details.tsx +++ b/app/scenes/Settings/Details.tsx @@ -108,7 +108,16 @@ function Details() { toast.error(err.message); } }, - [team, name, subdomain, defaultCollectionId, publicBranding, customTheme, t] + [ + tocPosition, + team, + name, + subdomain, + defaultCollectionId, + publicBranding, + customTheme, + t, + ] ); const handleNameChange = React.useCallback( diff --git a/app/scenes/Settings/components/CopyButton.tsx b/app/scenes/Settings/components/CopyButton.tsx new file mode 100644 index 0000000000..7334d19471 --- /dev/null +++ b/app/scenes/Settings/components/CopyButton.tsx @@ -0,0 +1,50 @@ +import { LinkIcon } from "outline-icons"; +import * as React from "react"; +import { toast } from "sonner"; +import CopyToClipboard from "~/components/CopyToClipboard"; +import NudeButton from "~/components/NudeButton"; +import Tooltip from "~/components/Tooltip"; + +type Props = { + /** The value to be copied */ + value: string; + /** The message to show when the value is copied */ + success: string; + /** The tooltip message */ + tooltip: string; + /** An optional icon */ + icon?: React.ReactNode; +}; + +/** + * A button that copies a value to the clipboard when clicked and shows a + * single icon. + */ +export function CopyButton({ + value, + success, + tooltip, + icon = <LinkIcon size={20} />, +}: Props) { + const timeout = React.useRef<ReturnType<typeof setTimeout>>(); + + const handleCopied = React.useCallback(() => { + timeout.current = setTimeout(() => { + toast.message(success); + }, 100); + + return () => { + if (timeout.current) { + clearTimeout(timeout.current); + } + }; + }, [success]); + + return ( + <Tooltip content={tooltip} placement="top"> + <CopyToClipboard text={value} onCopy={handleCopied}> + <NudeButton type="button">{icon}</NudeButton> + </CopyToClipboard> + </Tooltip> + ); +} diff --git a/app/scenes/Settings/components/ImageInput.tsx b/app/scenes/Settings/components/ImageInput.tsx index 267c4b1e6f..add17927d1 100644 --- a/app/scenes/Settings/components/ImageInput.tsx +++ b/app/scenes/Settings/components/ImageInput.tsx @@ -1,8 +1,10 @@ +import { EditIcon } from "outline-icons"; import * as React from "react"; import { useTranslation } from "react-i18next"; import styled from "styled-components"; import { s } from "@shared/styles"; import { Avatar, AvatarSize, IAvatar } from "~/components/Avatar"; +import { AvatarVariant } from "~/components/Avatar/Avatar"; import Button from "~/components/Button"; import Flex from "~/components/Flex"; import ImageUpload, { Props as ImageUploadProps } from "./ImageUpload"; @@ -17,10 +19,18 @@ export default function ImageInput({ model, onSuccess, ...rest }: Props) { return ( <Flex gap={8} justify="space-between"> <ImageBox> - <ImageUpload onSuccess={onSuccess} {...rest}> - <StyledAvatar model={model} size={AvatarSize.Upload} /> + <ImageUpload + onSuccess={onSuccess} + submitText={t("Crop Image")} + {...rest} + > + <Avatar + model={model} + size={AvatarSize.Upload} + variant={AvatarVariant.Square} + /> <Flex auto align="center" justify="center" className="upload"> - {t("Upload")} + <EditIcon /> </Flex> </ImageUpload> </ImageBox> @@ -38,10 +48,6 @@ const avatarStyles = ` height: ${AvatarSize.Upload}px; `; -const StyledAvatar = styled(Avatar)` - border-radius: 8px; -`; - const ImageBox = styled(Flex)` ${avatarStyles}; position: relative; diff --git a/app/scenes/Settings/components/OAuthAuthenticationListItem.tsx b/app/scenes/Settings/components/OAuthAuthenticationListItem.tsx new file mode 100644 index 0000000000..170ec830c4 --- /dev/null +++ b/app/scenes/Settings/components/OAuthAuthenticationListItem.tsx @@ -0,0 +1,61 @@ +import { observer } from "mobx-react"; +import * as React from "react"; +import { useTranslation } from "react-i18next"; +import OAuthAuthentication from "~/models/oauth/OAuthAuthentication"; +import { OAuthScopeHelper } from "~/scenes/Login/OAuthScopeHelper"; +import { Avatar, AvatarSize } from "~/components/Avatar"; +import { AvatarVariant } from "~/components/Avatar/Avatar"; +import ListItem from "~/components/List/Item"; +import Text from "~/components/Text"; +import Time from "~/components/Time"; +import OAuthAuthenticationMenu from "~/menus/OAuthAuthenticationMenu"; + +type Props = { + /** The OAuthAuthentication to display */ + oauthAuthentication: OAuthAuthentication; +}; + +const OAuthAuthenticationListItem = ({ oauthAuthentication }: Props) => { + const { t } = useTranslation(); + + const subtitle = ( + <> + <Text type="tertiary"> + {oauthAuthentication.lastActiveAt ? ( + <> + {t("Last active")}{" "} + <Time dateTime={oauthAuthentication.lastActiveAt} addSuffix /> + </> + ) : ( + t("Never used") + )}{" "} + ·{" "} + </Text> + <Text type="tertiary" ellipsis> + {OAuthScopeHelper.normalizeScopes(oauthAuthentication.scope, t).join( + ", " + )} + </Text> + </> + ); + + return ( + <ListItem + key={oauthAuthentication.id} + image={ + <Avatar + model={oauthAuthentication.oauthClient} + size={AvatarSize.Large} + variant={AvatarVariant.Square} + /> + } + title={oauthAuthentication.oauthClient.name} + subtitle={subtitle} + actions={ + <OAuthAuthenticationMenu oauthAuthentication={oauthAuthentication} /> + } + /> + ); +}; + +export default observer(OAuthAuthenticationListItem); diff --git a/app/scenes/Settings/components/OAuthClientDeleteDialog.tsx b/app/scenes/Settings/components/OAuthClientDeleteDialog.tsx new file mode 100644 index 0000000000..b84ae082ca --- /dev/null +++ b/app/scenes/Settings/components/OAuthClientDeleteDialog.tsx @@ -0,0 +1,37 @@ +import * as React from "react"; +import { useTranslation } from "react-i18next"; +import OAuthClient from "~/models/oauth/OAuthClient"; +import ConfirmationDialog from "~/components/ConfirmationDialog"; + +type Props = { + oauthClient: OAuthClient; + onSubmit: () => void; +}; + +export default function OAuthClientDeleteDialog({ + oauthClient, + onSubmit, +}: Props) { + const { t } = useTranslation(); + + const handleSubmit = async () => { + await oauthClient.delete(); + onSubmit(); + }; + + return ( + <ConfirmationDialog + onSubmit={handleSubmit} + submitText={t("Delete")} + savingText={`${t("Deleting")}…`} + danger + > + {t( + "Are you sure you want to delete the {{ appName }} application? This cannot be undone.", + { + appName: oauthClient.name, + } + )} + </ConfirmationDialog> + ); +} diff --git a/app/scenes/Settings/components/OAuthClientListItem.tsx b/app/scenes/Settings/components/OAuthClientListItem.tsx new file mode 100644 index 0000000000..910bbbca34 --- /dev/null +++ b/app/scenes/Settings/components/OAuthClientListItem.tsx @@ -0,0 +1,55 @@ +import { observer } from "mobx-react"; +import * as React from "react"; +import { useTranslation } from "react-i18next"; +import { Link } from "react-router-dom"; +import OAuthClient from "~/models/oauth/OAuthClient"; +import { Avatar, AvatarSize } from "~/components/Avatar"; +import { AvatarVariant } from "~/components/Avatar/Avatar"; +import ListItem from "~/components/List/Item"; +import Text from "~/components/Text"; +import Time from "~/components/Time"; +import useCurrentUser from "~/hooks/useCurrentUser"; +import OAuthClientMenu from "~/menus/OAuthClientMenu"; +import { settingsPath } from "~/utils/routeHelpers"; + +type Props = { + oauthClient: OAuthClient; +}; + +const OAuthClientListItem = ({ oauthClient }: Props) => { + const { t } = useTranslation(); + const user = useCurrentUser(); + + const subtitle = ( + <> + <Text type="tertiary"> + {t(`Created`)} <Time dateTime={oauthClient.createdAt} addSuffix />{" "} + {oauthClient.createdById === user.id + ? "" + : t(`by {{ name }}`, { name: user.name })} + </Text> + </> + ); + + return ( + <ListItem + key={oauthClient.id} + image={ + <Avatar + model={oauthClient} + size={AvatarSize.Large} + variant={AvatarVariant.Square} + /> + } + title={ + <Link to={settingsPath("applications", oauthClient.id)}> + <Text>{oauthClient.name}</Text> + </Link> + } + subtitle={subtitle} + actions={<OAuthClientMenu oauthClient={oauthClient} />} + /> + ); +}; + +export default observer(OAuthClientListItem); diff --git a/app/scenes/Settings/components/SettingRow.tsx b/app/scenes/Settings/components/SettingRow.tsx index de67a5db49..0b661bb4ab 100644 --- a/app/scenes/Settings/components/SettingRow.tsx +++ b/app/scenes/Settings/components/SettingRow.tsx @@ -39,7 +39,7 @@ const Column = styled.div` flex: 1; &:first-child { - min-width: 70%; + min-width: 65%; } &:last-child { diff --git a/app/stores/OAuthAuthenticationsStore.ts b/app/stores/OAuthAuthenticationsStore.ts new file mode 100644 index 0000000000..ba30209326 --- /dev/null +++ b/app/stores/OAuthAuthenticationsStore.ts @@ -0,0 +1,11 @@ +import OAuthAuthentication from "~/models/oauth/OAuthAuthentication"; +import RootStore from "./RootStore"; +import Store from "./base/Store"; + +export default class OAuthAuthenticationsStore extends Store<OAuthAuthentication> { + apiEndpoint = "oauthAuthentications"; + + constructor(rootStore: RootStore) { + super(rootStore, OAuthAuthentication); + } +} diff --git a/app/stores/OAuthClientsStore.ts b/app/stores/OAuthClientsStore.ts new file mode 100644 index 0000000000..a1fd075c95 --- /dev/null +++ b/app/stores/OAuthClientsStore.ts @@ -0,0 +1,11 @@ +import OAuthClient from "~/models/oauth/OAuthClient"; +import RootStore from "./RootStore"; +import Store from "./base/Store"; + +export default class OAuthClientsStore extends Store<OAuthClient> { + apiEndpoint = "oauthClients"; + + constructor(rootStore: RootStore) { + super(rootStore, OAuthClient); + } +} diff --git a/app/stores/RootStore.ts b/app/stores/RootStore.ts index 32b80b0162..224254af8e 100644 --- a/app/stores/RootStore.ts +++ b/app/stores/RootStore.ts @@ -18,6 +18,8 @@ import ImportsStore from "./ImportsStore"; import IntegrationsStore from "./IntegrationsStore"; import MembershipsStore from "./MembershipsStore"; import NotificationsStore from "./NotificationsStore"; +import OAuthAuthenticationsStore from "./OAuthAuthenticationsStore"; +import OAuthClientsStore from "./OAuthClientsStore"; import PinsStore from "./PinsStore"; import PoliciesStore from "./PoliciesStore"; import RevisionsStore from "./RevisionsStore"; @@ -49,6 +51,8 @@ export default class RootStore { integrations: IntegrationsStore; memberships: MembershipsStore; notifications: NotificationsStore; + oauthAuthentications: OAuthAuthenticationsStore; + oauthClients: OAuthClientsStore; presence: DocumentPresenceStore; pins: PinsStore; policies: PoliciesStore; @@ -80,6 +84,8 @@ export default class RootStore { this.registerStore(IntegrationsStore); this.registerStore(MembershipsStore); this.registerStore(NotificationsStore); + this.registerStore(OAuthAuthenticationsStore, "oauthAuthentications"); + this.registerStore(OAuthClientsStore, "oauthClients"); this.registerStore(PinsStore); this.registerStore(PoliciesStore); this.registerStore(RevisionsStore); @@ -110,8 +116,9 @@ export default class RootStore { */ public getStoreForModelName<K extends keyof RootStore>(modelName: string) { const storeName = this.getStoreNameForModelName(modelName); + invariant(storeName, `No store found for model name "${modelName}"`); + const store = this[storeName]; - invariant(store, `No store found for model name "${modelName}"`); return store as RootStore[K]; } @@ -139,10 +146,24 @@ export default class RootStore { // @ts-expect-error TS thinks we are instantiating an abstract class. const store = new StoreClass(this); const storeName = name ?? this.getStoreNameForModelName(store.modelName); + invariant(storeName, `No store found for model name "${store.modelName}"`); + this[storeName] = store; } private getStoreNameForModelName(modelName: string) { - return pluralize(lowerFirst(modelName)) as keyof RootStore; + for (const key of Object.keys(this)) { + const store = this[key as keyof RootStore]; + if (store && "modelName" in store && store.modelName === modelName) { + return key as keyof RootStore; + } + } + + const storeName = pluralize(lowerFirst(modelName)) as keyof RootStore; + if (storeName) { + return storeName; + } + + return undefined; } } diff --git a/app/utils/routeHelpers.ts b/app/utils/routeHelpers.ts index 7e915194d2..c4f8911996 100644 --- a/app/utils/routeHelpers.ts +++ b/app/utils/routeHelpers.ts @@ -27,8 +27,8 @@ export function trashPath(): string { return "/trash"; } -export function settingsPath(section?: string): string { - return "/settings" + (section ? `/${section}` : ""); +export function settingsPath(...args: string[]): string { + return "/settings" + (args.length > 0 ? `/${args.join("/")}` : ""); } export function commentPath(document: Document, comment: Comment): string { diff --git a/package.json b/package.json index 55385e8b4f..65e3e11bb7 100644 --- a/package.json +++ b/package.json @@ -80,6 +80,7 @@ "@joplin/turndown-plugin-gfm": "^1.0.49", "@juggle/resize-observer": "^3.4.0", "@linear/sdk": "^39.0.0", + "@node-oauth/oauth2-server": "^5.2.0", "@notionhq/client": "^2.3.0", "@octokit/auth-app": "^6.1.3", "@outlinewiki/koa-passport": "^4.2.1", diff --git a/plugins/webhooks/server/api/webhookSubscriptions.ts b/plugins/webhooks/server/api/webhookSubscriptions.ts index 00f3da7aaf..7be68a0fa5 100644 --- a/plugins/webhooks/server/api/webhookSubscriptions.ts +++ b/plugins/webhooks/server/api/webhookSubscriptions.ts @@ -8,7 +8,7 @@ import validate from "@server/middlewares/validate"; import { WebhookSubscription } from "@server/models"; import { authorize } from "@server/policies"; import pagination from "@server/routes/api/middlewares/pagination"; -import { APIContext } from "@server/types"; +import { APIContext, AuthenticationType } from "@server/types"; import presentWebhookSubscription from "../presenters/webhookSubscription"; import * as T from "./schema"; @@ -41,7 +41,10 @@ router.post( router.post( "webhookSubscriptions.create", - auth({ role: UserRole.Admin }), + auth({ + role: UserRole.Admin, + type: [AuthenticationType.API, AuthenticationType.APP], + }), validate(T.WebhookSubscriptionsCreateSchema), transaction(), async (ctx: APIContext<T.WebhookSubscriptionsCreateReq>) => { @@ -68,7 +71,10 @@ router.post( router.post( "webhookSubscriptions.delete", - auth({ role: UserRole.Admin }), + auth({ + role: UserRole.Admin, + type: [AuthenticationType.API, AuthenticationType.APP], + }), validate(T.WebhookSubscriptionsDeleteSchema), transaction(), async (ctx: APIContext<T.WebhookSubscriptionsDeleteReq>) => { @@ -94,7 +100,10 @@ router.post( router.post( "webhookSubscriptions.update", - auth({ role: UserRole.Admin }), + auth({ + role: UserRole.Admin, + type: [AuthenticationType.API, AuthenticationType.APP], + }), validate(T.WebhookSubscriptionsUpdateSchema), transaction(), async (ctx: APIContext<T.WebhookSubscriptionsUpdateReq>) => { diff --git a/plugins/webhooks/server/tasks/DeliverWebhookTask.ts b/plugins/webhooks/server/tasks/DeliverWebhookTask.ts index a23eca19a1..418ddab1e2 100644 --- a/plugins/webhooks/server/tasks/DeliverWebhookTask.ts +++ b/plugins/webhooks/server/tasks/DeliverWebhookTask.ts @@ -237,6 +237,11 @@ export default class DeliverWebhookTask extends BaseTask<Props> { case "imports.delete": // Ignored return; + case "oauthClients.create": + case "oauthClients.update": + case "oauthClients.delete": + // Ignored + return; default: assertUnreachable(event); } diff --git a/server/env.ts b/server/env.ts index 34f926029f..9a4a0da1d3 100644 --- a/server/env.ts +++ b/server/env.ts @@ -15,6 +15,7 @@ import { } from "class-validator"; import uniq from "lodash/uniq"; import { languages } from "@shared/i18n"; +import { Day, Hour } from "@shared/utils/time"; import { CannotUseWith, CannotUseWithout } from "@server/utils/validators"; import Deprecated from "./models/decorators/Deprecated"; import { getArg } from "./utils/args"; @@ -609,6 +610,31 @@ export class Environment { public MAXIMUM_EXPORT_SIZE = this.toOptionalNumber(environment.MAXIMUM_EXPORT_SIZE) ?? os.totalmem(); + /** + * The number of seconds access tokens issue by the OAuth provider are valid. + */ + @IsNumber() + public OAUTH_PROVIDER_ACCESS_TOKEN_LIFETIME = + this.toOptionalNumber(environment.OAUTH_PROVIDER_ACCESS_TOKEN_LIFETIME) ?? + Hour.seconds; + + /** + * The number of seconds refresh tokens issue by the OAuth provider are valid. + */ + @IsNumber() + public OAUTH_PROVIDER_REFRESH_TOKEN_LIFETIME = + this.toOptionalNumber(environment.OAUTH_PROVIDER_REFRESH_TOKEN_LIFETIME) ?? + 30 * Day.seconds; + + /** + * The number of seconds authorization codes issue by the OAuth provider are valid. + */ + @IsNumber() + public OAUTH_PROVIDER_AUTHORIZATION_CODE_LIFETIME = + this.toOptionalNumber( + environment.OAUTH_PROVIDER_AUTHORIZATION_CODE_LIFETIME + ) ?? 300; + /** * Enable unsafe-inline in script-src CSP directive */ diff --git a/server/middlewares/authentication.test.ts b/server/middlewares/authentication.test.ts index 24c187db55..e5cd020c33 100644 --- a/server/middlewares/authentication.test.ts +++ b/server/middlewares/authentication.test.ts @@ -1,16 +1,19 @@ import { DefaultState } from "koa"; import randomstring from "randomstring"; +import { Scope } from "@shared/types"; import { buildUser, buildTeam, buildAdmin, buildApiKey, + buildOAuthAuthentication, } from "@server/test/factories"; +import { AuthenticationType } from "@server/types"; import auth from "./authentication"; describe("Authentication middleware", () => { - describe("with JWT", () => { - it("should authenticate with correct token", async () => { + describe("with session JWT", () => { + it("should authenticate with correct session token", async () => { const state = {} as DefaultState; const user = await buildUser(); const authMiddleware = auth(); @@ -28,7 +31,7 @@ describe("Authentication middleware", () => { expect(state.auth.user.id).toEqual(user.id); }); - it("should return error with invalid token", async () => { + it("should return error with invalid session token", async () => { const state = {} as DefaultState; const user = await buildUser(); const authMiddleware = auth(); @@ -49,7 +52,32 @@ describe("Authentication middleware", () => { expect(e.message).toBe("Invalid token"); } }); + + it("should return error if AuthenticationType mismatches", async () => { + const state = {} as DefaultState; + const user = await buildUser(); + const authMiddleware = auth({ + type: AuthenticationType.API, + }); + + try { + await authMiddleware( + { + // @ts-expect-error mock request + request: { + get: jest.fn(() => `Bearer ${user.getJwtToken()}`), + }, + state, + cache: {}, + }, + jest.fn() + ); + } catch (e) { + expect(e.message).toBe("Invalid authentication type"); + } + }); }); + describe("with API key", () => { it("should authenticate user with valid API key", async () => { const state = {} as DefaultState; @@ -91,6 +119,90 @@ describe("Authentication middleware", () => { }); }); + describe("with OAuth access token", () => { + it("should authenticate user with valid OAuth access token", async () => { + const state = {} as DefaultState; + const user = await buildUser(); + const authMiddleware = auth(); + const authentication = await buildOAuthAuthentication({ + user, + scope: [Scope.Read], + }); + + await authMiddleware( + { + // @ts-expect-error mock request + request: { + url: "/api/users.info", + get: jest.fn(() => `Bearer ${authentication.accessToken}`), + }, + state, + cache: {}, + }, + jest.fn() + ); + expect(state.auth.user.id).toEqual(user.id); + }); + + it("should return error with invalid scope", async () => { + const state = {} as DefaultState; + const user = await buildUser(); + const authMiddleware = auth(); + const authentication = await buildOAuthAuthentication({ + user, + scope: [Scope.Read], + }); + + try { + await authMiddleware( + { + // @ts-expect-error mock request + request: { + url: "/api/documents.create", + get: jest.fn(() => `Bearer ${authentication.accessToken}`), + }, + state, + cache: {}, + }, + jest.fn() + ); + } catch (e) { + expect(e.message).toContain("does not have access to this resource"); + } + }); + + it("should return error with OAuth access token in body", async () => { + const state = {} as DefaultState; + const user = await buildUser(); + const authMiddleware = auth(); + const authentication = await buildOAuthAuthentication({ + user, + scope: [Scope.Read], + }); + try { + await authMiddleware( + { + request: { + url: "/api/users.info", + // @ts-expect-error mock request + get: jest.fn(() => null), + body: { + token: authentication.accessToken, + }, + }, + state, + cache: {}, + }, + jest.fn() + ); + } catch (e) { + expect(e.message).toContain( + "must be passed in the Authorization header" + ); + } + }); + }); + it("should return error message if no auth token is available", async () => { const state = {} as DefaultState; const authMiddleware = auth(); diff --git a/server/middlewares/authentication.ts b/server/middlewares/authentication.ts index bc3fa6c3bc..b8a8588b33 100644 --- a/server/middlewares/authentication.ts +++ b/server/middlewares/authentication.ts @@ -7,7 +7,7 @@ import tracer, { addTags, getRootSpanFromRequestContext, } from "@server/logging/tracer"; -import { User, Team, ApiKey } from "@server/models"; +import { User, Team, ApiKey, OAuthAuthentication } from "@server/models"; import { AppContext, AuthenticationType } from "@server/types"; import { getUserForJWT } from "@server/utils/jwt"; import { @@ -20,7 +20,7 @@ type AuthenticationOptions = { /** Role requuired to access the route. */ role?: UserRole; /** Type of authentication required to access the route. */ - type?: AuthenticationType; + type?: AuthenticationType | AuthenticationType[]; /** Authentication is parsed, but optional. */ optional?: boolean; }; @@ -65,7 +65,50 @@ export default function auth(options: AuthenticationOptions = {}) { let user: User | null; let type: AuthenticationType; - if (ApiKey.match(String(token))) { + if (OAuthAuthentication.match(String(token))) { + if (!authorizationHeader) { + throw AuthenticationError( + "OAuth access token must be passed in the Authorization header" + ); + } + + type = AuthenticationType.OAUTH; + + let authentication; + try { + authentication = await OAuthAuthentication.findByAccessToken(token, { + rejectOnEmpty: true, + }); + } catch (err) { + throw AuthenticationError("Invalid access token"); + } + if (!authentication) { + throw AuthenticationError("Invalid access token"); + } + if (authentication.accessTokenExpiresAt < new Date()) { + throw AuthenticationError("Access token is expired"); + } + if (!authentication.canAccess(ctx.request.url)) { + throw AuthenticationError( + "Access token does not have access to this resource" + ); + } + + user = await User.findByPk(authentication.userId, { + include: [ + { + model: Team, + as: "team", + required: true, + }, + ], + }); + if (!user) { + throw AuthenticationError("Invalid access token"); + } + + await authentication.updateActiveAt(); + } else if (ApiKey.match(String(token))) { type = AuthenticationType.API; let apiKey; @@ -125,7 +168,12 @@ export default function auth(options: AuthenticationOptions = {}) { throw AuthorizationError(`${capitalize(options.role)} role required`); } - if (options.type && type !== options.type) { + if ( + options.type && + (Array.isArray(options.type) + ? !options.type.includes(type) + : type !== options.type) + ) { throw AuthorizationError(`Invalid authentication type`); } diff --git a/server/routes/api/middlewares/apiTracer.ts b/server/middlewares/requestTracer.ts similarity index 81% rename from server/routes/api/middlewares/apiTracer.ts rename to server/middlewares/requestTracer.ts index 8d41dca22c..437437064a 100644 --- a/server/routes/api/middlewares/apiTracer.ts +++ b/server/middlewares/requestTracer.ts @@ -1,8 +1,8 @@ import { Context, Next } from "koa"; import { addTags, getRootSpanFromRequestContext } from "@server/logging/tracer"; -export default function apiTracer() { - return async function apiTracerMiddleware(ctx: Context, next: Next) { +export default function requestTracer() { + return async function requestTracerMiddleware(ctx: Context, next: Next) { const params = ctx.request.body ?? ctx.request.query; for (const key in params) { diff --git a/server/migrations/20250331231413-add-oauth-server-models.js b/server/migrations/20250331231413-add-oauth-server-models.js new file mode 100644 index 0000000000..f8af70ed96 --- /dev/null +++ b/server/migrations/20250331231413-add-oauth-server-models.js @@ -0,0 +1,212 @@ +"use strict"; + +/** @type {import("sequelize-cli").Migration} */ +module.exports = { + async up(queryInterface, Sequelize) { + await queryInterface.sequelize.transaction(async (transaction) => { + await queryInterface.createTable("oauth_clients", { + id: { + type: Sequelize.UUID, + primaryKey: true, + allowNull: false + }, + name: { + type: Sequelize.STRING, + allowNull: false + }, + description: { + type: Sequelize.STRING, + allowNull: true + }, + developerName: { + type: Sequelize.STRING, + allowNull: true + }, + developerUrl: { + type: Sequelize.STRING, + allowNull: true + }, + avatarUrl: { + type: Sequelize.STRING, + allowNull: true + }, + clientId: { + type: Sequelize.STRING, + allowNull: false, + unique: true, + }, + clientSecret: { + type: Sequelize.BLOB, + allowNull: false + }, + published: { + type: Sequelize.BOOLEAN, + allowNull: false, + defaultValue: false + }, + teamId: { + type: Sequelize.UUID, + references: { + model: "teams", + }, + allowNull: false, + onDelete: "cascade" + }, + createdById: { + type: Sequelize.UUID, + references: { + model: "users", + }, + allowNull: false + }, + redirectUris: { + type: Sequelize.ARRAY(Sequelize.STRING), + allowNull: false, + defaultValue: [] + }, + createdAt: { + type: Sequelize.DATE, + allowNull: false + }, + updatedAt: { + type: Sequelize.DATE, + allowNull: false + }, + deletedAt: { + type: Sequelize.DATE, + allowNull: true + } + }, { + transaction + }); + + await queryInterface.createTable("oauth_authorization_codes", { + id: { + type: Sequelize.UUID, + primaryKey: true, + allowNull: false + }, + authorizationCodeHash: { + type: Sequelize.STRING, + allowNull: false + }, + codeChallenge: { + type: Sequelize.STRING, + allowNull: true + }, + codeChallengeMethod: { + type: Sequelize.STRING, + allowNull: true + }, + scope: { + type: Sequelize.ARRAY(Sequelize.STRING), + allowNull: false + }, + oauthClientId: { + type: Sequelize.UUID, + references: { + model: "oauth_clients", + }, + onDelete: "cascade", + allowNull: false + }, + userId: { + type: Sequelize.UUID, + references: { + model: "users", + }, + onDelete: "cascade", + allowNull: false + }, + redirectUri: { + type: Sequelize.STRING, + allowNull: false + }, + expiresAt: { + type: Sequelize.DATE, + allowNull: false + }, + createdAt: { + type: Sequelize.DATE, + allowNull: false + } + }, { + transaction + }); + + await queryInterface.createTable("oauth_authentications", { + id: { + type: Sequelize.UUID, + primaryKey: true, + allowNull: false + }, + accessTokenHash: { + type: Sequelize.STRING, + allowNull: false, + unique: true + }, + accessTokenExpiresAt: { + type: Sequelize.DATE, + allowNull: false + }, + refreshTokenHash: { + type: Sequelize.STRING, + allowNull: false, + unique: true + }, + refreshTokenExpiresAt: { + type: Sequelize.DATE, + allowNull: false + }, + lastActiveAt: { + type: Sequelize.DATE, + allowNull: true + }, + scope: { + type: Sequelize.ARRAY(Sequelize.STRING), + allowNull: false + }, + oauthClientId: { + type: Sequelize.UUID, + references: { + model: "oauth_clients", + }, + onDelete: "cascade", + allowNull: false + }, + userId: { + type: Sequelize.UUID, + references: { + model: "users", + }, + onDelete: "cascade", + allowNull: false + }, + createdAt: { + type: Sequelize.DATE, + allowNull: false + }, + updatedAt: { + type: Sequelize.DATE, + allowNull: false + }, + deletedAt: { + type: Sequelize.DATE, + allowNull: true + } + }, { + transaction + }); + + await queryInterface.addIndex("oauth_clients", ["teamId"], { transaction }); + }); + }, + + async down(queryInterface, Sequelize) { + await queryInterface.sequelize.transaction(async (transaction) => { + await queryInterface.dropTable("oauth_authentications", { transaction }); + await queryInterface.dropTable("oauth_authorization_codes", { transaction }); + await queryInterface.dropTable("oauth_clients", { transaction }); + }); + } +}; diff --git a/server/models/ApiKey.ts b/server/models/ApiKey.ts index f52079087f..2f0980a708 100644 --- a/server/models/ApiKey.ts +++ b/server/models/ApiKey.ts @@ -1,4 +1,3 @@ -import crypto from "crypto"; import { Matches } from "class-validator"; import { subMinutes } from "date-fns"; import randomstring from "randomstring"; @@ -16,10 +15,12 @@ import { BeforeSave, } from "sequelize-typescript"; import { ApiKeyValidation } from "@shared/validations"; +import { hash } from "@server/utils/crypto"; import User from "./User"; import ParanoidModel from "./base/ParanoidModel"; import { SkipChangeset } from "./decorators/Changeset"; import Fix from "./decorators/Fix"; +import AuthenticationHelper from "./helpers/AuthenticationHelper"; import Length from "./validators/Length"; @Table({ tableName: "apiKeys", modelName: "apiKey" }) @@ -41,7 +42,7 @@ class ApiKey extends ParanoidModel< @Column name: string; - /** A space-separated list of scopes that this API key has access to */ + /** A list of scopes that this API key has access to */ @Matches(/[\/\.\w\s]*/, { each: true, }) @@ -96,7 +97,7 @@ class ApiKey extends ParanoidModel< if (!model.hash) { const secret = `${ApiKey.prefix}${randomstring.generate(38)}`; model.value = model.secret || secret; - model.hash = this.hash(model.value); + model.hash = hash(model.value); } } @@ -109,18 +110,8 @@ class ApiKey extends ParanoidModel< } /** - * Generates a hashed API key for the given input key. - * - * @param key The input string to hash - * @returns The hashed API key - */ - public static hash(key: string) { - return crypto.createHash("sha256").update(key).digest("hex"); - } - - /** - * Validates that the input touch could be an API key, this does not check - * that the key exists in the database. + * Validates that the input text _could_ be an API key, this does not check + * that the key actually exists in the database. * * @param text The text to validate * @returns True if likely an API key @@ -140,7 +131,7 @@ class ApiKey extends ParanoidModel< public static findByToken(input: string) { return this.findOne({ where: { - [Op.or]: [{ secret: input }, { hash: this.hash(input) }], + [Op.or]: [{ secret: input }, { hash: hash(input) }], }, }); } @@ -174,22 +165,7 @@ class ApiKey extends ParanoidModel< return true; } - // strip any query string from the path - path = path.split("?")[0]; - - const resource = path.split("/").pop() ?? ""; - const [namespace, method] = resource.split("."); - - return this.scope.some((scope) => { - const [scopeNamespace, scopeMethod] = scope - .replace("/api/", "") - .split("."); - return ( - scope.startsWith("/api/") && - (namespace === scopeNamespace || scopeNamespace === "*") && - (method === scopeMethod || scopeMethod === "*") - ); - }); + return AuthenticationHelper.canAccess(path, this.scope); }; } diff --git a/server/models/helpers/AuthenticationHelper.test.ts b/server/models/helpers/AuthenticationHelper.test.ts new file mode 100644 index 0000000000..b700eef3b7 --- /dev/null +++ b/server/models/helpers/AuthenticationHelper.test.ts @@ -0,0 +1,126 @@ +import AuthenticationHelper from "./AuthenticationHelper"; + +describe("AuthenticationHelper", () => { + const canAccess = AuthenticationHelper.canAccess; + + describe("canAccess", () => { + describe("api scopes", () => { + it("should account for query string", async () => { + const scopes = ["/api/documents.info"]; + + expect(canAccess("/api/documents.info?foo=bar", scopes)).toBe(true); + }); + + it("should return false if no matching scope", async () => { + const scopes = ["/api/documents.info"]; + + expect(canAccess("/api/documents.info", scopes)).toBe(true); + expect(canAccess("/api/collections.create", scopes)).toBe(false); + expect(canAccess("/api/apiKeys.list", scopes)).toBe(false); + }); + + it("should allow wildcard methods", async () => { + const scopes = ["/api/documents.*"]; + + expect(canAccess("/api/documents.info", scopes)).toBe(true); + expect(canAccess("/api/documents.create", scopes)).toBe(true); + expect(canAccess("/api/collections.create", scopes)).toBe(false); + }); + + it("should allow wildcard namespaces", async () => { + const scopes = ["/api/*.info"]; + + expect(canAccess("/api/documents.info", scopes)).toBe(true); + expect(canAccess("/api/documents.create", scopes)).toBe(false); + expect(canAccess("/api/collections.create", scopes)).toBe(false); + }); + + it("should allow wildcard namespaces", async () => { + const scopes = ["/api/*.info"]; + + expect(canAccess("/api/documents.info", scopes)).toBe(true); + expect(canAccess("/api/documents.create", scopes)).toBe(false); + }); + }); + + describe("namespaced access scopes", () => { + it("read", async () => { + const scopes = ["documents:read"]; + + expect(canAccess("/api/documents.info?foo=bar", scopes)).toBe(true); + expect(canAccess("/api/documents.info", scopes)).toBe(true); + expect(canAccess("/api/documents.list", scopes)).toBe(true); + expect(canAccess("/api/documents.create", scopes)).toBe(false); + expect(canAccess("/api/documents.update", scopes)).toBe(false); + expect(canAccess("/api/users.info", scopes)).toBe(false); + expect(canAccess("/api/users.create", scopes)).toBe(false); + }); + + it("write", async () => { + const scopes = ["documents:write"]; + + expect(canAccess("/api/documents.info?foo=bar", scopes)).toBe(true); + expect(canAccess("/api/documents.info", scopes)).toBe(true); + expect(canAccess("/api/documents.list", scopes)).toBe(true); + expect(canAccess("/api/documents.create", scopes)).toBe(true); + expect(canAccess("/api/documents.update", scopes)).toBe(true); + expect(canAccess("/api/users.info", scopes)).toBe(false); + expect(canAccess("/api/users.create", scopes)).toBe(false); + }); + + it("create", async () => { + const scopes = ["documents:create"]; + + expect(canAccess("/api/documents.create", scopes)).toBe(true); + expect(canAccess("/api/documents.info?foo=bar", scopes)).toBe(false); + expect(canAccess("/api/documents.info", scopes)).toBe(false); + expect(canAccess("/api/documents.list", scopes)).toBe(false); + expect(canAccess("/api/documents.update", scopes)).toBe(false); + expect(canAccess("/api/users.info", scopes)).toBe(false); + expect(canAccess("/api/users.create", scopes)).toBe(false); + }); + }); + + describe("global access scopes", () => { + it("read", async () => { + const scopes = ["read"]; + + expect(canAccess("/api/documents.info?foo=bar", scopes)).toBe(true); + expect(canAccess("/api/documents.info", scopes)).toBe(true); + expect(canAccess("/api/documents.list", scopes)).toBe(true); + expect(canAccess("/api/users.info", scopes)).toBe(true); + expect(canAccess("/api/groups.info", scopes)).toBe(true); + expect(canAccess("/api/collections.list", scopes)).toBe(true); + expect(canAccess("/api/documents.create", scopes)).toBe(false); + expect(canAccess("/api/documents.update", scopes)).toBe(false); + expect(canAccess("/api/users.create", scopes)).toBe(false); + }); + + it("write", async () => { + const scopes = ["write"]; + + expect(canAccess("/api/documents.info?foo=bar", scopes)).toBe(true); + expect(canAccess("/api/documents.info", scopes)).toBe(true); + expect(canAccess("/api/documents.list", scopes)).toBe(true); + expect(canAccess("/api/users.info", scopes)).toBe(true); + expect(canAccess("/api/groups.info", scopes)).toBe(true); + expect(canAccess("/api/documents.create", scopes)).toBe(true); + expect(canAccess("/api/documents.update", scopes)).toBe(true); + expect(canAccess("/api/users.info", scopes)).toBe(true); + expect(canAccess("/api/users.create", scopes)).toBe(true); + }); + + it("create", async () => { + const scopes = ["create"]; + + expect(canAccess("/api/documents.create", scopes)).toBe(true); + expect(canAccess("/api/users.create", scopes)).toBe(true); + expect(canAccess("/api/documents.info?foo=bar", scopes)).toBe(false); + expect(canAccess("/api/documents.info", scopes)).toBe(false); + expect(canAccess("/api/documents.list", scopes)).toBe(false); + expect(canAccess("/api/documents.update", scopes)).toBe(false); + expect(canAccess("/api/users.info", scopes)).toBe(false); + }); + }); + }); +}); diff --git a/server/models/helpers/AuthenticationHelper.ts b/server/models/helpers/AuthenticationHelper.ts index 6e85bbd80a..3a4234ea1f 100644 --- a/server/models/helpers/AuthenticationHelper.ts +++ b/server/models/helpers/AuthenticationHelper.ts @@ -1,10 +1,27 @@ /* eslint-disable @typescript-eslint/no-var-requires */ import find from "lodash/find"; +import { Scope } from "@shared/types"; import env from "@server/env"; import Team from "@server/models/Team"; import { Hook, PluginManager } from "@server/utils/PluginManager"; export default class AuthenticationHelper { + /** + * The mapping of method names to their scopes, anything not listed here + * defaults to `Scope.Write`. + * + * - `documents.create` -> `Scope.Create` + * - `documents.list` -> `Scope.Read` + * - `documents.info` -> `Scope.Read` + */ + private static methodToScope = { + create: Scope.Create, + list: Scope.Read, + info: Scope.Read, + search: Scope.Read, + documents: Scope.Read, + }; + /** * Returns the enabled authentication provider configurations for the current * installation. @@ -52,4 +69,45 @@ export default class AuthenticationHelper { ); }); } + + /** + * Returns whether the given path can be accessed with any of the scopes. We + * support scopes in the formats of: + * + * - `/api/namespace.method` + * - `namespace:scope` + * - `scope` + * + * @param path The path to check + * @param scopes The scopes to check + * @returns True if the path can be accessed + */ + public static canAccess = (path: string, scopes: string[]) => { + // strip any query string, this is never used as part of scope matching + path = path.split("?")[0]; + + const resource = path.split("/").pop() ?? ""; + const [namespace, method] = resource.split("."); + + return scopes.some((scope) => { + const [scopeNamespace, scopeMethod] = scope.match(/[:\.]/g) + ? scope.replace("/api/", "").split(/[:\.]/g) + : ["*", scope]; + const isRouteScope = scope.startsWith("/api/"); + + if (isRouteScope) { + return ( + (namespace === scopeNamespace || scopeNamespace === "*") && + (method === scopeMethod || scopeMethod === "*") + ); + } + + return ( + (namespace === scopeNamespace || scopeNamespace === "*") && + (scopeMethod === Scope.Write || + this.methodToScope[method as keyof typeof this.methodToScope] === + scopeMethod) + ); + }); + }; } diff --git a/server/models/index.ts b/server/models/index.ts index a7a773f2d6..486e3c8b4f 100644 --- a/server/models/index.ts +++ b/server/models/index.ts @@ -34,6 +34,12 @@ export { default as IntegrationAuthentication } from "./IntegrationAuthenticatio export { default as Notification } from "./Notification"; +export { default as OAuthAuthentication } from "./oauth/OAuthAuthentication"; + +export { default as OAuthAuthorizationCode } from "./oauth/OAuthAuthorizationCode"; + +export { default as OAuthClient } from "./oauth/OAuthClient"; + export { default as Pin } from "./Pin"; export { default as Reaction } from "./Reaction"; diff --git a/server/models/oauth/OAuthAuthentication.ts b/server/models/oauth/OAuthAuthentication.ts new file mode 100644 index 0000000000..ae8e647ad7 --- /dev/null +++ b/server/models/oauth/OAuthAuthentication.ts @@ -0,0 +1,212 @@ +import { Matches } from "class-validator"; +import { subMinutes } from "date-fns"; +import { + FindOptions, + InferAttributes, + InferCreationAttributes, + NonNullFindOptions, +} from "sequelize"; +import { + Column, + DataType, + BelongsTo, + ForeignKey, + Table, + IsDate, + Unique, +} from "sequelize-typescript"; +import env from "@server/env"; +import User from "@server/models/User"; +import ParanoidModel from "@server/models/base/ParanoidModel"; +import { SkipChangeset } from "@server/models/decorators/Changeset"; +import Fix from "@server/models/decorators/Fix"; +import AuthenticationHelper from "@server/models/helpers/AuthenticationHelper"; +import { hash } from "@server/utils/crypto"; +import OAuthClient from "./OAuthClient"; + +@Table({ + tableName: "oauth_authentications", + modelName: "oauth_authentication", +}) +@Fix +class OAuthAuthentication extends ParanoidModel< + InferAttributes<OAuthAuthentication>, + Partial<InferCreationAttributes<OAuthAuthentication>> +> { + static eventNamespace = "oauthAuthentications"; + + /** The lifetime of an access token in seconds. */ + public static accessTokenLifetime = env.OAUTH_PROVIDER_ACCESS_TOKEN_LIFETIME; + + /** The lifetime of a refresh token in seconds. */ + public static refreshTokenLifetime = + env.OAUTH_PROVIDER_REFRESH_TOKEN_LIFETIME; + + /** A recognizable prefix for access tokens. */ + public static accessTokenPrefix = "ol_at_"; + + /** A recognizable prefix for refresh tokens. */ + public static refreshTokenPrefix = "ol_rt_"; + + @Unique + @Column + @SkipChangeset + accessTokenHash: string; + + /** The cached plain text access token. Only available during creation. */ + @Column(DataType.VIRTUAL) + accessToken: string | null; + + @IsDate + @Column + accessTokenExpiresAt: Date; + + @Unique + @Column + @SkipChangeset + refreshTokenHash: string; + + /** The cached plain text refresh token. Only available during creation. */ + @Column(DataType.VIRTUAL) + refreshToken: string | null; + + @IsDate + @Column + refreshTokenExpiresAt: Date; + + /** A list of scopes that this authentication has access to */ + @Matches(/[\/\.\w\s]*/, { + each: true, + }) + @Column(DataType.ARRAY(DataType.STRING)) + scope: string[]; + + @IsDate + @Column + @SkipChangeset + lastActiveAt: Date; + + // associations + + @BelongsTo(() => OAuthClient, "oauthClientId") + oauthClient: OAuthClient; + + @ForeignKey(() => OAuthClient) + @Column(DataType.UUID) + oauthClientId: string; + + @BelongsTo(() => User, "userId") + user: User; + + @ForeignKey(() => User) + @Column(DataType.UUID) + userId: string; + + // methods + + updateActiveAt = async () => { + const fiveMinutesAgo = subMinutes(new Date(), 5); + + // ensure this is updated only every few minutes otherwise + // we'll be constantly writing to the DB as API requests happen + if (!this.lastActiveAt || this.lastActiveAt < fiveMinutesAgo) { + this.lastActiveAt = new Date(); + } + + return this.save({ silent: true }); + }; + + // instance methods + + /** Checks if the authentication has access to the given path */ + canAccess = (path: string) => { + // Special case for the revoke endpoint, which is always allowed + if (path === "/revoke") { + return true; + } + + return AuthenticationHelper.canAccess(path, this.scope); + }; + + // static methods + + /** + * Validates that the input text _could_ be an OAuth token, this does not check + * that the key actually exists in the database. + * + * @param text The text to validate + * @returns True if likely an OAuth token + */ + public static match(text: string) { + return !!text.startsWith(this.accessTokenPrefix); + } + + /** + * Validates that the input text _could_ be an OAuth refresh token, this does + * not check that the key actually exists in the database. + * + * @param text The text to validate + * @returns True if likely an OAuth refresh token + */ + public static matchRefreshToken(text: string) { + return !!text.startsWith(this.refreshTokenPrefix); + } + + /** + * Finds an OAuthAuthentication by the given access token, including the + * associated user. + * + * @param input The access token to search for + * @param options The options to pass to the find method + * @returns The OAuthAuthentication if found + */ + static findByAccessToken( + input: string, + options?: + | FindOptions<OAuthAuthentication> + | NonNullFindOptions<OAuthAuthentication> + ): Promise<OAuthAuthentication | null> { + return this.findOne({ + where: { + accessTokenHash: hash(input), + }, + include: [ + { + association: "user", + required: true, + }, + ], + ...options, + }); + } + + /** + * Finds an OAuthAuthentication by the given refresh token, including the + * associated user. + * + * @param input The refresh token to search for + * @param options The options to pass to the find method + * @returns The OAuthAuthentication if found + */ + public static findByRefreshToken( + input: string, + options?: + | FindOptions<OAuthAuthentication> + | NonNullFindOptions<OAuthAuthentication> + ) { + return this.findOne({ + where: { + refreshTokenHash: hash(input), + }, + include: [ + { + association: "user", + required: true, + }, + ], + ...options, + }); + } +} + +export default OAuthAuthentication; diff --git a/server/models/oauth/OAuthAuthorizationCode.ts b/server/models/oauth/OAuthAuthorizationCode.ts new file mode 100644 index 0000000000..d6c742759a --- /dev/null +++ b/server/models/oauth/OAuthAuthorizationCode.ts @@ -0,0 +1,104 @@ +import { Matches } from "class-validator"; +import { InferAttributes, InferCreationAttributes } from "sequelize"; +import { + Column, + DataType, + BelongsTo, + ForeignKey, + Table, + Length, +} from "sequelize-typescript"; +import { OAuthClientValidation } from "@shared/validations"; +import env from "@server/env"; +import User from "@server/models/User"; +import IdModel from "@server/models/base/IdModel"; +import { SkipChangeset } from "@server/models/decorators/Changeset"; +import Fix from "@server/models/decorators/Fix"; +import { hash } from "@server/utils/crypto"; +import OAuthClient from "./OAuthClient"; + +@Table({ + tableName: "oauth_authorization_codes", + modelName: "oauth_authorization_code", + updatedAt: false, +}) +@Fix +class OAuthAuthorizationCode extends IdModel< + InferAttributes<OAuthAuthorizationCode>, + Partial<InferCreationAttributes<OAuthAuthorizationCode>> +> { + static eventNamespace = "oauthAuthorizationCodes"; + + /** The lifetime of an authorization code in seconds. */ + public static authorizationCodeLifetime = + env.OAUTH_PROVIDER_AUTHORIZATION_CODE_LIFETIME; + + /** A recognizable prefix for authorization codes. */ + public static authorizationCodePrefix = "ol_ac_"; + + @Column + @SkipChangeset + authorizationCodeHash: string; + + @Column + @SkipChangeset + codeChallenge?: string; + + @Column + @SkipChangeset + codeChallengeMethod?: string; + + /** A list of scopes that this authorization code has access to */ + @Matches(/[\/\.\w\s]*/, { + each: true, + }) + @Column(DataType.ARRAY(DataType.STRING)) + scope: string[]; + + @Length({ max: OAuthClientValidation.maxRedirectUriLength }) + @Column + redirectUri: string; + + @Column(DataType.DATE) + expiresAt: Date; + + // associations + + @BelongsTo(() => OAuthClient, "oauthClientId") + oauthClient: OAuthClient; + + @ForeignKey(() => OAuthClient) + @Column(DataType.UUID) + oauthClientId: string; + + @BelongsTo(() => User, "userId") + user: User; + + @ForeignKey(() => User) + @Column(DataType.UUID) + userId: string; + + /** + * Finds an OAuthAuthorizationCode by the given code. + * + * @param input The code to search for + * @returns The OAuthAuthentication if found + */ + public static findByCode(input: string) { + const authorizationCodeHash = hash(input); + + return this.findOne({ + where: { + authorizationCodeHash, + }, + include: [ + { + association: "user", + required: true, + }, + ], + }); + } +} + +export default OAuthAuthorizationCode; diff --git a/server/models/oauth/OAuthClient.ts b/server/models/oauth/OAuthClient.ts new file mode 100644 index 0000000000..533ce75470 --- /dev/null +++ b/server/models/oauth/OAuthClient.ts @@ -0,0 +1,159 @@ +import { + ArrayMaxSize, + ArrayMinSize, + ArrayNotEmpty, + ArrayUnique, + IsUrl, +} from "class-validator"; +import rs from "randomstring"; +import { InferAttributes, InferCreationAttributes } from "sequelize"; +import { + Column, + DataType, + BelongsTo, + ForeignKey, + Table, + Length, + BeforeCreate, + AllowNull, +} from "sequelize-typescript"; +import { OAuthClientValidation } from "@shared/validations"; +import Team from "@server/models/Team"; +import User from "@server/models/User"; +import ParanoidModel from "@server/models/base/ParanoidModel"; +import Encrypted from "@server/models/decorators/Encrypted"; +import Fix from "@server/models/decorators/Fix"; +import IsUrlOrRelativePath from "@server/models/validators/IsUrlOrRelativePath"; +import NotContainsUrl from "@server/models/validators/NotContainsUrl"; + +@Table({ + tableName: "oauth_clients", + modelName: "oauth_client", +}) +@Fix +class OAuthClient extends ParanoidModel< + InferAttributes<OAuthClient>, + Partial<InferCreationAttributes<OAuthClient>> +> { + static eventNamespace = "oauthClients"; + + public static clientSecretPrefix = "ol_sk_"; + + @NotContainsUrl + @Length({ max: OAuthClientValidation.maxNameLength }) + @Column + name: string; + + @AllowNull + @NotContainsUrl + @Length({ max: OAuthClientValidation.maxDescriptionLength }) + @Column + description: string | null; + + @AllowNull + @NotContainsUrl + @Length({ max: OAuthClientValidation.maxDeveloperNameLength }) + @Column + developerName: string | null; + + @AllowNull + @IsUrlOrRelativePath + @Length({ max: OAuthClientValidation.maxDeveloperUrlLength }) + @Column + developerUrl: string | null; + + @AllowNull + @IsUrlOrRelativePath + @Length({ max: OAuthClientValidation.maxAvatarUrlLength }) + @Column + avatarUrl: string | null; + + @Column + clientId: string; + + @Column(DataType.BLOB) + @Encrypted + clientSecret: string; + + @Column + published: boolean; + + @ArrayNotEmpty() + @ArrayUnique() + @ArrayMinSize(1) + @ArrayMaxSize(10) + @IsUrl( + { + require_tld: false, + allow_underscores: true, + }, + { + each: true, + } + ) + @Column(DataType.ARRAY(DataType.STRING)) + redirectUris: string[]; + + // associations + + @BelongsTo(() => Team, "teamId") + team: Team; + + @ForeignKey(() => Team) + @Column(DataType.UUID) + teamId: string; + + @BelongsTo(() => User, "createdById") + createdBy: User; + + @ForeignKey(() => User) + @Column(DataType.UUID) + createdById: string; + + // instance methods + + /** + * Rotate the client secret value. Does not persist to database. + */ + public rotateClientSecret() { + this.clientSecret = OAuthClient.generateNewClientSecret(); + } + + // hooks + + @BeforeCreate + public static async generateCredentials(model: OAuthClient) { + model.clientId = OAuthClient.generateNewClientId(); + model.clientSecret = OAuthClient.generateNewClientSecret(); + } + + // static methods + + /** + * Find an OAuthClient by it's public `clientId` + * + * @param clientId The public clientId of the OAuthClient + * @returns The OAuthClient or null if not found + */ + public static async findByClientId(clientId: string) { + return this.findOne({ + where: { + clientId, + }, + }); + } + + private static generateNewClientId(): string { + return rs.generate({ + length: 20, + charset: "alphanumeric", + capitalization: "lowercase", + }); + } + + private static generateNewClientSecret(): string { + return `${OAuthClient.clientSecretPrefix}${rs.generate(32)}`; + } +} + +export default OAuthClient; diff --git a/server/policies/index.ts b/server/policies/index.ts index ebcf04f9ab..f4f0467c63 100644 --- a/server/policies/index.ts +++ b/server/policies/index.ts @@ -11,6 +11,9 @@ import "./document"; import "./fileOperation"; import "./import"; import "./integration"; +import "./notification"; +import "./oauthClient"; +import "./oauthAuthentication"; import "./pins"; import "./reaction"; import "./revision"; @@ -22,5 +25,4 @@ import "./user"; import "./team"; import "./group"; import "./webhookSubscription"; -import "./notification"; import "./userMembership"; diff --git a/server/policies/oauthAuthentication.ts b/server/policies/oauthAuthentication.ts new file mode 100644 index 0000000000..b33621b4cd --- /dev/null +++ b/server/policies/oauthAuthentication.ts @@ -0,0 +1,14 @@ +import { Team, User, OAuthAuthentication } from "@server/models"; +import { allow } from "./cancan"; +import { isTeamModel } from "./utils"; + +allow(User, "listOAuthAuthentications", Team, (actor, team) => + isTeamModel(actor, team) +); + +allow( + User, + ["read", "delete"], + OAuthAuthentication, + (actor, oauthAuthentication) => actor?.id === oauthAuthentication?.userId +); diff --git a/server/policies/oauthClient.ts b/server/policies/oauthClient.ts new file mode 100644 index 0000000000..d1341ee008 --- /dev/null +++ b/server/policies/oauthClient.ts @@ -0,0 +1,19 @@ +import { Team, User, OAuthClient } from "@server/models"; +import { allow } from "./cancan"; +import { or, isTeamModel, isTeamMutable, and, isTeamAdmin } from "./utils"; + +allow(User, "createOAuthClient", Team, (actor, team) => + and(isTeamModel(actor, team), isTeamMutable(actor), actor.isAdmin) +); + +allow(User, "listOAuthClients", Team, (actor, team) => + isTeamAdmin(actor, team) +); + +allow(User, "read", OAuthClient, (actor, oauthClient) => + or(isTeamModel(actor, oauthClient), !!oauthClient?.published) +); + +allow(User, ["update", "delete"], OAuthClient, (actor, oauthClient) => + and(isTeamModel(actor, oauthClient), isTeamMutable(actor), actor.isAdmin) +); diff --git a/server/presenters/index.ts b/server/presenters/index.ts index 563e3657e5..f3fb962ce9 100644 --- a/server/presenters/index.ts +++ b/server/presenters/index.ts @@ -13,6 +13,7 @@ import presentGroupUser from "./groupUser"; import presentImport from "./import"; import presentIntegration from "./integration"; import presentMembership from "./membership"; +import presentOAuthClient, { presentPublishedOAuthClient } from "./oauthClient"; import presentPin from "./pin"; import presentPolicies from "./policy"; import presentProviderConfig from "./providerConfig"; @@ -43,6 +44,8 @@ export { presentImport, presentIntegration, presentMembership, + presentOAuthClient, + presentPublishedOAuthClient, presentPublicTeam, presentPin, presentPolicies, diff --git a/server/presenters/oauthAuthentication.ts b/server/presenters/oauthAuthentication.ts new file mode 100644 index 0000000000..9266a6a1ad --- /dev/null +++ b/server/presenters/oauthAuthentication.ts @@ -0,0 +1,16 @@ +import { OAuthAuthentication } from "@server/models"; +import { presentPublishedOAuthClient } from "./oauthClient"; + +export default function presentOAuthAuthentication( + oauthAuthentication: OAuthAuthentication +) { + return { + id: oauthAuthentication.id, + userId: oauthAuthentication.userId, + oauthClientId: oauthAuthentication.oauthClientId, + oauthClient: presentPublishedOAuthClient(oauthAuthentication.oauthClient), + scope: oauthAuthentication.scope, + lastActiveAt: oauthAuthentication.lastActiveAt, + createdAt: oauthAuthentication.createdAt, + }; +} diff --git a/server/presenters/oauthClient.ts b/server/presenters/oauthClient.ts new file mode 100644 index 0000000000..200c8ea588 --- /dev/null +++ b/server/presenters/oauthClient.ts @@ -0,0 +1,42 @@ +import { OAuthClient } from "@server/models"; + +/** + * Presents the OAuth client to the user. + * + * @param oauthClient The OAuth client to present + */ +export default function presentOAuthClient(oauthClient: OAuthClient) { + return { + id: oauthClient.id, + name: oauthClient.name, + description: oauthClient.description, + developerName: oauthClient.developerName, + developerUrl: oauthClient.developerUrl, + avatarUrl: oauthClient.avatarUrl, + clientId: oauthClient.clientId, + clientSecret: oauthClient.clientSecret, + redirectUris: oauthClient.redirectUris, + published: oauthClient.published, + createdAt: oauthClient.createdAt, + updatedAt: oauthClient.updatedAt, + }; +} + +/** + * Important: This function is used to present the OAuth client to users + * that are NOT in the same workspace as the client. Be very careful about + * what you expose here. + * + * @param oauthClient The OAuth client to present + */ +export function presentPublishedOAuthClient(oauthClient: OAuthClient) { + return { + name: oauthClient.name, + description: oauthClient.description, + developerName: oauthClient.developerName, + developerUrl: oauthClient.developerUrl, + avatarUrl: oauthClient.avatarUrl, + clientId: oauthClient.clientId, + published: oauthClient.published, + }; +} diff --git a/server/queues/processors/OAuthClientDeletedProcessor.ts b/server/queues/processors/OAuthClientDeletedProcessor.ts new file mode 100644 index 0000000000..f1363b4225 --- /dev/null +++ b/server/queues/processors/OAuthClientDeletedProcessor.ts @@ -0,0 +1,15 @@ +import { OAuthAuthentication } from "@server/models"; +import { OAuthClientEvent, Event as TEvent } from "@server/types"; +import BaseProcessor from "./BaseProcessor"; + +export default class OAuthClientDeletedProcessor extends BaseProcessor { + static applicableEvents: TEvent["name"][] = ["oauthClients.delete"]; + + async perform(event: OAuthClientEvent) { + await OAuthAuthentication.destroy({ + where: { + oauthClientId: event.modelId, + }, + }); + } +} diff --git a/server/queues/processors/OAuthClientUnpublishedProcessor.ts b/server/queues/processors/OAuthClientUnpublishedProcessor.ts new file mode 100644 index 0000000000..7a6a2fd1fd --- /dev/null +++ b/server/queues/processors/OAuthClientUnpublishedProcessor.ts @@ -0,0 +1,36 @@ +import { Op } from "sequelize"; +import { OAuthAuthentication, OAuthClient, User } from "@server/models"; +import { OAuthClientEvent, Event as TEvent } from "@server/types"; +import BaseProcessor from "./BaseProcessor"; + +export default class OAuthClientUnpublishedProcessor extends BaseProcessor { + static applicableEvents: TEvent["name"][] = ["oauthClients.update"]; + + async perform(event: OAuthClientEvent) { + if ( + event.changes?.previous.published === true && + event.changes.attributes.published === false + ) { + const oauthClient = await OAuthClient.findByPk(event.modelId, { + rejectOnEmpty: true, + }); + const users = await User.findAll({ + attributes: ["id"], + where: { + teamId: oauthClient.teamId, + }, + }); + const userIds = users.map((user) => user.id); + + // Revoke access for all users except any that are in the same team + await OAuthAuthentication.destroy({ + where: { + oauthClientId: event.modelId, + userId: { + [Op.notIn]: userIds, + }, + }, + }); + } + } +} diff --git a/server/queues/processors/UserDeletedProcessor.ts b/server/queues/processors/UserDeletedProcessor.ts index 79bbb8b6d4..b3d5dbabe2 100644 --- a/server/queues/processors/UserDeletedProcessor.ts +++ b/server/queues/processors/UserDeletedProcessor.ts @@ -1,6 +1,7 @@ import { ApiKey, GroupUser, + OAuthAuthentication, Star, Subscription, UserAuthentication, @@ -46,6 +47,12 @@ export default class UserDeletedProcessor extends BaseProcessor { }, transaction, }); + await OAuthAuthentication.destroy({ + where: { + userId: event.userId, + }, + transaction, + }); await Star.destroy({ where: { userId: event.userId, diff --git a/server/queues/processors/UserSuspendedProcessor.ts b/server/queues/processors/UserSuspendedProcessor.ts new file mode 100644 index 0000000000..e77b396cf7 --- /dev/null +++ b/server/queues/processors/UserSuspendedProcessor.ts @@ -0,0 +1,14 @@ +import { OAuthAuthentication } from "@server/models"; +import { Event as TEvent, UserEvent } from "@server/types"; +import BaseProcessor from "./BaseProcessor"; + +export default class UserSuspendedProcessor extends BaseProcessor { + static applicableEvents: TEvent["name"][] = ["users.suspend"]; + + async perform(event: UserEvent) { + // Remove all OAuth authentications for this user. + await OAuthAuthentication.destroy({ + where: { userId: event.userId }, + }); + } +} diff --git a/server/queues/tasks/CleanupOAuthAuthorizationCodeTask.test.ts b/server/queues/tasks/CleanupOAuthAuthorizationCodeTask.test.ts new file mode 100644 index 0000000000..f9fc17ae97 --- /dev/null +++ b/server/queues/tasks/CleanupOAuthAuthorizationCodeTask.test.ts @@ -0,0 +1,37 @@ +import { subMonths } from "date-fns"; +import { OAuthAuthorizationCode } from "@server/models"; +import { buildOAuthAuthorizationCode } from "@server/test/factories"; +import CleanupOAuthAuthorizationCodeTask from "./CleanupOAuthAuthorizationCodeTask"; + +const codeExists = async (code: OAuthAuthorizationCode) => { + const found = await OAuthAuthorizationCode.findByPk(code.id); + return !!found; +}; + +describe("CleanupOAuthAuthorizationCodeTask", () => { + it("should delete authorization codes expired more than one month ago", async () => { + const brandNewCode = await buildOAuthAuthorizationCode({ + expiresAt: new Date(), + }); + const oldCode = await buildOAuthAuthorizationCode({ + expiresAt: subMonths(new Date(), 2), + }); + + const task = new CleanupOAuthAuthorizationCodeTask(); + await task.perform(); + + expect(await codeExists(brandNewCode)).toBe(true); + expect(await codeExists(oldCode)).toBe(false); + }); + + it("should not delete codes that expired less than one month ago", async () => { + const recentCode = await buildOAuthAuthorizationCode({ + expiresAt: new Date(), + }); + + const task = new CleanupOAuthAuthorizationCodeTask(); + await task.perform(); + + expect(await codeExists(recentCode)).toBe(true); + }); +}); diff --git a/server/queues/tasks/CleanupOAuthAuthorizationCodeTask.ts b/server/queues/tasks/CleanupOAuthAuthorizationCodeTask.ts new file mode 100644 index 0000000000..572c8c1ec6 --- /dev/null +++ b/server/queues/tasks/CleanupOAuthAuthorizationCodeTask.ts @@ -0,0 +1,33 @@ +import { subMonths } from "date-fns"; +import { Op } from "sequelize"; +import Logger from "@server/logging/Logger"; +import { OAuthAuthorizationCode } from "@server/models"; +import BaseTask, { TaskPriority, TaskSchedule } from "./BaseTask"; + +type Props = Record<string, never>; + +export default class CleanupOAuthAuthorizationCodeTask extends BaseTask<Props> { + static cron = TaskSchedule.Day; + + public async perform() { + Logger.info( + "task", + `Deleting OAuth authorization codes older than one month…` + ); + const count = await OAuthAuthorizationCode.destroy({ + where: { + expiresAt: { + [Op.lt]: subMonths(new Date(), 1), + }, + }, + }); + Logger.info("task", `${count} expired OAuth authorization codes deleted.`); + } + + public get options() { + return { + attempts: 1, + priority: TaskPriority.Background, + }; + } +} diff --git a/server/routes/api/apiKeys/apiKeys.ts b/server/routes/api/apiKeys/apiKeys.ts index a1ae85db68..c9a551261e 100644 --- a/server/routes/api/apiKeys/apiKeys.ts +++ b/server/routes/api/apiKeys/apiKeys.ts @@ -15,7 +15,10 @@ const router = new Router(); router.post( "apiKeys.create", - auth({ role: UserRole.Member, type: AuthenticationType.APP }), + auth({ + role: UserRole.Member, + type: AuthenticationType.APP, + }), validate(T.APIKeysCreateSchema), transaction(), async (ctx: APIContext<T.APIKeysCreateReq>) => { @@ -90,7 +93,10 @@ router.post( router.post( "apiKeys.delete", - auth({ role: UserRole.Member }), + auth({ + role: UserRole.Member, + type: AuthenticationType.APP, + }), validate(T.APIKeysDeleteSchema), transaction(), async (ctx: APIContext<T.APIKeysDeleteReq>) => { diff --git a/server/routes/api/index.ts b/server/routes/api/index.ts index de12822684..583e23267b 100644 --- a/server/routes/api/index.ts +++ b/server/routes/api/index.ts @@ -5,6 +5,7 @@ import userAgent, { UserAgentContext } from "koa-useragent"; import env from "@server/env"; import { NotFoundError } from "@server/errors"; import coalesceBody from "@server/middlewares/coaleseBody"; +import requestTracer from "@server/middlewares/requestTracer"; import { AppState, AppContext } from "@server/types"; import { Hook, PluginManager } from "@server/utils/PluginManager"; import apiKeys from "./apiKeys"; @@ -25,9 +26,10 @@ import installation from "./installation"; import integrations from "./integrations"; import apiErrorHandler from "./middlewares/apiErrorHandler"; import apiResponse from "./middlewares/apiResponse"; -import apiTracer from "./middlewares/apiTracer"; import editor from "./middlewares/editor"; import notifications from "./notifications"; +import oauthAuthentications from "./oauthAuthentications"; +import oauthClients from "./oauthClients"; import pins from "./pins"; import reactions from "./reactions"; import revisions from "./revisions"; @@ -60,7 +62,7 @@ api.use( ); api.use(coalesceBody()); api.use<BaseContext, UserAgentContext>(userAgent); -api.use(apiTracer()); +api.use(requestTracer()); api.use(apiResponse()); api.use(apiErrorHandler()); api.use(editor()); @@ -90,6 +92,8 @@ router.use("/", suggestions.routes()); router.use("/", teams.routes()); router.use("/", integrations.routes()); router.use("/", notifications.routes()); +router.use("/", oauthAuthentications.routes()); +router.use("/", oauthClients.routes()); router.use("/", attachments.routes()); router.use("/", cron.routes()); router.use("/", groups.routes()); diff --git a/server/routes/api/oauthAuthentications/__snapshots__/oauthAuthentications.test.ts.snap b/server/routes/api/oauthAuthentications/__snapshots__/oauthAuthentications.test.ts.snap new file mode 100644 index 0000000000..b18e9a4571 --- /dev/null +++ b/server/routes/api/oauthAuthentications/__snapshots__/oauthAuthentications.test.ts.snap @@ -0,0 +1,19 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`oauthAuthentications.delete should require authentication 1`] = ` +{ + "error": "authentication_required", + "message": "Authentication required", + "ok": false, + "status": 401, +} +`; + +exports[`oauthAuthentications.list should require authentication 1`] = ` +{ + "error": "authentication_required", + "message": "Authentication required", + "ok": false, + "status": 401, +} +`; diff --git a/server/routes/api/oauthAuthentications/index.ts b/server/routes/api/oauthAuthentications/index.ts new file mode 100644 index 0000000000..71e4bcfa95 --- /dev/null +++ b/server/routes/api/oauthAuthentications/index.ts @@ -0,0 +1 @@ +export { default } from "./oauthAuthentications"; diff --git a/server/routes/api/oauthAuthentications/oauthAuthentications.test.ts b/server/routes/api/oauthAuthentications/oauthAuthentications.test.ts new file mode 100644 index 0000000000..e8a6edc566 --- /dev/null +++ b/server/routes/api/oauthAuthentications/oauthAuthentications.test.ts @@ -0,0 +1,194 @@ +import { OAuthClient, OAuthAuthentication } from "@server/models"; +import { + buildOAuthAuthentication, + buildTeam, + buildUser, +} from "@server/test/factories"; +import { getTestServer } from "@server/test/support"; + +const server = getTestServer(); + +describe("oauthAuthentications.list", () => { + it("should require authentication", async () => { + const res = await server.post("/api/oauthAuthentications.list"); + const body = await res.json(); + expect(res.status).toEqual(401); + expect(body).toMatchSnapshot(); + }); + + it("should return list of oauth authentications for user", async () => { + const team = await buildTeam(); + const user = await buildUser({ teamId: team.id }); + const oauthClient = await OAuthClient.create({ + teamId: team.id, + createdById: user.id, + name: "Test Client", + redirectUris: ["https://example.com/callback"], + }); + + await buildOAuthAuthentication({ + oauthClientId: oauthClient.id, + user, + scope: ["read"], + }); + + const res = await server.post("/api/oauthAuthentications.list", { + body: { + token: user.getJwtToken(), + }, + }); + + const body = await res.json(); + expect(res.status).toEqual(200); + expect(body.data.length).toEqual(1); + expect(body.data[0].id).toBeDefined(); + expect(body.data[0].oauthClient.name).toEqual("Test Client"); + expect(body.policies).toBeDefined(); + }); + + it("should only return authentications for requesting user", async () => { + const team = await buildTeam(); + const user = await buildUser({ teamId: team.id }); + const anotherUser = await buildUser({ teamId: team.id }); + const oauthClient = await OAuthClient.create({ + teamId: team.id, + createdById: user.id, + name: "Test Client", + redirectUris: ["https://example.com/callback"], + }); + + await buildOAuthAuthentication({ + oauthClientId: oauthClient.id, + user: anotherUser, + scope: ["read"], + }); + + const res = await server.post("/api/oauthAuthentications.list", { + body: { + token: user.getJwtToken(), + }, + }); + + const body = await res.json(); + expect(res.status).toEqual(200); + expect(body.data.length).toEqual(0); + }); +}); + +describe("oauthAuthentications.delete", () => { + it("should require authentication", async () => { + const res = await server.post("/api/oauthAuthentications.delete"); + const body = await res.json(); + expect(res.status).toEqual(401); + expect(body).toMatchSnapshot(); + }); + + it("should delete all authentications for a client without scope", async () => { + const team = await buildTeam(); + const user = await buildUser({ teamId: team.id }); + const oauthClient = await OAuthClient.create({ + teamId: team.id, + createdById: user.id, + name: "Test Client", + redirectUris: ["https://example.com/callback"], + }); + + await buildOAuthAuthentication({ + oauthClientId: oauthClient.id, + user, + scope: ["read"], + }); + + const res = await server.post("/api/oauthAuthentications.delete", { + body: { + token: user.getJwtToken(), + oauthClientId: oauthClient.id, + }, + }); + + const body = await res.json(); + expect(res.status).toEqual(200); + expect(body.success).toBe(true); + + const auths = await OAuthAuthentication.findAll({ + where: { + userId: user.id, + oauthClientId: oauthClient.id, + }, + }); + expect(auths.length).toEqual(0); + }); + + it("should delete matching authentications for a client with scope", async () => { + const team = await buildTeam(); + const user = await buildUser({ teamId: team.id }); + const oauthClient = await OAuthClient.create({ + teamId: team.id, + createdById: user.id, + name: "Test Client", + redirectUris: ["https://example.com/callback"], + }); + + await buildOAuthAuthentication({ + oauthClientId: oauthClient.id, + user, + scope: ["read"], + }); + await buildOAuthAuthentication({ + oauthClientId: oauthClient.id, + user, + scope: ["write"], + }); + + const res = await server.post("/api/oauthAuthentications.delete", { + body: { + token: user.getJwtToken(), + oauthClientId: oauthClient.id, + scope: ["read"], + }, + }); + + const body = await res.json(); + expect(res.status).toEqual(200); + expect(body.success).toBe(true); + + const auths = await OAuthAuthentication.findAll({ + where: { + userId: user.id, + oauthClientId: oauthClient.id, + }, + }); + expect(auths.length).toEqual(1); + expect(auths[0].scope[0]).toEqual("write"); + }); + + it("should only delete authentications for requesting user", async () => { + const team = await buildTeam(); + const user = await buildUser({ teamId: team.id }); + const anotherUser = await buildUser({ teamId: team.id }); + const oauthClient = await OAuthClient.create({ + teamId: team.id, + createdById: user.id, + name: "Test Client", + redirectUris: ["https://example.com/callback"], + }); + + const otherAuth = await buildOAuthAuthentication({ + oauthClientId: oauthClient.id, + user: anotherUser, + scope: ["read"], + }); + + await server.post("/api/oauthAuthentications.delete", { + body: { + token: user.getJwtToken(), + oauthClientId: oauthClient.id, + scope: "read", + }, + }); + + // Verify other user's auth still exists + const auth = await OAuthAuthentication.findByPk(otherAuth.id); + expect(auth).not.toBeNull(); + }); +}); diff --git a/server/routes/api/oauthAuthentications/oauthAuthentications.ts b/server/routes/api/oauthAuthentications/oauthAuthentications.ts new file mode 100644 index 0000000000..ca7c697482 --- /dev/null +++ b/server/routes/api/oauthAuthentications/oauthAuthentications.ts @@ -0,0 +1,90 @@ +import Router from "koa-router"; +import { QueryTypes } from "sequelize"; +import auth from "@server/middlewares/authentication"; +import { rateLimiter } from "@server/middlewares/rateLimiter"; +import { transaction } from "@server/middlewares/transaction"; +import validate from "@server/middlewares/validate"; +import { OAuthAuthentication } from "@server/models"; +import { authorize } from "@server/policies"; +import { presentPolicies } from "@server/presenters"; +import presentOAuthAuthentication from "@server/presenters/oauthAuthentication"; +import { sequelize } from "@server/storage/database"; +import { APIContext } from "@server/types"; +import { RateLimiterStrategy } from "@server/utils/RateLimiter"; +import pagination from "../middlewares/pagination"; +import * as T from "./schema"; + +const router = new Router(); + +router.post( + "oauthAuthentications.list", + auth(), + pagination(), + validate(T.OAuthAuthenticationsListSchema), + async (ctx: APIContext<T.OAuthAuthenticationsListReq>) => { + const { user } = ctx.state.auth; + + const oauthAuthentications = await sequelize.query<OAuthAuthentication>( + ` + SELECT DISTINCT ON (oa."oauthClientId", oa."scope") + oa.*, + oc.id AS "oauthClient.id", + oc.name AS "oauthClient.name", + oc."avatarUrl" AS "oauthClient.avatarUrl", + oc."clientId" AS "oauthClient.clientId" + FROM oauth_authentications oa + INNER JOIN oauth_clients oc ON oc.id = oa."oauthClientId" + WHERE oa."userId" = :userId + AND oa."deletedAt" IS NULL + ORDER BY oa."oauthClientId", oa."scope", oa."lastActiveAt", oa."createdAt" DESC + LIMIT :limit OFFSET :offset + `, + { + replacements: { + userId: user.id, + limit: ctx.state.pagination.limit, + offset: ctx.state.pagination.offset, + }, + type: QueryTypes.SELECT, + nest: true, + } + ); + + ctx.body = { + pagination: { ...ctx.state.pagination }, + data: oauthAuthentications.map(presentOAuthAuthentication), + policies: presentPolicies(user, oauthAuthentications), + }; + } +); + +router.post( + "oauthAuthentications.delete", + rateLimiter(RateLimiterStrategy.TwentyFivePerMinute), + auth(), + validate(T.OAuthAuthenticationsDeleteSchema), + transaction(), + async (ctx: APIContext<T.OAuthAuthenticationsDeleteReq>) => { + const { user } = ctx.state.auth; + const { oauthClientId, scope } = ctx.input.body; + const oauthAuthentications = await OAuthAuthentication.findAll({ + where: { + userId: user.id, + oauthClientId, + ...(scope ? { scope } : {}), + }, + transaction: ctx.state.transaction, + }); + + for (const oauthAuthentication of oauthAuthentications) { + authorize(user, "delete", oauthAuthentication); + await oauthAuthentication.destroyWithCtx(ctx); + } + + ctx.body = { + success: true, + }; + } +); + +export default router; diff --git a/server/routes/api/oauthAuthentications/schema.ts b/server/routes/api/oauthAuthentications/schema.ts new file mode 100644 index 0000000000..9dce6369f9 --- /dev/null +++ b/server/routes/api/oauthAuthentications/schema.ts @@ -0,0 +1,21 @@ +import { z } from "zod"; +import { BaseSchema } from "@server/routes/api/schema"; + +export const OAuthAuthenticationsListSchema = BaseSchema.extend({ + body: z.object({}), +}); + +export type OAuthAuthenticationsListReq = z.infer< + typeof OAuthAuthenticationsListSchema +>; + +export const OAuthAuthenticationsDeleteSchema = BaseSchema.extend({ + body: z.object({ + oauthClientId: z.string(), + scope: z.array(z.string()).optional(), + }), +}); + +export type OAuthAuthenticationsDeleteReq = z.infer< + typeof OAuthAuthenticationsDeleteSchema +>; diff --git a/server/routes/api/oauthClients/__snapshots__/oauthClients.test.ts.snap b/server/routes/api/oauthClients/__snapshots__/oauthClients.test.ts.snap new file mode 100644 index 0000000000..eb84ac42ec --- /dev/null +++ b/server/routes/api/oauthClients/__snapshots__/oauthClients.test.ts.snap @@ -0,0 +1,55 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`oauthClients.create should require authentication 1`] = ` +{ + "error": "authentication_required", + "message": "Authentication required", + "ok": false, + "status": 401, +} +`; + +exports[`oauthClients.delete should require authentication 1`] = ` +{ + "error": "authentication_required", + "message": "Authentication required", + "ok": false, + "status": 401, +} +`; + +exports[`oauthClients.info should require authentication 1`] = ` +{ + "error": "authentication_required", + "message": "Authentication required", + "ok": false, + "status": 401, +} +`; + +exports[`oauthClients.list should require authentication 1`] = ` +{ + "error": "authentication_required", + "message": "Authentication required", + "ok": false, + "status": 401, +} +`; + +exports[`oauthClients.rotate_secret should require authentication 1`] = ` +{ + "error": "authentication_required", + "message": "Authentication required", + "ok": false, + "status": 401, +} +`; + +exports[`oauthclients.update should require authentication 1`] = ` +{ + "error": "authentication_required", + "message": "Authentication required", + "ok": false, + "status": 401, +} +`; diff --git a/server/routes/api/oauthClients/index.ts b/server/routes/api/oauthClients/index.ts new file mode 100644 index 0000000000..1428e5aa23 --- /dev/null +++ b/server/routes/api/oauthClients/index.ts @@ -0,0 +1 @@ +export { default } from "./oauthClients"; diff --git a/server/routes/api/oauthClients/oauthClients.test.ts b/server/routes/api/oauthClients/oauthClients.test.ts new file mode 100644 index 0000000000..e68bb48226 --- /dev/null +++ b/server/routes/api/oauthClients/oauthClients.test.ts @@ -0,0 +1,326 @@ +import { OAuthClient } from "@server/models"; +import { buildTeam, buildUser, buildAdmin } from "@server/test/factories"; +import { getTestServer } from "@server/test/support"; + +const server = getTestServer(); + +describe("oauthClients.list", () => { + it("should require authentication", async () => { + const res = await server.post("/api/oauthClients.list"); + const body = await res.json(); + expect(res.status).toEqual(401); + expect(body).toMatchSnapshot(); + }); + + it("should return all clients for admin", async () => { + const team = await buildTeam(); + const another = await buildTeam(); + const admin = await buildAdmin({ teamId: team.id }); + + await OAuthClient.create({ + teamId: another.id, + createdById: admin.id, + name: "Another Client", + redirectUris: ["https://example.com/callback"], + published: true, + }); + + await OAuthClient.create({ + teamId: team.id, + createdById: admin.id, + name: "Published Client", + redirectUris: ["https://example.com/callback"], + published: true, + }); + + await OAuthClient.create({ + teamId: team.id, + createdById: admin.id, + name: "Unpublished Client", + redirectUris: ["https://example.com/callback"], + published: false, + }); + + const res = await server.post("/api/oauthClients.list", { + body: { + token: admin.getJwtToken(), + }, + }); + + const body = await res.json(); + expect(res.status).toEqual(200); + expect(body.data.length).toEqual(2); + expect(body.data.map((c: { name: string }) => c.name).sort()).toEqual([ + "Published Client", + "Unpublished Client", + ]); + expect(body.data[0].id).toBeDefined(); + expect(body.data[0].redirectUris).toBeDefined(); + }); +}); + +describe("oauthClients.info", () => { + it("should require authentication", async () => { + const res = await server.post("/api/oauthClients.info"); + const body = await res.json(); + expect(res.status).toEqual(401); + expect(body).toMatchSnapshot(); + }); + + it("should return information about an OAuth client when authorized", async () => { + const team = await buildTeam(); + const user = await buildUser({ teamId: team.id }); + + const client = await OAuthClient.create({ + teamId: team.id, + createdById: user.id, + name: "Test Client", + redirectUris: ["https://example.com/callback"], + }); + + const res = await server.post("/api/oauthClients.info", { + body: { + token: user.getJwtToken(), + id: client.id, + }, + }); + + const body = await res.json(); + expect(res.status).toEqual(200); + expect(body.data.id).toBeDefined(); + expect(body.data.name).toEqual("Test Client"); + expect(body.data.published).toBeFalsy(); + expect(body.data.redirectUris).toEqual(["https://example.com/callback"]); + }); + + it("should return information about an OAuth client when published", async () => { + const team = await buildTeam(); + const admin = await buildAdmin({ teamId: team.id }); + const user = await buildUser(); + + const client = await OAuthClient.create({ + teamId: team.id, + createdById: admin.id, + name: "Test Client", + redirectUris: ["https://example.com/callback"], + published: true, + }); + + const res = await server.post("/api/oauthClients.info", { + body: { + token: user.getJwtToken(), + id: client.id, + }, + }); + + const body = await res.json(); + expect(res.status).toEqual(200); + expect(body.data.name).toEqual("Test Client"); + expect(body.data.published).toBeTruthy(); + expect(body.data.id).toBeUndefined(); + expect(body.data.redirectUris).toBeUndefined(); + }); + + it("should allow querying by clientId", async () => { + const team = await buildTeam(); + const admin = await buildAdmin({ teamId: team.id }); + const user = await buildUser(); + + const client = await OAuthClient.create({ + teamId: team.id, + createdById: admin.id, + name: "Test Client", + redirectUris: ["https://example.com/callback"], + published: true, + }); + + const res = await server.post("/api/oauthClients.info", { + body: { + token: user.getJwtToken(), + clientId: client.clientId, + }, + }); + + const body = await res.json(); + expect(res.status).toEqual(200); + expect(body.data.name).toEqual("Test Client"); + expect(body.data.published).toBeTruthy(); + expect(body.data.id).toBeUndefined(); + expect(body.data.redirectUris).toBeUndefined(); + }); + + it("should validate redirectUri parameter", async () => { + const team = await buildTeam(); + const admin = await buildAdmin({ teamId: team.id }); + const user = await buildUser(); + + const client = await OAuthClient.create({ + teamId: team.id, + createdById: admin.id, + name: "Test Client", + redirectUris: [ + "https://example.com/callback", + "https://another.com/callback", + ], + published: true, + }); + + // Test with valid redirectUri + const validRes = await server.post("/api/oauthClients.info", { + body: { + token: user.getJwtToken(), + clientId: client.clientId, + redirectUri: "https://example.com/callback", + }, + }); + + const validBody = await validRes.json(); + expect(validRes.status).toEqual(200); + expect(validBody.data.name).toEqual("Test Client"); + + // Test with invalid redirectUri + const invalidRes = await server.post("/api/oauthClients.info", { + body: { + token: user.getJwtToken(), + clientId: client.clientId, + redirectUri: "https://malicious.com/callback", + }, + }); + expect(invalidRes.status).toEqual(400); + }); +}); + +describe("oauthClients.create", () => { + it("should require authentication", async () => { + const res = await server.post("/api/oauthClients.create"); + const body = await res.json(); + expect(res.status).toEqual(401); + expect(body).toMatchSnapshot(); + }); + + it("should create a new OAuth client", async () => { + const team = await buildTeam(); + const admin = await buildAdmin({ teamId: team.id }); + + const res = await server.post("/api/oauthClients.create", { + body: { + token: admin.getJwtToken(), + name: "Test Client", + redirectUris: ["https://example.com/callback"], + }, + }); + + const body = await res.json(); + expect(res.status).toEqual(200); + expect(body.data.id).toBeDefined(); + expect(body.data.name).toEqual("Test Client"); + expect(body.data.redirectUris).toEqual(["https://example.com/callback"]); + }); +}); + +describe("oauthclients.update", () => { + it("should require authentication", async () => { + const res = await server.post("/api/oauthClients.update"); + const body = await res.json(); + expect(res.status).toEqual(401); + expect(body).toMatchSnapshot(); + }); + + it("should allow updating an OAuth client", async () => { + const team = await buildTeam(); + const admin = await buildAdmin({ teamId: team.id }); + + const client = await OAuthClient.create({ + teamId: team.id, + createdById: admin.id, + name: "Test Client", + redirectUris: ["https://example.com/callback"], + published: true, + }); + + const res = await server.post("/api/oauthClients.update", { + body: { + token: admin.getJwtToken(), + id: client.id, + published: false, + name: "Renamed", + }, + }); + + const body = await res.json(); + expect(res.status).toEqual(200); + expect(body.data.name).toEqual("Renamed"); + expect(body.data.published).toBeFalsy(); + }); +}); + +describe("oauthClients.rotate_secret", () => { + it("should require authentication", async () => { + const res = await server.post("/api/oauthClients.rotate_secret"); + const body = await res.json(); + expect(res.status).toEqual(401); + expect(body).toMatchSnapshot(); + }); + + it("should rotate the client secret", async () => { + const team = await buildTeam(); + const admin = await buildAdmin({ teamId: team.id }); + + const client = await OAuthClient.create({ + teamId: team.id, + createdById: admin.id, + name: "Test Client", + redirectUris: ["https://example.com/callback"], + }); + + const originalSecret = client.clientSecret; + + const res = await server.post("/api/oauthClients.rotate_secret", { + body: { + token: admin.getJwtToken(), + id: client.id, + }, + }); + + const body = await res.json(); + expect(res.status).toEqual(200); + expect(body.data.id).toBeDefined(); + expect(body.data.clientSecret).toBeDefined(); + expect(body.data.clientSecret).not.toEqual(originalSecret); + }); +}); + +describe("oauthClients.delete", () => { + it("should require authentication", async () => { + const res = await server.post("/api/oauthClients.delete"); + const body = await res.json(); + expect(res.status).toEqual(401); + expect(body).toMatchSnapshot(); + }); + + it("should delete an OAuth client", async () => { + const team = await buildTeam(); + const admin = await buildAdmin({ teamId: team.id }); + + const client = await OAuthClient.create({ + teamId: team.id, + createdById: admin.id, + name: "Test Client", + redirectUris: ["https://example.com/callback"], + }); + + const res = await server.post("/api/oauthClients.delete", { + body: { + token: admin.getJwtToken(), + id: client.id, + }, + }); + + const body = await res.json(); + expect(res.status).toEqual(200); + expect(body.success).toBe(true); + + const deletedClient = await OAuthClient.findByPk(client.id); + expect(deletedClient).toBeNull(); + }); +}); diff --git a/server/routes/api/oauthClients/oauthClients.ts b/server/routes/api/oauthClients/oauthClients.ts new file mode 100644 index 0000000000..09caa0665b --- /dev/null +++ b/server/routes/api/oauthClients/oauthClients.ts @@ -0,0 +1,181 @@ +import Router from "koa-router"; +import { UserRole } from "@shared/types"; +import { ValidationError } from "@server/errors"; +import auth from "@server/middlewares/authentication"; +import { rateLimiter } from "@server/middlewares/rateLimiter"; +import { transaction } from "@server/middlewares/transaction"; +import validate from "@server/middlewares/validate"; +import { OAuthClient } from "@server/models"; +import { authorize } from "@server/policies"; +import { + presentPolicies, + presentOAuthClient, + presentPublishedOAuthClient, +} from "@server/presenters"; +import { APIContext } from "@server/types"; +import { RateLimiterStrategy } from "@server/utils/RateLimiter"; +import pagination from "../middlewares/pagination"; +import * as T from "./schema"; + +const router = new Router(); + +router.post( + "oauthClients.list", + auth({ role: UserRole.Admin }), + pagination(), + validate(T.OAuthClientsListSchema), + async (ctx: APIContext<T.OAuthClientsListReq>) => { + const { user } = ctx.state.auth; + const where = { teamId: user.teamId }; + + const [oauthClients, total] = await Promise.all([ + OAuthClient.findAll({ + where, + order: [["createdAt", "DESC"]], + offset: ctx.state.pagination.offset, + limit: ctx.state.pagination.limit, + }), + OAuthClient.count({ where }), + ]); + + ctx.body = { + pagination: { ...ctx.state.pagination, total }, + data: oauthClients.map(presentOAuthClient), + policies: presentPolicies(user, oauthClients), + }; + } +); +router.post( + "oauthClients.info", + auth(), + validate(T.OAuthClientsInfoSchema), + async (ctx: APIContext<T.OAuthClientsInfoReq>) => { + const { id, clientId, redirectUri } = ctx.input.body; + const { user } = ctx.state.auth; + + const oauthClient = await OAuthClient.findOne({ + where: clientId ? { clientId } : { id }, + rejectOnEmpty: true, + }); + authorize(user, "read", oauthClient); + + if (redirectUri && !oauthClient.redirectUris.includes(redirectUri)) { + throw ValidationError("redirect_uri is invalid"); + } + + const isInternalApp = oauthClient.teamId === user.teamId; + + ctx.body = { + data: isInternalApp + ? presentOAuthClient(oauthClient) + : presentPublishedOAuthClient(oauthClient), + policies: isInternalApp ? presentPolicies(user, [oauthClient]) : [], + }; + } +); + +router.post( + "oauthClients.create", + rateLimiter(RateLimiterStrategy.FivePerHour), + auth({ role: UserRole.Admin }), + validate(T.OAuthClientsCreateSchema), + transaction(), + async (ctx: APIContext<T.OAuthClientsCreateReq>) => { + const input = ctx.input.body; + const { user } = ctx.state.auth; + + authorize(user, "createOAuthClient", user.team); + + const oauthClient = await OAuthClient.createWithCtx(ctx, { + ...input, + teamId: user.teamId, + createdById: user.id, + }); + + ctx.body = { + data: presentOAuthClient(oauthClient), + policies: presentPolicies(user, [oauthClient]), + }; + } +); + +router.post( + "oauthClients.update", + auth({ role: UserRole.Admin }), + validate(T.OAuthClientsUpdateSchema), + transaction(), + async (ctx: APIContext<T.OAuthClientsUpdateReq>) => { + const { id, ...input } = ctx.input.body; + const { user } = ctx.state.auth; + const { transaction } = ctx.state; + + const oauthClient = await OAuthClient.findByPk(id, { + transaction, + lock: transaction.LOCK.UPDATE, + rejectOnEmpty: true, + }); + authorize(user, "update", oauthClient); + + await oauthClient.updateWithCtx(ctx, input); + + ctx.body = { + data: presentOAuthClient(oauthClient), + policies: presentPolicies(user, [oauthClient]), + }; + } +); + +router.post( + "oauthClients.rotate_secret", + rateLimiter(RateLimiterStrategy.FivePerHour), + auth({ role: UserRole.Admin }), + validate(T.OAuthClientsRotateSecretSchema), + transaction(), + async (ctx: APIContext<T.OAuthClientsRotateSecretReq>) => { + const { id } = ctx.input.body; + const { user } = ctx.state.auth; + const { transaction } = ctx.state; + + const oauthClient = await OAuthClient.findByPk(id, { + transaction, + lock: transaction.LOCK.UPDATE, + rejectOnEmpty: true, + }); + authorize(user, "update", oauthClient); + + oauthClient.rotateClientSecret(); + await oauthClient.saveWithCtx(ctx); + + ctx.body = { + data: presentOAuthClient(oauthClient), + policies: presentPolicies(user, [oauthClient]), + }; + } +); + +router.post( + "oauthClients.delete", + auth({ role: UserRole.Admin }), + validate(T.OAuthClientsDeleteSchema), + transaction(), + async (ctx: APIContext<T.OAuthClientsDeleteReq>) => { + const { id } = ctx.input.body as { id: string }; + const { user } = ctx.state.auth; + const { transaction } = ctx.state; + + const oauthClient = await OAuthClient.findByPk(id, { + transaction, + lock: transaction.LOCK.UPDATE, + rejectOnEmpty: true, + }); + authorize(user, "delete", oauthClient); + + await oauthClient.destroyWithCtx(ctx); + + ctx.body = { + success: true, + }; + } +); + +export default router; diff --git a/server/routes/api/oauthClients/schema.ts b/server/routes/api/oauthClients/schema.ts new file mode 100644 index 0000000000..5c834e4e74 --- /dev/null +++ b/server/routes/api/oauthClients/schema.ts @@ -0,0 +1,128 @@ +import { z } from "zod"; +import { OAuthClientValidation } from "@shared/validations"; +import { BaseSchema } from "@server/routes/api/schema"; + +export const OAuthClientsInfoSchema = BaseSchema.extend({ + body: z + .object({ + /** OAuth client id */ + id: z.string().uuid().optional(), + + /** OAuth clientId */ + clientId: z.string().optional(), + + redirectUri: z.string().optional(), + }) + .refine((data) => data.id || data.clientId, { + message: "Either id or clientId is required", + }), +}); + +export type OAuthClientsInfoReq = z.infer<typeof OAuthClientsInfoSchema>; + +export const OAuthClientsCreateSchema = BaseSchema.extend({ + body: z.object({ + /** OAuth client name */ + name: z.string(), + + /** OAuth client description */ + description: z.string().nullish(), + + /** OAuth client developer name */ + developerName: z.string().nullish(), + + /** OAuth client developer url */ + developerUrl: z.string().nullish(), + + /** OAuth client avatar url */ + avatarUrl: z.string().nullish(), + + /** OAuth client redirect uri */ + redirectUris: z + .array(z.string().url()) + .min(1, { message: "At least one redirect uri is required" }) + .max(10, { message: "A maximum of 10 redirect uris are allowed" }) + .refine( + (uris) => + uris.every( + (uri) => uri.length <= OAuthClientValidation.maxRedirectUriLength + ), + { + message: `Redirect uri must be less than ${OAuthClientValidation.maxRedirectUriLength} characters`, + } + ), + + /** OAuth client published */ + published: z.boolean().default(false), + }), +}); + +export type OAuthClientsCreateReq = z.infer<typeof OAuthClientsCreateSchema>; + +export const OAuthClientsUpdateSchema = BaseSchema.extend({ + body: z.object({ + id: z.string().uuid(), + + /** OAuth client name */ + name: z.string().optional(), + + /** OAuth client description */ + description: z.string().nullish(), + + /** OAuth client developer name */ + developerName: z.string().nullish(), + + /** OAuth client developer url */ + developerUrl: z.string().nullish(), + + /** OAuth client avatar url */ + avatarUrl: z.string().nullish(), + + /** OAuth client redirect uri */ + redirectUris: z + .array(z.string().url()) + .min(1, { message: "At least one redirect uri is required" }) + .max(10, { message: "A maximum of 10 redirect uris are allowed" }) + .refine( + (uris) => + uris.every( + (uri) => uri.length <= OAuthClientValidation.maxRedirectUriLength + ), + { + message: `Redirect uri must be less than ${OAuthClientValidation.maxRedirectUriLength} characters`, + } + ) + .optional(), + + /** OAuth client published */ + published: z.boolean().optional(), + }), +}); + +export type OAuthClientsUpdateReq = z.infer<typeof OAuthClientsUpdateSchema>; + +export const OAuthClientsDeleteSchema = BaseSchema.extend({ + body: z.object({ + /** OAuth client id */ + id: z.string().uuid(), + }), +}); + +export type OAuthClientsDeleteReq = z.infer<typeof OAuthClientsDeleteSchema>; + +export const OAuthClientsRotateSecretSchema = BaseSchema.extend({ + body: z.object({ + /** OAuth client id */ + id: z.string().uuid(), + }), +}); + +export type OAuthClientsRotateSecretReq = z.infer< + typeof OAuthClientsRotateSecretSchema +>; + +export const OAuthClientsListSchema = BaseSchema.extend({ + body: z.object({}), +}); + +export type OAuthClientsListReq = z.infer<typeof OAuthClientsListSchema>; diff --git a/server/routes/oauth/index.test.ts b/server/routes/oauth/index.test.ts new file mode 100644 index 0000000000..a997226c14 --- /dev/null +++ b/server/routes/oauth/index.test.ts @@ -0,0 +1,47 @@ +import { Scope } from "@shared/types"; +import { OAuthAuthentication } from "@server/models"; +import { buildOAuthAuthentication, buildUser } from "@server/test/factories"; +import { getTestServer } from "@server/test/support"; + +const server = getTestServer(); + +describe("#oauth.revoke", () => { + it("should revoke access token", async () => { + const user = await buildUser(); + const auth = await buildOAuthAuthentication({ user, scope: [Scope.Read] }); + + const res = await server.post("/oauth/revoke", { + body: { + token: auth.accessToken, + }, + }); + expect(res.status).toEqual(200); + + const found = await OAuthAuthentication.findByPk(auth.id); + expect(found).toBeNull(); + }); + + it("should revoke refresh token", async () => { + const user = await buildUser(); + const auth = await buildOAuthAuthentication({ user, scope: [Scope.Read] }); + + const res = await server.post("/oauth/revoke", { + body: { + token: auth.refreshToken, + }, + }); + expect(res.status).toEqual(200); + + const found = await OAuthAuthentication.findByPk(auth.id); + expect(found).toBeNull(); + }); + + it("should not error with invalid token", async () => { + const res = await server.post("/oauth/revoke", { + body: { + token: "invalid-token", + }, + }); + expect(res.status).toEqual(200); + }); +}); diff --git a/server/routes/oauth/index.ts b/server/routes/oauth/index.ts new file mode 100644 index 0000000000..ed0b5f07e0 --- /dev/null +++ b/server/routes/oauth/index.ts @@ -0,0 +1,132 @@ +import OAuth2Server from "@node-oauth/oauth2-server"; +import Koa from "koa"; +import bodyParser from "koa-body"; +import Router from "koa-router"; +import { ValidationError } from "@server/errors"; +import auth from "@server/middlewares/authentication"; +import { rateLimiter } from "@server/middlewares/rateLimiter"; +import requestTracer from "@server/middlewares/requestTracer"; +import { transaction } from "@server/middlewares/transaction"; +import validate from "@server/middlewares/validate"; +import { OAuthAuthorizationCode, OAuthClient } from "@server/models"; +import OAuthAuthentication from "@server/models/oauth/OAuthAuthentication"; +import { authorize } from "@server/policies"; +import { APIContext } from "@server/types"; +import { RateLimiterStrategy } from "@server/utils/RateLimiter"; +import { OAuthInterface } from "@server/utils/oauth/OAuthInterface"; +import oauthErrorHandler from "./middlewares/oauthErrorHandler"; +import * as T from "./schema"; + +const app = new Koa(); +const router = new Router(); +const oauth = new OAuth2Server({ + model: OAuthInterface, +}); + +router.post( + "/authorize", + rateLimiter(RateLimiterStrategy.OneHundredPerHour), + auth(), + async (ctx) => { + const { user } = ctx.state.auth; + const clientId = ctx.request.body.client_id; + if (!clientId) { + throw ValidationError("Missing client_id"); + } + + const client = await OAuthClient.findByClientId(clientId); + authorize(user, "read", client); + + // Note: These objects are mutated by the OAuth2Server library + const request = new OAuth2Server.Request(ctx.request); + const response = new OAuth2Server.Response(ctx.response); + + const authorizationCode = await oauth.authorize(request, response, { + // Require state to prevent CSRF attacks + allowEmptyState: false, + authorizationCodeLifetime: + OAuthAuthorizationCode.authorizationCodeLifetime, + authenticateHandler: { + // Fetch the current user from the request, so the library knows + // which user is authorizing the client. + handle: async () => user, + }, + }); + + // In the case of a redirect, the response will be always be a redirect + // to the redirect_uri with the authorization code as a query parameter. + if (response.status === 302 && response.headers?.location) { + const location = response.headers.location; + delete response.headers.location; + ctx.set(response.headers); + ctx.redirect(location); + return; + } + + ctx.body = { code: authorizationCode }; + } +); + +router.post( + "/token", + rateLimiter(RateLimiterStrategy.OneHundredPerHour), + async (ctx) => { + // Note: These objects are mutated by the OAuth2Server library + const request = new OAuth2Server.Request(ctx.request); + const response = new OAuth2Server.Response(ctx.response); + const token = await oauth.token(request, response, { + accessTokenLifetime: OAuthAuthentication.accessTokenLifetime, + refreshTokenLifetime: OAuthAuthentication.refreshTokenLifetime, + }); + + if (response.headers) { + ctx.set(response.headers); + } + + ctx.body = { + access_token: token.accessToken, + refresh_token: token.refreshToken, + // OAuth2 spec says that the expires_in should be in seconds. + expires_in: token.accessTokenExpiresAt + ? Math.round((token.accessTokenExpiresAt.getTime() - Date.now()) / 1000) + : undefined, + token_type: "Bearer", + // OAuth2 spec says that the scope should be a space-separated list. + scope: token.scope?.join(" "), + }; + } +); + +router.post( + "/revoke", + rateLimiter(RateLimiterStrategy.OneHundredPerHour), + validate(T.TokenRevokeSchema), + transaction(), + async (ctx: APIContext<T.TokenRevokeReq>) => { + const { token } = ctx.input.body; + + if (OAuthAuthentication.match(token)) { + const accessToken = await OAuthAuthentication.findByAccessToken(token); + await accessToken?.destroyWithCtx(ctx); + } + + if (OAuthAuthentication.matchRefreshToken(token)) { + const refreshToken = await OAuthAuthentication.findByRefreshToken(token); + await refreshToken?.destroyWithCtx(ctx); + } + + // https://datatracker.ietf.org/doc/html/rfc7009#section-2.2 + // Note: invalid tokens do not cause an error response since the client + // cannot handle such an error in a reasonable way + ctx.body = { + success: true, + }; + } +); + +app.use(requestTracer()); +app.use(oauthErrorHandler()); +app.use(bodyParser()); +app.use(router.routes()); + +export default app; diff --git a/server/routes/oauth/middlewares/oauthErrorHandler.ts b/server/routes/oauth/middlewares/oauthErrorHandler.ts new file mode 100644 index 0000000000..820afe08a2 --- /dev/null +++ b/server/routes/oauth/middlewares/oauthErrorHandler.ts @@ -0,0 +1,41 @@ +import { Context, Next } from "koa"; +import { + ValidationError as SequelizeValidationError, + EmptyResultError as SequelizeEmptyResultError, +} from "sequelize"; + +/** + * To adhere to the OAuth 2.0 specification, errors from the /token and /authorize routes + * follow the snake_case convention with `error` and `error_description` keys, rather than + * our standard error format. + */ +export default function oauthErrorHandler() { + return async function oauthErrorHandlerMiddleware(ctx: Context, next: Next) { + try { + await next(); + } catch (err) { + if (err instanceof SequelizeEmptyResultError) { + ctx.status = 404; + ctx.body = { + error: "invalid_request", + error_description: "Resource not found", + }; + return; + } + if (err instanceof SequelizeValidationError) { + ctx.status = 400; + ctx.body = { + error: "invalid_request", + error_description: err.errors[0].message, + }; + return; + } + + ctx.status = err.code || 500; + ctx.body = { + error: err.name, + error_description: err.message, + }; + } + }; +} diff --git a/server/routes/oauth/schema.ts b/server/routes/oauth/schema.ts new file mode 100644 index 0000000000..3e9d10af5a --- /dev/null +++ b/server/routes/oauth/schema.ts @@ -0,0 +1,11 @@ +import z from "zod"; +import { BaseSchema } from "../api/schema"; + +export const TokenRevokeSchema = BaseSchema.extend({ + body: z.object({ + token: z.string(), + token_type_hint: z.string().optional(), + }), +}); + +export type TokenRevokeReq = z.infer<typeof TokenRevokeSchema>; diff --git a/server/scripts/20240930113921-hash-api-keys.ts b/server/scripts/20240930113921-hash-api-keys.ts index 41e5caabc7..c0dccc2434 100644 --- a/server/scripts/20240930113921-hash-api-keys.ts +++ b/server/scripts/20240930113921-hash-api-keys.ts @@ -2,6 +2,7 @@ import "./bootstrap"; import { Transaction } from "sequelize"; import { ApiKey } from "@server/models"; import { sequelize } from "@server/storage/database"; +import { hash } from "@server/utils/crypto"; let page = parseInt(process.argv[2], 10); page = Number.isNaN(page) ? 0 : page; @@ -25,7 +26,7 @@ export default async function main(exit = false, limit = 100) { if (!apiKey.hash) { console.log(`Migrating ${apiKey.id}…`); apiKey.value = apiKey.secret; - apiKey.hash = ApiKey.hash(apiKey.secret); + apiKey.hash = hash(apiKey.secret); // @ts-expect-error secret is deprecated apiKey.secret = null; await apiKey.save({ transaction }); diff --git a/server/services/web.ts b/server/services/web.ts index 18c6d41923..f75eeb5700 100644 --- a/server/services/web.ts +++ b/server/services/web.ts @@ -22,6 +22,7 @@ import { initI18n } from "@server/utils/i18n"; import routes from "../routes"; import api from "../routes/api"; import auth from "../routes/auth"; +import oauth from "../routes/oauth"; // Construct scripts CSP based on services in use by this installation const defaultSrc = ["'self'"]; @@ -74,6 +75,8 @@ export default function init(app: Koa = new Koa(), server?: Server) { } app.use(compress()); + + app.use(mount("/oauth", oauth)); app.use(mount("/auth", auth)); app.use(mount("/api", api)); diff --git a/server/test/factories.ts b/server/test/factories.ts index 921c75a9fc..f215227bec 100644 --- a/server/test/factories.ts +++ b/server/test/factories.ts @@ -43,8 +43,14 @@ import { Pin, Comment, Import, + OAuthAuthorizationCode, + OAuthClient, + AuthenticationProvider, + OAuthAuthentication, } from "@server/models"; import AttachmentHelper from "@server/models/helpers/AttachmentHelper"; +import { hash } from "@server/utils/crypto"; +import { OAuthInterface } from "@server/utils/oauth/OAuthInterface"; export async function buildApiKey(overrides: Partial<ApiKey> = {}) { if (!overrides.userId) { @@ -137,7 +143,11 @@ export async function buildSubscription(overrides: Partial<Subscription> = {}) { }); } -export function buildTeam(overrides: Record<string, any> = {}) { +export function buildTeam( + overrides: Omit<Partial<Team>, "authenticationProviders"> & { + authenticationProviders?: Partial<AuthenticationProvider>[]; + } = {} +) { return Team.create( { name: faker.company.name(), @@ -691,6 +701,106 @@ export async function buildPin(overrides: Partial<Pin> = {}): Promise<Pin> { return Pin.create(overrides); } +export async function buildOAuthClient(overrides: Partial<OAuthClient> = {}) { + if (!overrides.teamId) { + const team = await buildTeam(); + overrides.teamId = team.id; + } + + if (!overrides.createdById) { + const user = await buildUser({ + teamId: overrides.teamId, + }); + overrides.createdById = user.id; + } + + return OAuthClient.create({ + name: faker.company.name(), + description: faker.lorem.paragraph(), + redirectUris: ["https://example.com/oauth/callback"], + published: true, + ...overrides, + }); +} + +export async function buildOAuthAuthorizationCode( + overrides: Partial<OAuthAuthorizationCode> = {} +) { + if (!overrides.userId) { + const user = await buildUser(); + overrides.userId = user.id; + } + + if (!overrides.expiresAt) { + overrides.expiresAt = new Date(); + } + + const code = randomstring.generate(32); + + let client; + if (overrides.oauthClientId) { + client = await OAuthClient.findByPk(overrides.oauthClientId, { + rejectOnEmpty: true, + }); + } else { + client = await buildOAuthClient(); + overrides.oauthClientId = client.id; + } + + return OAuthAuthorizationCode.create({ + authorizationCodeHash: hash(code), + scope: ["read"], + redirectUri: client.redirectUris[0], + ...overrides, + }); +} + +export async function buildOAuthAuthentication({ + oauthClientId, + user, + scope, +}: { + oauthClientId?: string; + user: User; + scope: string[]; +}) { + const oauthClient = oauthClientId + ? await OAuthClient.findByPk(oauthClientId, { rejectOnEmpty: true }) + : await buildOAuthClient({ + teamId: user.teamId, + }); + const oauthInterfaceClient = { + id: oauthClient.clientId, + grants: ["authorization_code"], + redirectUris: ["https://example.com/oauth/callback"], + }; + const oauthInterfaceUser = { + id: user.id, + }; + + const accessToken = await OAuthInterface.generateAccessToken( + oauthInterfaceClient, + oauthInterfaceUser, + scope + ); + const refreshToken = await OAuthInterface.generateRefreshToken( + oauthInterfaceClient, + oauthInterfaceUser, + scope + ); + return OAuthAuthentication.create({ + userId: user.id, + oauthClientId: oauthClient.id, + accessToken, + accessTokenHash: hash(accessToken), + accessTokenExpiresAt: new Date(Date.now() + 1000 * 60 * 60), + refreshToken, + refreshTokenHash: hash(refreshToken), + refreshTokenExpiresAt: new Date(Date.now() + 1000 * 60 * 60 * 24 * 30), + scope, + }); +} + export function buildProseMirrorDoc(content: DeepPartial<ProsemirrorData>[]) { return Node.fromJSON(schema, { type: "doc", diff --git a/server/types.ts b/server/types.ts index ca0734ba53..f63405ca9d 100644 --- a/server/types.ts +++ b/server/types.ts @@ -37,11 +37,13 @@ import type { Share, GroupMembership, Import, + OAuthClient, } from "./models"; export enum AuthenticationType { API = "api", APP = "app", + OAUTH = "oauth", } export type AuthenticationResult = AccountProvisionerResult & { @@ -50,7 +52,7 @@ export type AuthenticationResult = AccountProvisionerResult & { export type Authentication = { user: User; - token?: string; + token: string; type?: AuthenticationType; }; @@ -469,6 +471,11 @@ export type NotificationEvent = BaseEvent<Notification> & { membershipId?: string; }; +export type OAuthClientEvent = BaseEvent<OAuthClient> & { + name: "oauthClients.create" | "oauthClients.update" | "oauthClients.delete"; + modelId: string; +}; + // eslint-disable-next-line @typescript-eslint/no-explicit-any export type ImportEvent = BaseEvent<Import<any>> & { name: @@ -504,6 +511,7 @@ export type Event = | ViewEvent | WebhookSubscriptionEvent | NotificationEvent + | OAuthClientEvent | EmptyTrashEvent | ImportEvent; diff --git a/server/utils/crypto.ts b/server/utils/crypto.ts index 9bfebbe445..59187f4da5 100644 --- a/server/utils/crypto.ts +++ b/server/utils/crypto.ts @@ -17,3 +17,13 @@ export function safeEqual(a?: string, b?: string) { return crypto.timingSafeEqual(Buffer.from(a), Buffer.from(b)); } + +/** + * Hash a string using SHA-256. + * + * @param input The input string to hash + * @returns The hashed input + */ +export function hash(input: string) { + return crypto.createHash("sha256").update(input).digest("hex"); +} diff --git a/server/utils/oauth/OAuthInterface.test.ts b/server/utils/oauth/OAuthInterface.test.ts new file mode 100644 index 0000000000..053e673ccc --- /dev/null +++ b/server/utils/oauth/OAuthInterface.test.ts @@ -0,0 +1,104 @@ +import { v4 } from "uuid"; +import { Scope } from "@shared/types"; +import { OAuthInterface } from "./OAuthInterface"; + +describe("OAuthInterface", () => { + const user = { + id: v4(), + }; + const client = { + id: v4(), + grants: ["authorization_code", "refresh_token"], + redirectUris: ["https://example.com/callback"], + }; + + describe("#validateRedirectUri", () => { + it("should return true for valid redirect URI", async () => { + const redirectUri = "https://example.com/callback"; + const result = await OAuthInterface.validateRedirectUri( + redirectUri, + client + ); + expect(result).toBe(true); + }); + it("should return false for invalid redirect URI", async () => { + const redirectUri = "invalid_uri"; + const result = await OAuthInterface.validateRedirectUri( + redirectUri, + client + ); + expect(result).toBe(false); + }); + + it("should return false for URI with fragment", async () => { + const redirectUri = "https://example.com/callback#fragment"; + const result = await OAuthInterface.validateRedirectUri( + redirectUri, + client + ); + expect(result).toBe(false); + }); + }); + + describe("#validateScope", () => { + it("should return empty array for empty scope", async () => { + const result = await OAuthInterface.validateScope(user, client, []); + expect(result).toEqual([]); + }); + + it("should return empty array for empty scope", async () => { + const result = await OAuthInterface.validateScope( + user, + client, + undefined + ); + expect(result).toEqual([]); + }); + + it("should allow valid global scopes", async () => { + const scope = [Scope.Read, Scope.Write]; + const result = await OAuthInterface.validateScope(user, client, scope); + expect(result).toEqual(scope); + }); + + it("should allow route scopes", async () => { + const scope = [ + "/api/documents.info", + "/api/documents.create", + "/api/documents.update", + "/api/documents.delete", + ]; + const result = await OAuthInterface.validateScope(user, client, scope); + expect(result).toEqual(scope); + }); + + it("should allow scopes with colon and valid prefix", async () => { + const scope = [ + "documents:read", + "documents:write", + "collections:read", + "collections:write", + ]; + const result = await OAuthInterface.validateScope(user, client, scope); + expect(result).toEqual(scope); + }); + + it("should reject invalid route scopes", async () => { + const scope = ["invalid.scope.periods"]; + const result = await OAuthInterface.validateScope(user, client, scope); + expect(result).toBe(false); + }); + + it("should reject invalid access scopes", async () => { + const scope = ["documents:invalid"]; + const result = await OAuthInterface.validateScope(user, client, scope); + expect(result).toBe(false); + }); + + it("should reject malformed access scopes", async () => { + const scope = ["documents::read"]; + const result = await OAuthInterface.validateScope(user, client, scope); + expect(result).toBe(false); + }); + }); +}); diff --git a/server/utils/oauth/OAuthInterface.ts b/server/utils/oauth/OAuthInterface.ts new file mode 100644 index 0000000000..f4aa7f12e6 --- /dev/null +++ b/server/utils/oauth/OAuthInterface.ts @@ -0,0 +1,294 @@ +import crypto from "crypto"; +import { + RefreshTokenModel, + AuthorizationCodeModel, +} from "@node-oauth/oauth2-server"; +import { Required } from "utility-types"; +import { Scope } from "@shared/types"; +import { isUrl } from "@shared/utils/urls"; +import { + OAuthClient, + OAuthAuthentication, + OAuthAuthorizationCode, +} from "@server/models"; +import { hash, safeEqual } from "@server/utils/crypto"; + +/** + * Additional configuration for the OAuthInterface, not part of the + * OAuth2Server library. + */ +interface Config { + grants: string[]; +} + +/** + * This interface is used by the OAuth2Server library to handle OAuth2 + * authentication and authorization flows. See the library's documentation: + * + * https://node-oauthoauth2-server.readthedocs.io/en/master/model/overview.html + */ +export const OAuthInterface: RefreshTokenModel & + Required< + AuthorizationCodeModel, + | "validateScope" + | "validateRedirectUri" + | "generateAccessToken" + | "generateRefreshToken" + | "generateAuthorizationCode" + > & + Config = { + /** Supported grant types */ + grants: ["authorization_code", "refresh_token"], + + async generateAccessToken() { + return `${OAuthAuthentication.accessTokenPrefix}${crypto + .randomBytes(32) + .toString("hex")}`; + }, + + async generateRefreshToken() { + return `${OAuthAuthentication.refreshTokenPrefix}${crypto + .randomBytes(32) + .toString("hex")}`; + }, + + async generateAuthorizationCode() { + return `${OAuthAuthorizationCode.authorizationCodePrefix}${crypto + .randomBytes(32) + .toString("hex")}`; + }, + + async getAccessToken(accessToken: string) { + const authentication = await OAuthAuthentication.findByAccessToken( + accessToken + ); + if (!authentication) { + return false; + } + + return { + accessToken, + accessTokenExpiresAt: authentication.accessTokenExpiresAt, + scope: authentication.scope, + client: { + id: authentication.oauthClientId, + grants: this.grants, + }, + user: authentication.user, + }; + }, + + async getRefreshToken(refreshToken: string) { + const authentication = await OAuthAuthentication.findByRefreshToken( + refreshToken + ); + if (!authentication) { + return false; + } + + return { + refreshToken, + refreshTokenExpiresAt: authentication.refreshTokenExpiresAt, + scope: authentication.scope, + client: { + id: authentication.oauthClientId, + grants: this.grants, + }, + user: authentication.user, + }; + }, + + async getAuthorizationCode(authorizationCode) { + const code = await OAuthAuthorizationCode.findByCode(authorizationCode); + if (!code) { + return false; + } + + const oauthClient = await OAuthClient.findByPk(code.oauthClientId); + if (!oauthClient) { + return false; + } + + return { + authorizationCode, + expiresAt: code.expiresAt, + scope: code.scope, + redirectUri: code.redirectUri, + codeChallenge: code.codeChallenge, + codeChallengeMethod: code.codeChallengeMethod, + client: { + id: oauthClient.clientId, + grants: this.grants, + }, + user: code.user, + }; + }, + + async getClient(clientId: string, clientSecret?: string) { + const client = await OAuthClient.findByClientId(clientId); + if (!client) { + return false; + } + + if (clientSecret && !safeEqual(client.clientSecret, clientSecret)) { + return false; + } + + return { + id: client.clientId, + redirectUris: client.redirectUris, + databaseId: client.id, + grants: this.grants, + }; + }, + + async saveToken(token, client, user) { + const { + accessToken, + refreshToken, + accessTokenExpiresAt, + refreshTokenExpiresAt, + } = token; + const accessTokenHash = hash(accessToken); + const refreshTokenHash = refreshToken ? hash(refreshToken) : undefined; + + await OAuthAuthentication.create({ + accessTokenHash, + refreshTokenHash, + accessTokenExpiresAt, + refreshTokenExpiresAt, + scope: token.scope, + oauthClientId: client.databaseId, + userId: user.id, + }); + + return { + accessToken, + accessTokenExpiresAt, + refreshToken, + refreshTokenExpiresAt, + scope: token.scope, + client: { + id: client.id, + grants: this.grants, + }, + user, + }; + }, + + async saveAuthorizationCode(code, client, user) { + const { + authorizationCode, + expiresAt, + redirectUri, + scope, + codeChallenge, + codeChallengeMethod, + } = code; + + const authCode = await OAuthAuthorizationCode.create({ + authorizationCodeHash: hash(authorizationCode), + expiresAt, + scope, + redirectUri, + codeChallenge, + codeChallengeMethod, + oauthClientId: client.databaseId, + userId: user.id, + }); + + return { + authorizationCode, + expiresAt, + scope, + redirectUri, + client: { + id: client.id, + grants: this.grants, + }, + user: authCode.user, + }; + }, + + async revokeToken(token) { + const auth = await OAuthAuthentication.findByRefreshToken( + token.refreshToken + ); + if (auth) { + await auth.destroy(); + return true; + } + return false; + }, + + async revokeAuthorizationCode(code) { + const authCode = await OAuthAuthorizationCode.findByCode( + code.authorizationCode + ); + if (authCode) { + await authCode.destroy(); + return true; + } + return false; + }, + + /** + * Ensure the redirect URI is not plain HTTP. Custom protocols are allowed. + * + * @param uri The redirect URI to validate. + * @returns True if the URI is valid, false otherwise. + */ + async validateRedirectUri(uri, client) { + if (uri.includes("#") || uri.includes("*")) { + return false; + } + if (!client.redirectUris?.includes(uri)) { + return false; + } + if (!isUrl(uri, { requireHttps: true })) { + return false; + } + + return true; + }, + + /** + * Invoked to check if the requested scope is valid for a particular + * client/user combination. + * + * @param scope The requested scopes. + * @returns The scopes if valid, false otherwise. + */ + async validateScope(user, client, scope) { + if (!scope?.length) { + return []; + } + + const scopes = Array.isArray(scope) ? scope : [scope]; + const validAccessScopes = Object.values(Scope); + + return scopes.some((s: string) => { + if (validAccessScopes.includes(s as Scope)) { + return true; + } + + const periodCount = (s.match(/\./g) || []).length; + const colonCount = (s.match(/:/g) || []).length; + + if (periodCount === 1 && colonCount === 0) { + return true; + } + + if ( + colonCount === 1 && + validAccessScopes.includes(s.split(":")[1] as Scope) + ) { + return true; + } + + return false; + }) + ? scopes + : false; + }, +}; diff --git a/shared/i18n/locales/en_US/translation.json b/shared/i18n/locales/en_US/translation.json index 9e7704fc14..958f1417f5 100644 --- a/shared/i18n/locales/en_US/translation.json +++ b/shared/i18n/locales/en_US/translation.json @@ -120,6 +120,8 @@ "Log out": "Log out", "Mark notifications as read": "Mark notifications as read", "Archive all notifications": "Archive all notifications", + "New App": "New App", + "New Application": "New Application", "Restore revision": "Restore revision", "Link copied": "Link copied", "Dark": "Dark", @@ -308,6 +310,13 @@ "Unknown": "Unknown", "Mark all as read": "Mark all as read", "You're all caught up": "You're all caught up", + "Icon": "Icon", + "My App": "My App", + "Tagline": "Tagline", + "A short description": "A short description", + "Callback URLs": "Callback URLs", + "Published": "Published", + "Allow this app to be installed by other workspaces": "Allow this app to be installed by other workspaces", "{{ username }} reacted with {{ emoji }}": "{{ username }} reacted with {{ emoji }}", "{{ firstUsername }} and {{ secondUsername }} reacted with {{ emoji }}": "{{ firstUsername }} and {{ secondUsername }} reacted with {{ emoji }}", "{{ firstUsername }} and {{ count }} others reacted with {{ emoji }}": "{{ firstUsername }} and {{ count }} other reacted with {{ emoji }}", @@ -395,7 +404,6 @@ "Star document": "Star document", "Template created, go ahead and customize it": "Template created, go ahead and customize it", "Creating a template from <em>{{titleWithDefault}}</em> is a non-destructive action – we'll make a copy of the document and turn it into a template that can be used as a starting point for new documents.": "Creating a template from <em>{{titleWithDefault}}</em> is a non-destructive action – we'll make a copy of the document and turn it into a template that can be used as a starting point for new documents.", - "Published": "Published", "Enable other members to use the template immediately": "Enable other members to use the template immediately", "Location": "Location", "Admins can manage the workspace and access billing.": "Admins can manage the workspace and access billing.", @@ -512,12 +520,14 @@ "Unsubscribed from document": "Unsubscribed from document", "Unsubscribed from collection": "Unsubscribed from collection", "Account": "Account", - "API Keys": "API Keys", + "API & Apps": "API & Apps", "Details": "Details", "Security": "Security", "Features": "Features", "Members": "Members", "Groups": "Groups", + "API Keys": "API Keys", + "Applications": "Applications", "Shared Links": "Shared Links", "Import": "Import", "Integrations": "Integrations", @@ -551,6 +561,10 @@ "New child document": "New child document", "Save in workspace": "Save in workspace", "Notification settings": "Notification settings", + "Revoke {{ appName }}": "Revoke {{ appName }}", + "Revoking": "Revoking", + "Are you sure you want to revoke access?": "Are you sure you want to revoke access?", + "Delete app": "Delete app", "Revision options": "Revision options", "Share link revoked": "Share link revoked", "Share link copied": "Share link copied", @@ -805,6 +819,8 @@ "Authentication failed – this login method was disabled by a workspace admin.": "Authentication failed – this login method was disabled by a workspace admin.", "The workspace you are trying to join requires an invite before you can create an account.<1></1>Please request an invite from your workspace admin and try again.": "The workspace you are trying to join requires an invite before you can create an account.<1></1>Please request an invite from your workspace admin and try again.", "Sorry, an unknown error occurred.": "Sorry, an unknown error occurred.", + "Choose a workspace": "Choose a workspace", + "Choose an {{ appName }} workspace or login to continue connecting this app": "Choose an {{ appName }} workspace or login to continue connecting this app", "Login": "Login", "Error": "Error", "Failed to load configuration.": "Failed to load configuration.", @@ -822,6 +838,34 @@ "You signed in with {{ authProviderName }} last time.": "You signed in with {{ authProviderName }} last time.", "Or": "Or", "Already have an account? Go to <1>login</1>.": "Already have an account? Go to <1>login</1>.", + "An error occurred": "An error occurred", + "The OAuth client could not be found, please check the provided client ID": "The OAuth client could not be found, please check the provided client ID", + "The OAuth client could not be loaded, please check the redirect URI is valid": "The OAuth client could not be loaded, please check the redirect URI is valid", + "Required OAuth parameters are missing": "Required OAuth parameters are missing", + "Authorize": "Authorize", + "{{ appName }} wants to access {{ teamName }}": "{{ appName }} wants to access {{ teamName }}", + "By <em>{{ developerName }}</em>": "By <em>{{ developerName }}</em>", + "{{ appName }} will be able to access your account and perform the following actions": "{{ appName }} will be able to access your account and perform the following actions", + "read": "read", + "write": "write", + "read and write": "read and write", + "API keys": "API keys", + "attachments": "attachments", + "collections": "collections", + "comments": "comments", + "documents": "documents", + "events": "events", + "groups": "groups", + "integrations": "integrations", + "notifications": "notifications", + "reactions": "reactions", + "pins": "pins", + "shares": "shares", + "users": "users", + "teams": "teams", + "workspace": "workspace", + "Read all data": "Read all data", + "Write all data": "Write all data", "Any collection": "Any collection", "All time": "All time", "Past day": "Past day", @@ -837,15 +881,38 @@ "Something went wrong": "Something went wrong", "Please try again or contact support if the problem persists": "Please try again or contact support if the problem persists", "No documents found for your search filters.": "No documents found for your search filters.", + "Create personal API keys to authenticate with the API and programatically control\n your workspace's data. For more details see the <em>developer documentation</em>.": "Create personal API keys to authenticate with the API and programatically control\n your workspace's data. For more details see the <em>developer documentation</em>.", + "{t(\"API keys have been disabled by an admin for your account\")}": "{t(\"API keys have been disabled by an admin for your account\")}", + "API keys have been disabled by an admin for your account": "API keys have been disabled by an admin for your account", + "Application access": "Application access", + "Manage which third-party and internal applications have been granted access to your {{ appName }} account.": "Manage which third-party and internal applications have been granted access to your {{ appName }} account.", "API": "API", "API keys can be used to authenticate with the API and programatically control\n your workspace's data. For more details see the <em>developer documentation</em>.": "API keys can be used to authenticate with the API and programatically control\n your workspace's data. For more details see the <em>developer documentation</em>.", + "Application published": "Application published", + "Application updated": "Application updated", + "Client secret rotated": "Client secret rotated", + "Rotate secret": "Rotate secret", + "Rotating the client secret will invalidate the current secret. Make sure to update any applications using these credentials.": "Rotating the client secret will invalidate the current secret. Make sure to update any applications using these credentials.", + "Displayed to users when authorizing": "Displayed to users when authorizing", + "Developer information shown to users when authorizing": "Developer information shown to users when authorizing", + "Developer name": "Developer name", + "Developer URL": "Developer URL", + "Allow users from other workspaces to authorize this app": "Allow users from other workspaces to authorize this app", + "Credentials": "Credentials", + "OAuth client ID": "OAuth client ID", + "The public identifier for this app": "The public identifier for this app", + "OAuth client secret": "OAuth client secret", + "Store this value securely, do not expose it publicly": "Store this value securely, do not expose it publicly", + "Where users are redirected after authorizing this app": "Where users are redirected after authorizing this app", + "Authorization URL": "Authorization URL", + "Where users are redirected to authorize this app": "Where users are redirected to authorize this app", + "Applications allow you to build internal or public integrations with Outline and provide secure access via OAuth. For more details see the <em>developer documentation</em>.": "Applications allow you to build internal or public integrations with Outline and provide secure access via OAuth. For more details see the <em>developer documentation</em>.", "by {{ name }}": "by {{ name }}", "Last used": "Last used", "No expiry": "No expiry", "Restricted scope": "Restricted scope", "API key copied to clipboard": "API key copied to clipboard", "Copied": "Copied", - "Revoking": "Revoking", "Are you sure you want to revoke the {{ tokenName }} token?": "Are you sure you want to revoke the {{ tokenName }} token?", "Disconnect integration": "Disconnect integration", "Connected": "Connected", @@ -892,7 +959,7 @@ "No people matching your search": "No people matching your search", "No people left to add": "No people left to add", "Date created": "Date created", - "Upload": "Upload", + "Crop Image": "Crop Image", "Crop image": "Crop image", "Uploading": "Uploading", "How does this work?": "How does this work?", @@ -909,6 +976,8 @@ "Drag and drop the zip file from the Markdown export option in {{appName}}, or click to upload": "Drag and drop the zip file from the Markdown export option in {{appName}}, or click to upload", "Last active": "Last active", "Guest": "Guest", + "Never used": "Never used", + "Are you sure you want to delete the {{ appName }} application? This cannot be undone.": "Are you sure you want to delete the {{ appName }} application? This cannot be undone.", "Shared by": "Shared by", "Date shared": "Date shared", "Last accessed": "Last accessed", @@ -993,8 +1062,6 @@ "Unsubscription successful. Your notification settings were updated": "Unsubscription successful. Your notification settings were updated", "Manage when and where you receive email notifications.": "Manage when and where you receive email notifications.", "The email integration is currently disabled. Please set the associated environment variables and restart the server to enable notifications.": "The email integration is currently disabled. Please set the associated environment variables and restart the server to enable notifications.", - "Create personal API keys to authenticate with the API and programatically control\n your workspace's data. API keys have the same permissions as your user account.\n For more details see the <em>developer documentation</em>.": "Create personal API keys to authenticate with the API and programatically control\n your workspace's data. API keys have the same permissions as your user account.\n For more details see the <em>developer documentation</em>.", - "Personal keys": "Personal keys", "Preferences saved": "Preferences saved", "Delete account": "Delete account", "Manage settings that affect your personal experience.": "Manage settings that affect your personal experience.", diff --git a/shared/types.ts b/shared/types.ts index bf08671624..c1346ccc37 100644 --- a/shared/types.ts +++ b/shared/types.ts @@ -5,6 +5,15 @@ export enum UserRole { Guest = "guest", } +/** + * Scopes for OAuth and API keys. + */ +export enum Scope { + Read = "read", + Write = "write", + Create = "create", +} + export type DateFilter = "day" | "week" | "month" | "year"; export enum StatusFilter { diff --git a/shared/utils/urls.ts b/shared/utils/urls.ts index 96d0d256c8..31e35559f1 100644 --- a/shared/utils/urls.ts +++ b/shared/utils/urls.ts @@ -98,7 +98,15 @@ export function isCollectionUrl(url: string) { * @param options Parsing options. * @returns True if a url, false otherwise. */ -export function isUrl(text: string, options?: { requireHostname: boolean }) { +export function isUrl( + text: string, + options?: { + /** Require the url to have a hostname. */ + requireHostname?: boolean; + /** Require the url not to use HTTP, custom protocols are ok. */ + requireHttps?: boolean; + } +) { if (text.match(/\n/)) { return false; } @@ -113,6 +121,9 @@ export function isUrl(text: string, options?: { requireHostname: boolean }) { if (url.hostname) { return true; } + if (options?.requireHttps && url.protocol === "http:") { + return false; + } return ( url.protocol !== "" && diff --git a/shared/validations.ts b/shared/validations.ts index ac0f5ac73e..c35c1610ee 100644 --- a/shared/validations.ts +++ b/shared/validations.ts @@ -56,6 +56,26 @@ export const ImportValidation = { maxNameLength: 100, }; +export const OAuthClientValidation = { + /** The maximum length of the OAuth client name */ + maxNameLength: 100, + + /** The maximum length of the OAuth client description */ + maxDescriptionLength: 1000, + + /** The maximum length of the OAuth client developer name */ + maxDeveloperNameLength: 100, + + /** The maximum length of the OAuth client developer URL */ + maxDeveloperUrlLength: 1000, + + /** The maximum length of the OAuth client avatar URL */ + maxAvatarUrlLength: 1000, + + /** The maximum length of an OAuth client redirect URI */ + maxRedirectUriLength: 1000, +}; + export const RevisionValidation = { minNameLength: 1, maxNameLength: 255, diff --git a/yarn.lock b/yarn.lock index f820f25cf6..3e08adac8b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2867,6 +2867,20 @@ resolved "https://registry.yarnpkg.com/@nicolo-ribaudo/chokidar-2/-/chokidar-2-2.1.8-no-fsevents.3.tgz#323d72dd25103d0c4fbdce89dadf574a787b1f9b" integrity "sha1-Mj1y3SUQPQxPvc6J2t9XSnh7H5s= sha512-s88O1aVtXftvp5bCPB7WnmXc5IwOZZ7YPuwNPt+GtOOXpPvad1LfbmjYv+qII7zP6RU2QGnqve27dnLycEnyEQ==" +"@node-oauth/formats@1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@node-oauth/formats/-/formats-1.0.0.tgz#6525478802180199ecf6ea3208fc5e1b683031be" + integrity sha512-DwSbLtdC8zC5B5gTJkFzJj5s9vr9SGzOgQvV9nH7tUVuMSScg0EswAczhjIapOmH3Y8AyP7C4Jv7b8+QJObWZA== + +"@node-oauth/oauth2-server@^5.2.0": + version "5.2.0" + resolved "https://registry.yarnpkg.com/@node-oauth/oauth2-server/-/oauth2-server-5.2.0.tgz#9bfabf1f5d24387c919e30a4c5fa3ff0c408cbfa" + integrity sha512-tbw0aHPk1Pu/HmQlll4unYd+VHwoagbAmUBLys5g6hDh9khcKzTmE77Z0myMG5a66w3Yk3xBwCRPX9a7M+HTqA== + dependencies: + "@node-oauth/formats" "1.0.0" + basic-auth "2.0.1" + type-is "1.6.18" + "@nodelib/fs.scandir@2.1.5": version "2.1.5" resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5" @@ -6522,6 +6536,13 @@ base64url@3.x.x: resolved "https://registry.yarnpkg.com/base64url/-/base64url-3.0.1.tgz#6399d572e2bc3f90a9a8b22d5dbb0a32d33f788d" integrity "sha1-Y5nVcuK8P5CpqLItXbsKMtM/eI0= sha512-ir1UPr3dkwexU7FdV8qBBbNDRUhMmIekYMFZfi+C/sLNnRESKPl23nB9b2pltqfOQNnGzsDdId90AEtG5tCx4A==" +basic-auth@2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/basic-auth/-/basic-auth-2.0.1.tgz#b998279bf47ce38344b4f3cf916d4679bbf51e3a" + integrity sha512-NF+epuEdnUYVlGuhaxbbq+dvJttwLnGY+YixlXlME5KpQ5W3CnXA5cVTneY3SPbPDRkcjMbifrwmFYcClgOZeg== + dependencies: + safe-buffer "5.1.2" + before-after-hook@^2.2.0: version "2.2.3" resolved "https://registry.yarnpkg.com/before-after-hook/-/before-after-hook-2.2.3.tgz#c51e809c81a4e354084422b9b26bad88249c517c" @@ -15330,7 +15351,7 @@ type-fest@^4.0.0: resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-4.20.1.tgz#d97bb1e923bf524e5b4b43421d586760fb2ee8be" integrity sha512-R6wDsVsoS9xYOpy8vgeBlqpdOyzJ12HNfQhC/aAKWM3YoCV9TtunJzh/QpkMgeDhkoynDcw5f1y+qF9yc/HHyg== -type-is@^1.6.16, type-is@^1.6.18: +type-is@1.6.18, type-is@^1.6.16, type-is@^1.6.18: version "1.6.18" resolved "https://registry.yarnpkg.com/type-is/-/type-is-1.6.18.tgz#4e552cd05df09467dcbc4ef739de89f2cf37c131" integrity "sha1-TlUs0F3wlGfcvE73Od6J8s83wTE= sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==" From 97f31e3f2aea93792bbd2df82c16dfa07a670ce2 Mon Sep 17 00:00:00 2001 From: Tom Moor <tom@getoutline.com> Date: Sat, 3 May 2025 22:13:54 -0400 Subject: [PATCH 41/64] fix: Cannot create document through @mention on collection overview (#9127) --- .../Collection/components/Overview.tsx} | 30 ++++++++++++++++--- app/scenes/Collection/index.tsx | 4 +-- shared/i18n/locales/en_US/translation.json | 4 +-- 3 files changed, 30 insertions(+), 8 deletions(-) rename app/{components/CollectionDescription.tsx => scenes/Collection/components/Overview.tsx} (76%) diff --git a/app/components/CollectionDescription.tsx b/app/scenes/Collection/components/Overview.tsx similarity index 76% rename from app/components/CollectionDescription.tsx rename to app/scenes/Collection/components/Overview.tsx index 4b16a3b4fe..80461e9fc6 100644 --- a/app/components/CollectionDescription.tsx +++ b/app/scenes/Collection/components/Overview.tsx @@ -6,15 +6,18 @@ import { toast } from "sonner"; import styled from "styled-components"; import { richExtensions } from "@shared/editor/nodes"; import { s } from "@shared/styles"; +import { ProsemirrorHelper } from "@shared/utils/ProsemirrorHelper"; import { CollectionValidation } from "@shared/validations"; import Collection from "~/models/Collection"; +import Document from "~/models/Document"; import Editor from "~/components/Editor"; import LoadingIndicator from "~/components/LoadingIndicator"; +import Text from "~/components/Text"; import { withUIExtensions } from "~/editor/extensions"; import useCurrentUser from "~/hooks/useCurrentUser"; import usePolicy from "~/hooks/usePolicy"; import useStores from "~/hooks/useStores"; -import Text from "./Text"; +import { Properties } from "~/types"; const extensions = withUIExtensions(richExtensions); @@ -22,8 +25,8 @@ type Props = { collection: Collection; }; -function CollectionDescription({ collection }: Props) { - const { collections } = useStores(); +function Overview({ collection }: Props) { + const { documents, collections } = useStores(); const { t } = useTranslation(); const user = useCurrentUser({ rejectOnEmpty: true }); const can = usePolicy(collection); @@ -54,6 +57,24 @@ function CollectionDescription({ collection }: Props) { [childOffsetHeight] ); + const onCreateLink = React.useCallback( + async (params: Properties<Document>) => { + const newDocument = await documents.create( + { + collectionId: collection.id, + data: ProsemirrorHelper.getEmptyDocument(), + ...params, + }, + { + publish: true, + } + ); + + return newDocument.url; + }, + [collection, documents] + ); + return ( <> {collections.isSaving && <LoadingIndicator />} @@ -65,6 +86,7 @@ function CollectionDescription({ collection }: Props) { placeholder={`${t("Add a description")}…`} extensions={extensions} maxLength={CollectionValidation.maxDescriptionLength} + onCreateLink={onCreateLink} canUpdate={can.update} readOnly={!can.update} userId={user.id} @@ -83,4 +105,4 @@ const Placeholder = styled(Text)` min-height: 27px; `; -export default observer(CollectionDescription); +export default observer(Overview); diff --git a/app/scenes/Collection/index.tsx b/app/scenes/Collection/index.tsx index b3c5597714..8ee317bd2a 100644 --- a/app/scenes/Collection/index.tsx +++ b/app/scenes/Collection/index.tsx @@ -20,7 +20,6 @@ import Collection from "~/models/Collection"; import { Action } from "~/components/Actions"; import CenteredContent from "~/components/CenteredContent"; import { CollectionBreadcrumb } from "~/components/CollectionBreadcrumb"; -import CollectionDescription from "~/components/CollectionDescription"; import Heading from "~/components/Heading"; import CollectionIcon from "~/components/Icons/CollectionIcon"; import InputSearchPage from "~/components/InputSearchPage"; @@ -46,6 +45,7 @@ import DropToImport from "./components/DropToImport"; import Empty from "./components/Empty"; import MembershipPreview from "./components/MembershipPreview"; import Notices from "./components/Notices"; +import Overview from "./components/Overview"; import ShareButton from "./components/ShareButton"; const IconPicker = React.lazy(() => import("~/components/IconPicker")); @@ -259,7 +259,7 @@ const CollectionScene = observer(function _CollectionScene() { path={collectionPath(collection.path, CollectionPath.Overview)} > {hasOverview ? ( - <CollectionDescription collection={collection} /> + <Overview collection={collection} /> ) : ( <Redirect to={{ diff --git a/shared/i18n/locales/en_US/translation.json b/shared/i18n/locales/en_US/translation.json index 958f1417f5..fa45a461cb 100644 --- a/shared/i18n/locales/en_US/translation.json +++ b/shared/i18n/locales/en_US/translation.json @@ -172,8 +172,6 @@ "Deleting": "Deleting", "Are you sure about that? Deleting the <em>{{collectionName}}</em> collection is permanent and cannot be restored, however all published documents within will be moved to the trash.": "Are you sure about that? Deleting the <em>{{collectionName}}</em> collection is permanent and cannot be restored, however all published documents within will be moved to the trash.", "Also, <em>{{collectionName}}</em> is being used as the start view – deleting it will reset the start view to the Home page.": "Also, <em>{{collectionName}}</em> is being used as the start view – deleting it will reset the start view to the Home page.", - "Sorry, an error occurred saving the collection": "Sorry, an error occurred saving the collection", - "Add a description": "Add a description", "Type a command or search": "Type a command or search", "Choose a template": "Choose a template", "Are you sure you want to permanently delete this entire comment thread?": "Are you sure you want to permanently delete this entire comment thread?", @@ -618,6 +616,8 @@ "{{ groupsCount }} groups with access": "{{ groupsCount }} group with access", "{{ groupsCount }} groups with access_plural": "{{ groupsCount }} groups with access", "Archived by {{userName}}": "Archived by {{userName}}", + "Sorry, an error occurred saving the collection": "Sorry, an error occurred saving the collection", + "Add a description": "Add a description", "Share": "Share", "Overview": "Overview", "Recently updated": "Recently updated", From ceac57bd64f7a74a5bad157d1d7c84f5f0a1562a Mon Sep 17 00:00:00 2001 From: Tom Moor <tom@getoutline.com> Date: Sat, 3 May 2025 23:09:08 -0400 Subject: [PATCH 42/64] Pick collection color based on existing collections (#9128) --- app/components/Collection/CollectionForm.tsx | 28 ++++++++++++++++---- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/app/components/Collection/CollectionForm.tsx b/app/components/Collection/CollectionForm.tsx index 8e308d0927..b1b5c3b159 100644 --- a/app/components/Collection/CollectionForm.tsx +++ b/app/components/Collection/CollectionForm.tsx @@ -1,3 +1,4 @@ +import uniq from "lodash/uniq"; import { observer } from "mobx-react"; import * as React from "react"; import { Controller, useForm } from "react-hook-form"; @@ -18,6 +19,7 @@ import Switch from "~/components/Switch"; import Text from "~/components/Text"; import useBoolean from "~/hooks/useBoolean"; import useCurrentTeam from "~/hooks/useCurrentTeam"; +import useStores from "~/hooks/useStores"; import { EmptySelectValue } from "~/types"; const IconPicker = React.lazy(() => import("~/components/IconPicker")); @@ -30,6 +32,26 @@ export interface FormData { permission: CollectionPermission | undefined; } +const useIconColor = (collection?: Collection) => { + const { collections } = useStores(); + const hasMultipleCollections = collections.orderedData.length > 1; + const collectionColors = uniq( + collections.orderedData.map((c) => c.color).filter(Boolean) + ) as string[]; + + const iconColor = React.useMemo( + () => + collection?.color ?? + // If all the existing collections have the same color, use that color, + // otherwise pick a random color from the palette + (hasMultipleCollections && collectionColors.length === 1 + ? collectionColors[0] + : randomElement(colorPalette)), + [collection?.color] + ); + return iconColor; +}; + export const CollectionForm = observer(function CollectionForm_({ handleSubmit, collection, @@ -42,11 +64,7 @@ export const CollectionForm = observer(function CollectionForm_({ const [hasOpenedIconPicker, setHasOpenedIconPicker] = useBoolean(false); - const iconColor = React.useMemo( - () => collection?.color ?? randomElement(colorPalette), - [collection?.color] - ); - + const iconColor = useIconColor(collection); const fallbackIcon = <Icon value="collection" color={iconColor} />; const { From 0a674eacfafc736f772eaf50571c5c2dd55e350b Mon Sep 17 00:00:00 2001 From: Tom Moor <tom@getoutline.com> Date: Sun, 4 May 2025 08:51:48 -0400 Subject: [PATCH 43/64] fix: Improve behavior when hitting backspace/delete with table cell selections (#9129) --- shared/editor/commands/table.ts | 59 +++++++++++++++++++++++++++++++-- shared/editor/nodes/Math.ts | 13 +------- shared/editor/nodes/Table.ts | 12 ++++++- 3 files changed, 68 insertions(+), 16 deletions(-) diff --git a/shared/editor/commands/table.ts b/shared/editor/commands/table.ts index 0222d2d248..0192bdc271 100644 --- a/shared/editor/commands/table.ts +++ b/shared/editor/commands/table.ts @@ -1,6 +1,11 @@ import { GapCursor } from "prosemirror-gapcursor"; -import { Node, NodeType } from "prosemirror-model"; -import { Command, EditorState, TextSelection } from "prosemirror-state"; +import { Node, NodeType, Slice } from "prosemirror-model"; +import { + Command, + EditorState, + TextSelection, + Transaction, +} from "prosemirror-state"; import { CellSelection, addRow, @@ -11,11 +16,16 @@ import { addColumn, deleteRow, deleteColumn, + deleteTable, } from "prosemirror-tables"; import { ProsemirrorHelper } from "../../utils/ProsemirrorHelper"; import { CSVHelper } from "../../utils/csv"; import { chainTransactions } from "../lib/chainTransactions"; -import { getCellsInColumn, isHeaderEnabled } from "../queries/table"; +import { + getCellsInColumn, + isHeaderEnabled, + isTableSelected, +} from "../queries/table"; import { TableLayout } from "../types"; import { collapseSelection } from "./collapseSelection"; @@ -544,3 +554,46 @@ export function moveOutOfTable(direction: 1 | -1): Command { return false; }; } + +/** + * A command that deletes the entire table if all cells are selected. + * + * @returns The command + */ +export function deleteTableIfSelected(): Command { + return (state, dispatch): boolean => { + if (isTableSelected(state)) { + return deleteTable(state, dispatch); + } + return false; + }; +} + +export function deleteCellSelection( + state: EditorState, + dispatch?: (tr: Transaction) => void +): boolean { + const sel = state.selection; + if (!(sel instanceof CellSelection)) { + return false; + } + if (dispatch) { + const tr = state.tr; + const baseContent = tableNodeTypes(state.schema).cell.createAndFill()! + .content; + sel.forEachCell((cell, pos) => { + if (!cell.content.eq(baseContent)) { + tr.replace( + tr.mapping.map(pos + 1), + tr.mapping.map(pos + cell.nodeSize - 1), + new Slice(baseContent, 0, 0) + ); + } + }); + if (tr.docChanged) { + dispatch(tr); + return true; + } + } + return false; +} diff --git a/shared/editor/nodes/Math.ts b/shared/editor/nodes/Math.ts index 83c0911e57..1679c6aa6b 100644 --- a/shared/editor/nodes/Math.ts +++ b/shared/editor/nodes/Math.ts @@ -5,12 +5,6 @@ import { mathSchemaSpec, } from "@benrbray/prosemirror-math"; import { PluginSimple } from "markdown-it"; -import { - chainCommands, - deleteSelection, - selectNodeBackward, - joinBackward, -} from "prosemirror-commands"; import { NodeSpec, NodeType, @@ -51,12 +45,7 @@ export default class Math extends Node { keys({ type }: { type: NodeType }) { return { "Mod-Space": insertMathCmd(type), - Backspace: chainCommands( - deleteSelection, - mathBackspaceCmd, - joinBackward, - selectNodeBackward - ), + Backspace: mathBackspaceCmd, }; } diff --git a/shared/editor/nodes/Table.ts b/shared/editor/nodes/Table.ts index 708c794385..aefbe753ae 100644 --- a/shared/editor/nodes/Table.ts +++ b/shared/editor/nodes/Table.ts @@ -24,8 +24,10 @@ import { setTableAttr, deleteColSelection, deleteRowSelection, + deleteCellSelection, moveOutOfTable, createTableInner, + deleteTableIfSelected, } from "../commands/table"; import { MarkdownSerializerState } from "../lib/markdown/serializer"; import { FixTablesPlugin } from "../plugins/FixTables"; @@ -96,8 +98,16 @@ export default class Table extends Node { "Shift-Tab": goToNextCell(-1), "Mod-Enter": addRowAndMoveSelection(), "Mod-Backspace": chainCommands( + deleteCellSelection, deleteColSelection(), - deleteRowSelection() + deleteRowSelection(), + deleteTableIfSelected() + ), + Backspace: chainCommands( + deleteCellSelection, + deleteColSelection(), + deleteRowSelection(), + deleteTableIfSelected() ), ArrowDown: moveOutOfTable(1), ArrowUp: moveOutOfTable(-1), From f576ddccfeae64dc1745828f9e60b9dfb4e55787 Mon Sep 17 00:00:00 2001 From: Tom Moor <tom@getoutline.com> Date: Sun, 4 May 2025 09:18:37 -0400 Subject: [PATCH 44/64] chore: Add 10 more brand icons (#9130) --- shared/utils/IconLibrary.tsx | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/shared/utils/IconLibrary.tsx b/shared/utils/IconLibrary.tsx index 8a3daed74c..67308cda1a 100644 --- a/shared/utils/IconLibrary.tsx +++ b/shared/utils/IconLibrary.tsx @@ -7,6 +7,16 @@ import { faWebAwesome, faXTwitter, faBluesky, + faGithub, + faGitlab, + faDiscord, + faDocker, + faCodepen, + faDropbox, + faPaypal, + faShopify, + faSwift, + faSlack, } from "@fortawesome/free-brands-svg-icons"; import { faBagShopping, @@ -551,6 +561,16 @@ export class IconLibrary { faPython, faXTwitter, faBluesky, + faGithub, + faGitlab, + faDiscord, + faDocker, + faCodepen, + faDropbox, + faPaypal, + faShopify, + faSwift, + faSlack, ].map((icon) => [ icon.iconName, { From 83e87254c6e8dc8a1249f5c462b5e45574a0b3a9 Mon Sep 17 00:00:00 2001 From: Tom Moor <tom@getoutline.com> Date: Sun, 4 May 2025 09:59:21 -0400 Subject: [PATCH 45/64] fix: Invisible JS error (#9131) --- shared/editor/queries/table.ts | 81 ++++++++++++++++++++++++++-------- 1 file changed, 62 insertions(+), 19 deletions(-) diff --git a/shared/editor/queries/table.ts b/shared/editor/queries/table.ts index a6692795b5..7bad794269 100644 --- a/shared/editor/queries/table.ts +++ b/shared/editor/queries/table.ts @@ -6,6 +6,30 @@ import { selectedRect, } from "prosemirror-tables"; +/** + * Checks if the current selection is a column selection. + * @param state The editor state. + * @returns True if the selection is a column selection, false otherwise. + */ +export function isColSelection(state: EditorState): boolean { + if (state.selection instanceof CellSelection) { + return state.selection.isColSelection(); + } + return false; +} + +/** + * Checks if the current selection is a row selection. + * @param state The editor state. + * @returns True if the selection is a row selection, false otherwise. + */ +export function isRowSelection(state: EditorState): boolean { + if (state.selection instanceof CellSelection) { + return state.selection.isRowSelection(); + } + return false; +} + export function getColumnIndex(state: EditorState): number | undefined { if (state.selection instanceof CellSelection) { if (state.selection.isColSelection()) { @@ -62,13 +86,18 @@ export function getCellsInRow(index: number) { }; } +/** + * Check if a specific column is selected in the editor. + * + * @param state The editor state + * @param index The index of the column to check + * @returns Boolean indicating if the column is selected + */ export function isColumnSelected(index: number) { return (state: EditorState): boolean => { - if (state.selection instanceof CellSelection) { - if (state.selection.isColSelection()) { - const rect = selectedRect(state); - return rect.left <= index && rect.right > index; - } + if (isColSelection(state)) { + const rect = selectedRect(state); + return rect.left <= index && rect.right > index; } return false; @@ -106,28 +135,42 @@ export function isHeaderEnabled( return true; } +/** + * Check if a specific row is selected in the editor. + * + * @param state The editor state + * @param index The index of the row to check + * @returns Boolean indicating if the row is selected + */ export function isRowSelected(index: number) { return (state: EditorState): boolean => { - if (state.selection instanceof CellSelection) { - if (state.selection.isRowSelection()) { - const rect = selectedRect(state); - return rect.top <= index && rect.bottom > index; - } + if (isRowSelection(state)) { + const rect = selectedRect(state); + return rect.top <= index && rect.bottom > index; } return false; }; } +/** + * Check if an entire table is selected in the editor. + * + * @param state The editor state + * @returns Boolean indicating if the table is selected + */ export function isTableSelected(state: EditorState): boolean { - const rect = selectedRect(state); + if (state.selection instanceof CellSelection) { + const rect = selectedRect(state); - return ( - rect.top === 0 && - rect.left === 0 && - rect.bottom === rect.map.height && - rect.right === rect.map.width && - !state.selection.empty && - state.selection instanceof CellSelection - ); + return ( + rect.top === 0 && + rect.left === 0 && + rect.bottom === rect.map.height && + rect.right === rect.map.width && + !state.selection.empty + ); + } + + return false; } From bed3d1078e3a5535f9de2dbef8f42d097b5b9378 Mon Sep 17 00:00:00 2001 From: Tom Moor <tom@getoutline.com> Date: Sun, 4 May 2025 16:11:02 -0400 Subject: [PATCH 46/64] fix: More guards against empty text nodes (#9132) --- .../notion/server/utils/NotionConverter.ts | 40 +++++++++---------- .../notion-page-with-empty-text-nodes.json | 4 +- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/plugins/notion/server/utils/NotionConverter.ts b/plugins/notion/server/utils/NotionConverter.ts index 8e4539eb74..230407748e 100644 --- a/plugins/notion/server/utils/NotionConverter.ts +++ b/plugins/notion/server/utils/NotionConverter.ts @@ -288,7 +288,7 @@ export class NotionConverter { if (item.mention.type === "link_mention") { return { type: "text", - text: item.plain_text, + text: item.plain_text || item.mention.link_mention.href, marks: [ { type: "link", @@ -302,7 +302,7 @@ export class NotionConverter { if (item.mention.type === "link_preview") { return { type: "text", - text: item.plain_text, + text: item.plain_text || item.mention.link_preview.url, marks: [ { type: "link", @@ -314,14 +314,14 @@ export class NotionConverter { }; } - if (!item.plain_text) { - return undefined; + if (item.plain_text) { + return { + type: "text", + text: item.plain_text, + }; } - return { - type: "text", - text: item.plain_text, - }; + return undefined; } if (item.type === "equation") { @@ -336,20 +336,20 @@ export class NotionConverter { }; } - if (!item.text.content) { - return undefined; + if (item.text.content) { + return { + type: "text", + text: item.text.content, + marks: [ + ...mapAttrs(), + ...(item.text.link + ? [{ type: "link", attrs: { href: item.text.link.url } }] + : []), + ].filter(Boolean), + }; } - return { - type: "text", - text: item.text.content, - marks: [ - ...mapAttrs(), - ...(item.text.link - ? [{ type: "link", attrs: { href: item.text.link.url } }] - : []), - ].filter(Boolean), - }; + return undefined; } private static rich_text_to_plaintext(item: RichTextItemResponse) { diff --git a/server/test/fixtures/notion-page-with-empty-text-nodes.json b/server/test/fixtures/notion-page-with-empty-text-nodes.json index 9c98e5b036..7a32e1f9ef 100644 --- a/server/test/fixtures/notion-page-with-empty-text-nodes.json +++ b/server/test/fixtures/notion-page-with-empty-text-nodes.json @@ -191,7 +191,7 @@ "code": false, "color": "default" }, - "plain_text": "http://github.com/outline/", + "plain_text": "", "href": "http://github.com/outline/" } ], @@ -506,4 +506,4 @@ "color": "default" } } -] \ No newline at end of file +] From c5d534b2ad13fa8edb0c98d8e9a9c16e92f9e90e Mon Sep 17 00:00:00 2001 From: Hemachandar <132386067+hmacr@users.noreply.github.com> Date: Mon, 5 May 2025 01:42:09 +0530 Subject: [PATCH 47/64] Add script to resolve existing collection index collisions (#8810) * Add script to resolve existing collection index collisions * Remove debug logging --------- Co-authored-by: Tom Moor <tom.moor@gmail.com> --- ...414-resolve-collection-index-collisions.js | 29 ++++ ...414-resolve-collection-index-collisions.ts | 127 ++++++++++++++++++ 2 files changed, 156 insertions(+) create mode 100644 server/migrations/20250327062414-resolve-collection-index-collisions.js create mode 100644 server/scripts/20250327062414-resolve-collection-index-collisions.ts diff --git a/server/migrations/20250327062414-resolve-collection-index-collisions.js b/server/migrations/20250327062414-resolve-collection-index-collisions.js new file mode 100644 index 0000000000..7a6b7f0ad1 --- /dev/null +++ b/server/migrations/20250327062414-resolve-collection-index-collisions.js @@ -0,0 +1,29 @@ +"use strict"; + +const { execFileSync } = require("child_process"); +const path = require("path"); + +/** @type {import('sequelize-cli').Migration} */ +module.exports = { + async up() { + if ( + process.env.NODE_ENV === "test" || + process.env.DEPLOYMENT === "hosted" + ) { + return; + } + + const scriptName = path.basename(__filename); + const scriptPath = path.join( + process.cwd(), + "build", + `server/scripts/${scriptName}` + ); + + execFileSync("node", [scriptPath], { stdio: "inherit" }); + }, + + async down() { + // noop + }, +}; diff --git a/server/scripts/20250327062414-resolve-collection-index-collisions.ts b/server/scripts/20250327062414-resolve-collection-index-collisions.ts new file mode 100644 index 0000000000..9ef5364824 --- /dev/null +++ b/server/scripts/20250327062414-resolve-collection-index-collisions.ts @@ -0,0 +1,127 @@ +import "./bootstrap"; +import fractionalIndex from "fractional-index"; +import { Sequelize, Transaction } from "sequelize"; +import { Collection, Team } from "@server/models"; +import { sequelize } from "@server/storage/database"; + +const limit = 100; + +class CollectionIndexCollisionResolver { + private teamId: string; + private currDuplicateIndex: string | null = null; + private currDuplicateGroup: Collection[] = []; + private resolvedCollisionsCount: number = 0; + + constructor(teamId: string) { + this.teamId = teamId; + } + + public async process() { + await sequelize.transaction(async (transaction) => { + await this.processPage(0, transaction); + // edge case of last batch + await this.resolveDuplicates({ transaction }); + }); + } + + private async processPage( + page: number, + transaction: Transaction + ): Promise<void> { + console.log( + `Resolve collection index collisions for team ${this.teamId}… page ${page}` + ); + + const collections = await Collection.unscoped().findAll({ + where: { teamId: this.teamId }, + attributes: ["id", "index"], + limit, + offset: page * limit, + order: [ + Sequelize.literal('"collection"."index" collate "C"'), // ensure duplicates are in sequential order + ["updatedAt", "DESC"], // fallback as a tie breaker + ], + lock: Transaction.LOCK.UPDATE, + transaction, + }); + + if (!collections.length) { + return; + } + + let idx = 0; + + while (idx < collections.length) { + const collection = collections[idx]; + + if (collection.index === this.currDuplicateIndex) { + // still in the same duplicate group. + this.currDuplicateGroup.push(collection); + } else { + // current collection index is different from the previous one; resolve duplicates, if applicable. + await this.resolveDuplicates({ + nextCollection: collection, + transaction, + }); + // reset the duplicate index and group. + this.currDuplicateIndex = collection.index; + this.currDuplicateGroup = [collection]; + } + + idx++; + } + + return collections.length === limit + ? this.processPage(page + 1, transaction) + : undefined; + } + + private async resolveDuplicates({ + nextCollection, + transaction, + }: { + nextCollection?: Collection; + transaction: Transaction; + }) { + if (this.currDuplicateGroup.length <= 1) { + // no action needed when there aren't more than 1 item in a group. + return; + } + + let prevIndex = this.currDuplicateGroup[0].index; + const endIndex = nextCollection?.index ?? null; + + // First collection in a duplicate group can retain its index. + for (let idx = 1; idx < this.currDuplicateGroup.length; idx++) { + const collection = this.currDuplicateGroup[idx]; + const newIndex = fractionalIndex(prevIndex, endIndex); + + console.log(`New index for collection ${collection.id} = ${newIndex}`); + + collection.index = newIndex; + await collection.save({ silent: true, hooks: false, transaction }); + + prevIndex = newIndex; + } + + this.resolvedCollisionsCount += this.currDuplicateGroup.length - 1; + } +} + +export default async function main(exit = false) { + await Team.findAllInBatches<Team>({ batchLimit: 5 }, async (teams) => { + for (const team of teams) { + const resolver = new CollectionIndexCollisionResolver(team.id); + await resolver.process(); + } + }); + + if (exit) { + process.exit(0); + } +} + +// In the test suite we import the script rather than run via node CLI +if (process.env.NODE_ENV !== "test") { + void main(true); +} From 9c4b4f498997b958d948fca26274fdfabf00d2b4 Mon Sep 17 00:00:00 2001 From: Tom Moor <tom@getoutline.com> Date: Sun, 4 May 2025 18:16:38 -0400 Subject: [PATCH 48/64] fix: Chained scopes overwrite (#9133) --- server/models/Document.ts | 10 +++++- server/models/helpers/SearchHelper.ts | 32 ++++++++----------- server/routes/api/documents/documents.ts | 16 +++++----- .../api/groupMemberships/groupMemberships.ts | 14 ++++---- 4 files changed, 38 insertions(+), 34 deletions(-) diff --git a/server/models/Document.ts b/server/models/Document.ts index 1b4e89f3e0..fc8d822363 100644 --- a/server/models/Document.ts +++ b/server/models/Document.ts @@ -632,7 +632,14 @@ class Document extends ArchivableModel< return uniq(membershipUserIds); } - static withMembershipScope(userId: string, options?: FindOptions<Document>) { + static withMembershipScope( + userId: string, + scopeOrOptions?: string[] | FindOptions<Document>, + opts?: FindOptions<Document> + ) { + const scopes = Array.isArray(scopeOrOptions) ? scopeOrOptions : []; + const options = Array.isArray(scopeOrOptions) ? opts : scopeOrOptions; + return this.scope([ "defaultScope", { @@ -641,6 +648,7 @@ class Document extends ArchivableModel< { method: ["withMembership", userId, options?.paranoid], }, + ...scopes, ]); } diff --git a/server/models/helpers/SearchHelper.ts b/server/models/helpers/SearchHelper.ts index 026c0e21d7..4cd62b1639 100644 --- a/server/models/helpers/SearchHelper.ts +++ b/server/models/helpers/SearchHelper.ts @@ -182,16 +182,14 @@ export default class SearchHelper { }, ]; - return Document.withMembershipScope(user.id) - .scope("withDrafts") - .findAll({ - where, - subQuery: false, - order: [["updatedAt", "DESC"]], - include, - offset, - limit, - }); + return Document.withMembershipScope(user.id, ["withDrafts"]).findAll({ + where, + subQuery: false, + order: [["updatedAt", "DESC"]], + include, + offset, + limit, + }); } public static async searchCollectionsForUser( @@ -264,14 +262,12 @@ export default class SearchHelper { // Final query to get associated document data const [documents, count] = await Promise.all([ - Document.withMembershipScope(user.id) - .scope("withDrafts") - .findAll({ - where: { - teamId: user.teamId, - id: map(results, "id"), - }, - }), + Document.withMembershipScope(user.id, ["withDrafts"]).findAll({ + where: { + teamId: user.teamId, + id: map(results, "id"), + }, + }), results.length < limit && offset === 0 ? Promise.resolve(results.length) : countQuery, diff --git a/server/routes/api/documents/documents.ts b/server/routes/api/documents/documents.ts index 7c5e2248da..fbeae76463 100644 --- a/server/routes/api/documents/documents.ts +++ b/server/routes/api/documents/documents.ts @@ -535,14 +535,14 @@ router.post( delete where.updatedAt; } - const documents = await Document.withMembershipScope(user.id) - .scope("withDrafts") - .findAll({ - where, - order: [[sort, direction]], - offset: ctx.state.pagination.offset, - limit: ctx.state.pagination.limit, - }); + const documents = await Document.withMembershipScope(user.id, [ + "withDrafts", + ]).findAll({ + where, + order: [[sort, direction]], + offset: ctx.state.pagination.offset, + limit: ctx.state.pagination.limit, + }); const data = await Promise.all( documents.map((document) => presentDocument(ctx, document)) ); diff --git a/server/routes/api/groupMemberships/groupMemberships.ts b/server/routes/api/groupMemberships/groupMemberships.ts index f6917166a0..891c234634 100644 --- a/server/routes/api/groupMemberships/groupMemberships.ts +++ b/server/routes/api/groupMemberships/groupMemberships.ts @@ -58,13 +58,13 @@ router.post( const documentIds = memberships .map((p) => p.documentId) .filter(Boolean) as string[]; - const documents = await Document.withMembershipScope(userId) - .scope("withDrafts") - .findAll({ - where: { - id: documentIds, - }, - }); + const documents = await Document.withMembershipScope(userId, [ + "withDrafts", + ]).findAll({ + where: { + id: documentIds, + }, + }); const groups = uniqBy( memberships.map((membership) => membership.group), From 3f8bdf7ac20a7564f4721219f9156cee60453dbc Mon Sep 17 00:00:00 2001 From: Tom Moor <tom@getoutline.com> Date: Sun, 4 May 2025 18:37:01 -0400 Subject: [PATCH 49/64] Refactor withMembershipScope (#9134) --- server/models/Document.ts | 10 +++------- server/models/helpers/SearchHelper.ts | 6 ++++-- server/routes/api/documents/documents.ts | 6 +++--- server/routes/api/groupMemberships/groupMemberships.ts | 6 +++--- 4 files changed, 13 insertions(+), 15 deletions(-) diff --git a/server/models/Document.ts b/server/models/Document.ts index fc8d822363..851f25089e 100644 --- a/server/models/Document.ts +++ b/server/models/Document.ts @@ -634,21 +634,17 @@ class Document extends ArchivableModel< static withMembershipScope( userId: string, - scopeOrOptions?: string[] | FindOptions<Document>, - opts?: FindOptions<Document> + options?: FindOptions<Document> & { includeDrafts?: boolean } ) { - const scopes = Array.isArray(scopeOrOptions) ? scopeOrOptions : []; - const options = Array.isArray(scopeOrOptions) ? opts : scopeOrOptions; - return this.scope([ - "defaultScope", + options?.includeDrafts ? "withDrafts" : "defaultScope", + "withoutState", { method: ["withViews", userId], }, { method: ["withMembership", userId, options?.paranoid], }, - ...scopes, ]); } diff --git a/server/models/helpers/SearchHelper.ts b/server/models/helpers/SearchHelper.ts index 4cd62b1639..c63fd4bdc9 100644 --- a/server/models/helpers/SearchHelper.ts +++ b/server/models/helpers/SearchHelper.ts @@ -182,7 +182,9 @@ export default class SearchHelper { }, ]; - return Document.withMembershipScope(user.id, ["withDrafts"]).findAll({ + return Document.withMembershipScope(user.id, { + includeDrafts: true, + }).findAll({ where, subQuery: false, order: [["updatedAt", "DESC"]], @@ -262,7 +264,7 @@ export default class SearchHelper { // Final query to get associated document data const [documents, count] = await Promise.all([ - Document.withMembershipScope(user.id, ["withDrafts"]).findAll({ + Document.withMembershipScope(user.id, { includeDrafts: true }).findAll({ where: { teamId: user.teamId, id: map(results, "id"), diff --git a/server/routes/api/documents/documents.ts b/server/routes/api/documents/documents.ts index fbeae76463..8e626ed7a5 100644 --- a/server/routes/api/documents/documents.ts +++ b/server/routes/api/documents/documents.ts @@ -535,9 +535,9 @@ router.post( delete where.updatedAt; } - const documents = await Document.withMembershipScope(user.id, [ - "withDrafts", - ]).findAll({ + const documents = await Document.withMembershipScope(user.id, { + includeDrafts: true, + }).findAll({ where, order: [[sort, direction]], offset: ctx.state.pagination.offset, diff --git a/server/routes/api/groupMemberships/groupMemberships.ts b/server/routes/api/groupMemberships/groupMemberships.ts index 891c234634..72092b562d 100644 --- a/server/routes/api/groupMemberships/groupMemberships.ts +++ b/server/routes/api/groupMemberships/groupMemberships.ts @@ -58,9 +58,9 @@ router.post( const documentIds = memberships .map((p) => p.documentId) .filter(Boolean) as string[]; - const documents = await Document.withMembershipScope(userId, [ - "withDrafts", - ]).findAll({ + const documents = await Document.withMembershipScope(userId, { + includeDrafts: true, + }).findAll({ where: { id: documentIds, }, From 5a4b8c5faa1a2939253db74d9b421352fc7130b4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 5 May 2025 21:05:14 -0400 Subject: [PATCH 50/64] chore(deps): bump validator and @types/validator (#9138) Bumps [validator](https://github.com/validatorjs/validator.js) and [@types/validator](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/validator). These dependencies needed to be updated together. Updates `validator` from 13.12.0 to 13.15.0 - [Release notes](https://github.com/validatorjs/validator.js/releases) - [Changelog](https://github.com/validatorjs/validator.js/blob/master/CHANGELOG.md) - [Commits](https://github.com/validatorjs/validator.js/compare/13.12.0...13.15.0) Updates `@types/validator` from 13.12.1 to 13.15.0 - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/validator) --- updated-dependencies: - dependency-name: validator dependency-version: 13.15.0 dependency-type: direct:production update-type: version-update:semver-minor - dependency-name: "@types/validator" dependency-version: 13.15.0 dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 4 ++-- yarn.lock | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index 65e3e11bb7..6c86911706 100644 --- a/package.json +++ b/package.json @@ -248,7 +248,7 @@ "umzug": "^3.8.2", "utility-types": "^3.11.0", "uuid": "^8.3.2", - "validator": "13.12.0", + "validator": "13.15.0", "vaul": "^1.1.2", "vite": "^6.3.4", "vite-plugin-pwa": "^0.21.2", @@ -328,7 +328,7 @@ "@types/tmp": "^0.2.6", "@types/turndown": "^5.0.5", "@types/utf8": "^3.0.3", - "@types/validator": "^13.12.1", + "@types/validator": "^13.15.0", "@types/yauzl": "^2.10.3", "@typescript-eslint/eslint-plugin": "^6.21.0", "@typescript-eslint/parser": "^6.21.0", diff --git a/yarn.lock b/yarn.lock index 3e08adac8b..a7679861be 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5716,10 +5716,10 @@ resolved "https://registry.yarnpkg.com/@types/uuid/-/uuid-9.0.2.tgz#ede1d1b1e451548d44919dc226253e32a6952c4b" integrity "sha1-7eHRseRRVI1EkZ3CJiU+MqaVLEs= sha512-kNnC1GFBLuhImSnV7w4njQkUiJi0ZXUycu1rUaouPqiKlXkh77JKgdRnTAp1x5eBwcIwbtI+3otwzuIDEuDoxQ==" -"@types/validator@*", "@types/validator@^13.11.8", "@types/validator@^13.12.1", "@types/validator@^13.7.17": - version "13.12.1" - resolved "https://registry.yarnpkg.com/@types/validator/-/validator-13.12.1.tgz#8835d22f7e25b261e624d02a42fe4ade2c689a3c" - integrity sha512-w0URwf7BQb0rD/EuiG12KP0bailHKHP5YVviJG9zw3ykAokL0TuxU2TUqMB7EwZ59bDHYdeTIvjI5m0S7qHfOA== +"@types/validator@*", "@types/validator@^13.11.8", "@types/validator@^13.15.0", "@types/validator@^13.7.17": + version "13.15.0" + resolved "https://registry.yarnpkg.com/@types/validator/-/validator-13.15.0.tgz#d4643730536900190bb476a1dda0a4897c8881e2" + integrity sha512-nh7nrWhLr6CBq9ldtw0wx+z9wKnnv/uTVLA9g/3/TcOYxbpOSZE+MhKPmWqU+K0NvThjhv12uD8MuqijB0WzEA== "@types/ws@*", "@types/ws@^8.5.3": version "8.5.10" @@ -15655,10 +15655,10 @@ v8-to-istanbul@^9.0.1: "@types/istanbul-lib-coverage" "^2.0.1" convert-source-map "^1.6.0" -validator@13.12.0, validator@^13.9.0: - version "13.12.0" - resolved "https://registry.yarnpkg.com/validator/-/validator-13.12.0.tgz#7d78e76ba85504da3fee4fd1922b385914d4b35f" - integrity sha512-c1Q0mCiPlgdTVVVIJIrBuxNicYE+t/7oKeI9MWLj3fh/uq2Pxh/3eeWbVZ4OcGW1TUf53At0njHw5SMdA3tmMg== +validator@13.15.0, validator@^13.9.0: + version "13.15.0" + resolved "https://registry.yarnpkg.com/validator/-/validator-13.15.0.tgz#2dc7ce057e7513a55585109eec29b2c8e8c1aefd" + integrity sha512-36B2ryl4+oL5QxZ3AzD0t5SsMNGvTtQHpjgFO5tbNxfXbMFkY822ktCDe1MnlqV3301QQI9SLHDNJokDI+Z9pA== value-equal@^1.0.1: version "1.0.1" From 8ba83e217334c061e7c50bfd35a9a49a1a91b7fb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 5 May 2025 21:05:27 -0400 Subject: [PATCH 51/64] chore(deps): bump react-medium-image-zoom from 5.2.13 to 5.2.14 (#9137) Bumps [react-medium-image-zoom](https://github.com/rpearce/react-medium-image-zoom) from 5.2.13 to 5.2.14. - [Release notes](https://github.com/rpearce/react-medium-image-zoom/releases) - [Changelog](https://github.com/rpearce/react-medium-image-zoom/blob/main/CHANGELOG.md) - [Commits](https://github.com/rpearce/react-medium-image-zoom/compare/v5.2.13...v5.2.14) --- updated-dependencies: - dependency-name: react-medium-image-zoom dependency-version: 5.2.14 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 6c86911706..72f6350cd1 100644 --- a/package.json +++ b/package.json @@ -208,7 +208,7 @@ "react-helmet-async": "^2.0.5", "react-hook-form": "^7.54.2", "react-i18next": "^12.3.1", - "react-medium-image-zoom": "5.2.13", + "react-medium-image-zoom": "5.2.14", "react-merge-refs": "^2.1.1", "react-portal": "^4.3.0", "react-router-dom": "^5.3.4", diff --git a/yarn.lock b/yarn.lock index a7679861be..69b4dd7b78 100644 --- a/yarn.lock +++ b/yarn.lock @@ -13532,10 +13532,10 @@ react-is@^17.0.1: resolved "https://registry.yarnpkg.com/react-is/-/react-is-18.2.0.tgz#199431eeaaa2e09f86427efbb4f1473edb47609b" integrity "sha1-GZQx7qqi4J+GQn77tPFHPttHYJs= sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==" -react-medium-image-zoom@5.2.13: - version "5.2.13" - resolved "https://registry.yarnpkg.com/react-medium-image-zoom/-/react-medium-image-zoom-5.2.13.tgz#72e0aa6987585250efe3ad5fe963891d5ffe99a0" - integrity sha512-KcBL4OsoUQJgIFh6vQgt/6sRGqDy6bQBcsbhGD2tsy4B5Pw3dWrboocVOyIm76RRALEZ6Qwp3EDvIvfEv0m5sg== +react-medium-image-zoom@5.2.14: + version "5.2.14" + resolved "https://registry.yarnpkg.com/react-medium-image-zoom/-/react-medium-image-zoom-5.2.14.tgz#87032d079fce4a21a17770d6709f739872580906" + integrity sha512-nfTVYcAUnBzXQpPDcZL+cG/e6UceYUIG+zDcnemL7jtAqbJjVVkA85RgneGtJeni12dTyiRPZVM6Szkmwd/o8w== react-merge-refs@^2.1.1: version "2.1.1" From 6b76a898fa2b1f8c46066179f138f8bc4558283c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 5 May 2025 21:05:41 -0400 Subject: [PATCH 52/64] chore(deps): bump the babel group with 9 updates (#9139) Bumps the babel group with 9 updates: | Package | From | To | | --- | --- | --- | | [@babel/core](https://github.com/babel/babel/tree/HEAD/packages/babel-core) | `7.26.10` | `7.27.1` | | [@babel/plugin-proposal-decorators](https://github.com/babel/babel/tree/HEAD/packages/babel-plugin-proposal-decorators) | `7.25.9` | `7.27.1` | | [@babel/plugin-transform-class-properties](https://github.com/babel/babel/tree/HEAD/packages/babel-plugin-transform-class-properties) | `7.25.9` | `7.27.1` | | [@babel/plugin-transform-destructuring](https://github.com/babel/babel/tree/HEAD/packages/babel-plugin-transform-destructuring) | `7.25.9` | `7.27.1` | | [@babel/plugin-transform-regenerator](https://github.com/babel/babel/tree/HEAD/packages/babel-plugin-transform-regenerator) | `7.27.0` | `7.27.1` | | [@babel/preset-env](https://github.com/babel/babel/tree/HEAD/packages/babel-preset-env) | `7.26.9` | `7.27.1` | | [@babel/preset-react](https://github.com/babel/babel/tree/HEAD/packages/babel-preset-react) | `7.26.3` | `7.27.1` | | [@babel/cli](https://github.com/babel/babel/tree/HEAD/packages/babel-cli) | `7.27.0` | `7.27.1` | | [@babel/preset-typescript](https://github.com/babel/babel/tree/HEAD/packages/babel-preset-typescript) | `7.27.0` | `7.27.1` | Updates `@babel/core` from 7.26.10 to 7.27.1 - [Release notes](https://github.com/babel/babel/releases) - [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md) - [Commits](https://github.com/babel/babel/commits/v7.27.1/packages/babel-core) Updates `@babel/plugin-proposal-decorators` from 7.25.9 to 7.27.1 - [Release notes](https://github.com/babel/babel/releases) - [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md) - [Commits](https://github.com/babel/babel/commits/v7.27.1/packages/babel-plugin-proposal-decorators) Updates `@babel/plugin-transform-class-properties` from 7.25.9 to 7.27.1 - [Release notes](https://github.com/babel/babel/releases) - [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md) - [Commits](https://github.com/babel/babel/commits/v7.27.1/packages/babel-plugin-transform-class-properties) Updates `@babel/plugin-transform-destructuring` from 7.25.9 to 7.27.1 - [Release notes](https://github.com/babel/babel/releases) - [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md) - [Commits](https://github.com/babel/babel/commits/v7.27.1/packages/babel-plugin-transform-destructuring) Updates `@babel/plugin-transform-regenerator` from 7.27.0 to 7.27.1 - [Release notes](https://github.com/babel/babel/releases) - [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md) - [Commits](https://github.com/babel/babel/commits/v7.27.1/packages/babel-plugin-transform-regenerator) Updates `@babel/preset-env` from 7.26.9 to 7.27.1 - [Release notes](https://github.com/babel/babel/releases) - [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md) - [Commits](https://github.com/babel/babel/commits/v7.27.1/packages/babel-preset-env) Updates `@babel/preset-react` from 7.26.3 to 7.27.1 - [Release notes](https://github.com/babel/babel/releases) - [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md) - [Commits](https://github.com/babel/babel/commits/v7.27.1/packages/babel-preset-react) Updates `@babel/cli` from 7.27.0 to 7.27.1 - [Release notes](https://github.com/babel/babel/releases) - [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md) - [Commits](https://github.com/babel/babel/commits/v7.27.1/packages/babel-cli) Updates `@babel/preset-typescript` from 7.27.0 to 7.27.1 - [Release notes](https://github.com/babel/babel/releases) - [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md) - [Commits](https://github.com/babel/babel/commits/v7.27.1/packages/babel-preset-typescript) --- updated-dependencies: - dependency-name: "@babel/core" dependency-version: 7.27.1 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: babel - dependency-name: "@babel/plugin-proposal-decorators" dependency-version: 7.27.1 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: babel - dependency-name: "@babel/plugin-transform-class-properties" dependency-version: 7.27.1 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: babel - dependency-name: "@babel/plugin-transform-destructuring" dependency-version: 7.27.1 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: babel - dependency-name: "@babel/plugin-transform-regenerator" dependency-version: 7.27.1 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: babel - dependency-name: "@babel/preset-env" dependency-version: 7.27.1 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: babel - dependency-name: "@babel/preset-react" dependency-version: 7.27.1 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: babel - dependency-name: "@babel/cli" dependency-version: 7.27.1 dependency-type: direct:development update-type: version-update:semver-patch dependency-group: babel - dependency-name: "@babel/preset-typescript" dependency-version: 7.27.1 dependency-type: direct:development update-type: version-update:semver-patch dependency-group: babel ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 18 +- yarn.lock | 1265 +++++++++++++++++++++++++------------------------- 2 files changed, 653 insertions(+), 630 deletions(-) diff --git a/package.json b/package.json index 72f6350cd1..ed2b9544e8 100644 --- a/package.json +++ b/package.json @@ -53,13 +53,13 @@ "@aws-sdk/s3-presigned-post": "3.797.0", "@aws-sdk/s3-request-presigner": "3.797.0", "@aws-sdk/signature-v4-crt": "^3.796.0", - "@babel/core": "^7.26.10", - "@babel/plugin-proposal-decorators": "^7.25.9", - "@babel/plugin-transform-class-properties": "^7.25.9", - "@babel/plugin-transform-destructuring": "^7.25.9", - "@babel/plugin-transform-regenerator": "^7.27.0", - "@babel/preset-env": "^7.26.9", - "@babel/preset-react": "^7.26.3", + "@babel/core": "^7.27.1", + "@babel/plugin-proposal-decorators": "^7.27.1", + "@babel/plugin-transform-class-properties": "^7.27.1", + "@babel/plugin-transform-destructuring": "^7.27.1", + "@babel/plugin-transform-regenerator": "^7.27.1", + "@babel/preset-env": "^7.27.1", + "@babel/preset-react": "^7.27.1", "@benrbray/prosemirror-math": "^0.2.2", "@bull-board/api": "^6.7.10", "@bull-board/koa": "^6.7.10", @@ -262,8 +262,8 @@ "zod": "^3.24.2" }, "devDependencies": { - "@babel/cli": "^7.27.0", - "@babel/preset-typescript": "^7.27.0", + "@babel/cli": "^7.27.1", + "@babel/preset-typescript": "^7.27.1", "@faker-js/faker": "^8.4.1", "@relative-ci/agent": "^4.3.0", "@testing-library/react": "^12.0.0", diff --git a/yarn.lock b/yarn.lock index 69b4dd7b78..e7b1a7cf05 100644 --- a/yarn.lock +++ b/yarn.lock @@ -675,10 +675,10 @@ "@smithy/types" "^4.2.0" tslib "^2.6.2" -"@babel/cli@^7.27.0": - version "7.27.0" - resolved "https://registry.yarnpkg.com/@babel/cli/-/cli-7.27.0.tgz#076603b25fc7dd88298ea94ab249c8237c7e71cc" - integrity sha512-bZfxn8DRxwiVzDO5CEeV+7IqXeCkzI4yYnrQbpwjT76CUyossQc6RYE7n+xfm0/2k40lPaCpW0FhxYs7EBAetw== +"@babel/cli@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/cli/-/cli-7.27.1.tgz#699f03267f3fb6625b6de527cd8f2bda7f6371d9" + integrity sha512-uW6vyhrV/YB9f3QFyPX2sMmDTID853+f3rOsTvH9q/FsL+e40GKqdMy5fdnGBvXsk5WiWJuMhR6sl03/x+XqqA== dependencies: "@jridgewell/trace-mapping" "^0.3.25" commander "^6.2.0" @@ -691,48 +691,48 @@ "@nicolo-ribaudo/chokidar-2" "2.1.8-no-fsevents.3" chokidar "^3.6.0" -"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.10.4", "@babel/code-frame@^7.12.13", "@babel/code-frame@^7.26.2": - version "7.26.2" - resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.26.2.tgz#4b5fab97d33338eff916235055f0ebc21e573a85" - integrity sha512-RJlIHRueQgwWitWgF8OdFYGZX328Ax5BCemNGlqHfplnRT9ESi8JkFlvaVYbS+UubVY6dpv87Fs2u5M29iNFVQ== +"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.10.4", "@babel/code-frame@^7.12.13", "@babel/code-frame@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.27.1.tgz#200f715e66d52a23b221a9435534a91cc13ad5be" + integrity sha512-cjQ7ZlQ0Mv3b47hABuTevyTuYN4i+loJKGeV9flcCgIK37cCXRh+L1bd3iBHlynerhQ7BhCkn2BPbQUL+rGqFg== dependencies: - "@babel/helper-validator-identifier" "^7.25.9" + "@babel/helper-validator-identifier" "^7.27.1" js-tokens "^4.0.0" - picocolors "^1.0.0" + picocolors "^1.1.1" -"@babel/compat-data@^7.13.11", "@babel/compat-data@^7.22.6", "@babel/compat-data@^7.26.5", "@babel/compat-data@^7.26.8": - version "7.26.8" - resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.26.8.tgz#821c1d35641c355284d4a870b8a4a7b0c141e367" - integrity sha512-oH5UPLMWR3L2wEFLnFJ1TZXqHufiTKAiLfqw5zkhS4dKXLJ10yVztfil/twG8EDTA4F/tvVNw9nOl4ZMslB8rQ== +"@babel/compat-data@^7.13.11", "@babel/compat-data@^7.22.6", "@babel/compat-data@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.27.1.tgz#db7cf122745e0a332c44e847ddc4f5e5221a43f6" + integrity sha512-Q+E+rd/yBzNQhXkG+zQnF58e4zoZfBedaxwzPmicKsiK3nt8iJYrSrDbjwFFDGC4f+rPafqRaPH6TsDoSvMf7A== -"@babel/core@^7.11.6", "@babel/core@^7.12.3", "@babel/core@^7.20.12", "@babel/core@^7.24.4", "@babel/core@^7.26.10": - version "7.26.10" - resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.26.10.tgz#5c876f83c8c4dcb233ee4b670c0606f2ac3000f9" - integrity sha512-vMqyb7XCDMPvJFFOaT9kxtiRh42GwlZEg1/uIgtZshS5a/8OaduUfCi7kynKgc3Tw/6Uo2D+db9qBttghhmxwQ== +"@babel/core@^7.11.6", "@babel/core@^7.12.3", "@babel/core@^7.20.12", "@babel/core@^7.24.4", "@babel/core@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.27.1.tgz#89de51e86bd12246003e3524704c49541b16c3e6" + integrity sha512-IaaGWsQqfsQWVLqMn9OB92MNN7zukfVA4s7KKAI0KfrrDsZ0yhi5uV4baBuLuN7n3vsZpwP8asPPcVwApxvjBQ== dependencies: "@ampproject/remapping" "^2.2.0" - "@babel/code-frame" "^7.26.2" - "@babel/generator" "^7.26.10" - "@babel/helper-compilation-targets" "^7.26.5" - "@babel/helper-module-transforms" "^7.26.0" - "@babel/helpers" "^7.26.10" - "@babel/parser" "^7.26.10" - "@babel/template" "^7.26.9" - "@babel/traverse" "^7.26.10" - "@babel/types" "^7.26.10" + "@babel/code-frame" "^7.27.1" + "@babel/generator" "^7.27.1" + "@babel/helper-compilation-targets" "^7.27.1" + "@babel/helper-module-transforms" "^7.27.1" + "@babel/helpers" "^7.27.1" + "@babel/parser" "^7.27.1" + "@babel/template" "^7.27.1" + "@babel/traverse" "^7.27.1" + "@babel/types" "^7.27.1" convert-source-map "^2.0.0" debug "^4.1.0" gensync "^1.0.0-beta.2" json5 "^2.2.3" semver "^6.3.1" -"@babel/generator@^7.26.10", "@babel/generator@^7.27.0", "@babel/generator@^7.7.2": - version "7.27.0" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.27.0.tgz#764382b5392e5b9aff93cadb190d0745866cbc2c" - integrity sha512-VybsKvpiN1gU1sdMZIp7FcqphVVKEwcuj02x73uvcHE0PTihx1nlBcowYWhDwjpoAXRv43+gDzyggGnn1XZhVw== +"@babel/generator@^7.27.1", "@babel/generator@^7.7.2": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.27.1.tgz#862d4fad858f7208edd487c28b58144036b76230" + integrity sha512-UnJfnIpc/+JO0/+KRVQNGU+y5taA5vCbwN8+azkX6beii/ZF+enZJSOKo11ZSzGJjlNfJHfQtmQT8H+9TXPG2w== dependencies: - "@babel/parser" "^7.27.0" - "@babel/types" "^7.27.0" + "@babel/parser" "^7.27.1" + "@babel/types" "^7.27.1" "@jridgewell/gen-mapping" "^0.3.5" "@jridgewell/trace-mapping" "^0.3.25" jsesc "^3.0.2" @@ -744,31 +744,38 @@ dependencies: "@babel/types" "^7.25.9" -"@babel/helper-compilation-targets@^7.13.0", "@babel/helper-compilation-targets@^7.22.6", "@babel/helper-compilation-targets@^7.25.9", "@babel/helper-compilation-targets@^7.26.5": - version "7.26.5" - resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.26.5.tgz#75d92bb8d8d51301c0d49e52a65c9a7fe94514d8" - integrity sha512-IXuyn5EkouFJscIDuFF5EsiSolseme1s0CZB+QxVugqJLYmKdxI1VfIBOst0SUu4rnk2Z7kqTwmoO1lp3HIfnA== +"@babel/helper-annotate-as-pure@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.27.1.tgz#4345d81a9a46a6486e24d069469f13e60445c05d" + integrity sha512-WnuuDILl9oOBbKnb4L+DyODx7iC47XfzmNCpTttFsSp6hTG7XZxu60+4IO+2/hPfcGOoKbFiwoI/+zwARbNQow== dependencies: - "@babel/compat-data" "^7.26.5" - "@babel/helper-validator-option" "^7.25.9" + "@babel/types" "^7.27.1" + +"@babel/helper-compilation-targets@^7.13.0", "@babel/helper-compilation-targets@^7.22.6", "@babel/helper-compilation-targets@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.27.1.tgz#eac1096c7374f161e4f33fc8ae38f4ddf122087a" + integrity sha512-2YaDd/Rd9E598B5+WIc8wJPmWETiiJXFYVE60oX8FDohv7rAUU3CQj+A1MgeEmcsk2+dQuEjIe/GDvig0SqL4g== + dependencies: + "@babel/compat-data" "^7.27.1" + "@babel/helper-validator-option" "^7.27.1" browserslist "^4.24.0" lru-cache "^5.1.1" semver "^6.3.1" -"@babel/helper-create-class-features-plugin@^7.25.9", "@babel/helper-create-class-features-plugin@^7.27.0": - version "7.27.0" - resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.27.0.tgz#518fad6a307c6a96f44af14912b2c20abe9bfc30" - integrity sha512-vSGCvMecvFCd/BdpGlhpXYNhhC4ccxyvQWpbGL4CWbvfEoLFWUZuSuf7s9Aw70flgQF+6vptvgK2IfOnKlRmBg== +"@babel/helper-create-class-features-plugin@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.27.1.tgz#5bee4262a6ea5ddc852d0806199eb17ca3de9281" + integrity sha512-QwGAmuvM17btKU5VqXfb+Giw4JcN0hjuufz3DYnpeVDvZLAObloM77bhMXiqry3Iio+Ai4phVRDwl6WU10+r5A== dependencies: - "@babel/helper-annotate-as-pure" "^7.25.9" - "@babel/helper-member-expression-to-functions" "^7.25.9" - "@babel/helper-optimise-call-expression" "^7.25.9" - "@babel/helper-replace-supers" "^7.26.5" - "@babel/helper-skip-transparent-expression-wrappers" "^7.25.9" - "@babel/traverse" "^7.27.0" + "@babel/helper-annotate-as-pure" "^7.27.1" + "@babel/helper-member-expression-to-functions" "^7.27.1" + "@babel/helper-optimise-call-expression" "^7.27.1" + "@babel/helper-replace-supers" "^7.27.1" + "@babel/helper-skip-transparent-expression-wrappers" "^7.27.1" + "@babel/traverse" "^7.27.1" semver "^6.3.1" -"@babel/helper-create-regexp-features-plugin@^7.18.6", "@babel/helper-create-regexp-features-plugin@^7.25.9": +"@babel/helper-create-regexp-features-plugin@^7.18.6": version "7.26.3" resolved "https://registry.yarnpkg.com/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.26.3.tgz#5169756ecbe1d95f7866b90bb555b022595302a0" integrity sha512-G7ZRb40uUgdKOQqPLjfD12ZmGA54PzqDFUv2BKImnC9QIfGhIHKvVML0oN8IUiDq4iRqpq74ABpvOaerfWdong== @@ -777,6 +784,15 @@ regexpu-core "^6.2.0" semver "^6.3.1" +"@babel/helper-create-regexp-features-plugin@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.27.1.tgz#05b0882d97ba1d4d03519e4bce615d70afa18c53" + integrity sha512-uVDC72XVf8UbrH5qQTc18Agb8emwjTiZrQE11Nv3CuBEZmVvTwwE9CBUEvHku06gQCAyYf8Nv6ja1IN+6LMbxQ== + dependencies: + "@babel/helper-annotate-as-pure" "^7.27.1" + regexpu-core "^6.2.0" + semver "^6.3.1" + "@babel/helper-define-polyfill-provider@^0.2.2", "@babel/helper-define-polyfill-provider@^0.2.4": version "0.2.4" resolved "https://registry.yarnpkg.com/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.2.4.tgz#8867aed79d3ea6cade40f801efb7ac5c66916b10" @@ -802,15 +818,15 @@ lodash.debounce "^4.0.8" resolve "^1.14.2" -"@babel/helper-member-expression-to-functions@^7.25.9": - version "7.25.9" - resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.25.9.tgz#9dfffe46f727005a5ea29051ac835fb735e4c1a3" - integrity sha512-wbfdZ9w5vk0C0oyHqAJbc62+vet5prjj01jjJ8sKn3j9h3MQQlflEdXYvuqRWjHnM12coDEqiC1IRCi0U/EKwQ== +"@babel/helper-member-expression-to-functions@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.27.1.tgz#ea1211276be93e798ce19037da6f06fbb994fa44" + integrity sha512-E5chM8eWjTp/aNoVpcbfM7mLxu9XGLWYise2eBKGQomAk/Mb4XoxyqXTZbuTohbsl8EKqdlMhnDI2CCLfcs9wA== dependencies: - "@babel/traverse" "^7.25.9" - "@babel/types" "^7.25.9" + "@babel/traverse" "^7.27.1" + "@babel/types" "^7.27.1" -"@babel/helper-module-imports@^7.0.0", "@babel/helper-module-imports@^7.10.4", "@babel/helper-module-imports@^7.12.13", "@babel/helper-module-imports@^7.14.5", "@babel/helper-module-imports@^7.22.5", "@babel/helper-module-imports@^7.25.9": +"@babel/helper-module-imports@^7.0.0", "@babel/helper-module-imports@^7.10.4", "@babel/helper-module-imports@^7.12.13", "@babel/helper-module-imports@^7.14.5", "@babel/helper-module-imports@^7.22.5": version "7.25.9" resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.25.9.tgz#e7f8d20602ebdbf9ebbea0a0751fb0f2a4141715" integrity sha512-tnUA4RsrmflIM6W6RFTLFSXITtl0wKjgpnLgXyowocVPrbYrLUXSBXDgTs8BlbmIzIdlBySRQjINYs2BAkiLtw== @@ -818,139 +834,147 @@ "@babel/traverse" "^7.25.9" "@babel/types" "^7.25.9" -"@babel/helper-module-transforms@^7.25.9", "@babel/helper-module-transforms@^7.26.0": - version "7.26.0" - resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.26.0.tgz#8ce54ec9d592695e58d84cd884b7b5c6a2fdeeae" - integrity sha512-xO+xu6B5K2czEnQye6BHA7DolFFmS3LB7stHZFaOLb1pAwO1HWLS8fXA+eh0A2yIvltPVmx3eNNDBJA2SLHXFw== +"@babel/helper-module-imports@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.27.1.tgz#7ef769a323e2655e126673bb6d2d6913bbead204" + integrity sha512-0gSFWUPNXNopqtIPQvlD5WgXYI5GY2kP2cCvoT8kczjbfcfuIljTbcWrulD1CIPIX2gt1wghbDy08yE1p+/r3w== dependencies: - "@babel/helper-module-imports" "^7.25.9" - "@babel/helper-validator-identifier" "^7.25.9" - "@babel/traverse" "^7.25.9" + "@babel/traverse" "^7.27.1" + "@babel/types" "^7.27.1" -"@babel/helper-optimise-call-expression@^7.25.9": - version "7.25.9" - resolved "https://registry.yarnpkg.com/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.25.9.tgz#3324ae50bae7e2ab3c33f60c9a877b6a0146b54e" - integrity sha512-FIpuNaz5ow8VyrYcnXQTDRGvV6tTjkNtCK/RYNDXGSLlUD6cBuQTSw43CShGxjvfBTfcUA/r6UhUCbtYqkhcuQ== +"@babel/helper-module-transforms@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.27.1.tgz#e1663b8b71d2de948da5c4fb2a20ca4f3ec27a6f" + integrity sha512-9yHn519/8KvTU5BjTVEEeIM3w9/2yXNKoD82JifINImhpKkARMJKPP59kLo+BafpdN5zgNeIcS4jsGDmd3l58g== dependencies: - "@babel/types" "^7.25.9" + "@babel/helper-module-imports" "^7.27.1" + "@babel/helper-validator-identifier" "^7.27.1" + "@babel/traverse" "^7.27.1" -"@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.10.4", "@babel/helper-plugin-utils@^7.12.13", "@babel/helper-plugin-utils@^7.13.0", "@babel/helper-plugin-utils@^7.14.5", "@babel/helper-plugin-utils@^7.18.6", "@babel/helper-plugin-utils@^7.19.0", "@babel/helper-plugin-utils@^7.22.5", "@babel/helper-plugin-utils@^7.25.9", "@babel/helper-plugin-utils@^7.26.5", "@babel/helper-plugin-utils@^7.8.0": - version "7.26.5" - resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.26.5.tgz#18580d00c9934117ad719392c4f6585c9333cc35" - integrity sha512-RS+jZcRdZdRFzMyr+wcsaqOmld1/EqTghfaBGQQd/WnRdzdlvSZ//kF7U8VQTxf1ynZ4cjUcYgjVGx13ewNPMg== - -"@babel/helper-remap-async-to-generator@^7.25.9": - version "7.25.9" - resolved "https://registry.yarnpkg.com/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.25.9.tgz#e53956ab3d5b9fb88be04b3e2f31b523afd34b92" - integrity sha512-IZtukuUeBbhgOcaW2s06OXTzVNJR0ybm4W5xC1opWFFJMZbwRj5LCk+ByYH7WdZPZTt8KnFwA8pvjN2yqcPlgw== +"@babel/helper-optimise-call-expression@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.27.1.tgz#c65221b61a643f3e62705e5dd2b5f115e35f9200" + integrity sha512-URMGH08NzYFhubNSGJrpUEphGKQwMQYBySzat5cAByY1/YgIRkULnIy3tAMeszlL/so2HbeilYloUmSpd7GdVw== dependencies: - "@babel/helper-annotate-as-pure" "^7.25.9" - "@babel/helper-wrap-function" "^7.25.9" - "@babel/traverse" "^7.25.9" + "@babel/types" "^7.27.1" -"@babel/helper-replace-supers@^7.25.9", "@babel/helper-replace-supers@^7.26.5": - version "7.26.5" - resolved "https://registry.yarnpkg.com/@babel/helper-replace-supers/-/helper-replace-supers-7.26.5.tgz#6cb04e82ae291dae8e72335dfe438b0725f14c8d" - integrity sha512-bJ6iIVdYX1YooY2X7w1q6VITt+LnUILtNk7zT78ykuwStx8BauCzxvFqFaHjOpW1bVnSUM1PN1f0p5P21wHxvg== +"@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.10.4", "@babel/helper-plugin-utils@^7.12.13", "@babel/helper-plugin-utils@^7.13.0", "@babel/helper-plugin-utils@^7.14.5", "@babel/helper-plugin-utils@^7.18.6", "@babel/helper-plugin-utils@^7.19.0", "@babel/helper-plugin-utils@^7.22.5", "@babel/helper-plugin-utils@^7.25.9", "@babel/helper-plugin-utils@^7.27.1", "@babel/helper-plugin-utils@^7.8.0": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.27.1.tgz#ddb2f876534ff8013e6c2b299bf4d39b3c51d44c" + integrity sha512-1gn1Up5YXka3YYAHGKpbideQ5Yjf1tDa9qYcgysz+cNCXukyLl6DjPXhD3VRwSb8c0J9tA4b2+rHEZtc6R0tlw== + +"@babel/helper-remap-async-to-generator@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.27.1.tgz#4601d5c7ce2eb2aea58328d43725523fcd362ce6" + integrity sha512-7fiA521aVw8lSPeI4ZOD3vRFkoqkJcS+z4hFo82bFSH/2tNd6eJ5qCVMS5OzDmZh/kaHQeBaeyxK6wljcPtveA== dependencies: - "@babel/helper-member-expression-to-functions" "^7.25.9" - "@babel/helper-optimise-call-expression" "^7.25.9" - "@babel/traverse" "^7.26.5" + "@babel/helper-annotate-as-pure" "^7.27.1" + "@babel/helper-wrap-function" "^7.27.1" + "@babel/traverse" "^7.27.1" -"@babel/helper-skip-transparent-expression-wrappers@^7.25.9": - version "7.25.9" - resolved "https://registry.yarnpkg.com/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.25.9.tgz#0b2e1b62d560d6b1954893fd2b705dc17c91f0c9" - integrity sha512-K4Du3BFa3gvyhzgPcntrkDgZzQaq6uozzcpGbOO1OEJaI+EJdqWIMTLgFgQf6lrfiDFo5FU+BxKepI9RmZqahA== +"@babel/helper-replace-supers@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/helper-replace-supers/-/helper-replace-supers-7.27.1.tgz#b1ed2d634ce3bdb730e4b52de30f8cccfd692bc0" + integrity sha512-7EHz6qDZc8RYS5ElPoShMheWvEgERonFCs7IAonWLLUTXW59DP14bCZt89/GKyreYn8g3S83m21FelHKbeDCKA== dependencies: - "@babel/traverse" "^7.25.9" - "@babel/types" "^7.25.9" + "@babel/helper-member-expression-to-functions" "^7.27.1" + "@babel/helper-optimise-call-expression" "^7.27.1" + "@babel/traverse" "^7.27.1" -"@babel/helper-string-parser@^7.25.9": - version "7.25.9" - resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.25.9.tgz#1aabb72ee72ed35789b4bbcad3ca2862ce614e8c" - integrity sha512-4A/SCr/2KLd5jrtOMFzaKjVtAei3+2r/NChoBNoZ3EyP/+GlhoaEGoWOZUmFmoITP7zOJyHIMm+DYRd8o3PvHA== - -"@babel/helper-validator-identifier@^7.25.9": - version "7.25.9" - resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.25.9.tgz#24b64e2c3ec7cd3b3c547729b8d16871f22cbdc7" - integrity sha512-Ed61U6XJc3CVRfkERJWDz4dJwKe7iLmmJsbOGu9wSloNSFttHV0I8g6UAgb7qnK5ly5bGLPd4oXZlxCdANBOWQ== - -"@babel/helper-validator-option@^7.25.9": - version "7.25.9" - resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.25.9.tgz#86e45bd8a49ab7e03f276577f96179653d41da72" - integrity sha512-e/zv1co8pp55dNdEcCynfj9X7nyUKUXoUEwfXqaZt0omVOmDe9oOTdKStH4GmAw6zxMFs50ZayuMfHDKlO7Tfw== - -"@babel/helper-wrap-function@^7.25.9": - version "7.25.9" - resolved "https://registry.yarnpkg.com/@babel/helper-wrap-function/-/helper-wrap-function-7.25.9.tgz#d99dfd595312e6c894bd7d237470025c85eea9d0" - integrity sha512-ETzz9UTjQSTmw39GboatdymDq4XIQbR8ySgVrylRhPOFpsd+JrKHIuF0de7GCWmem+T4uC5z7EZguod7Wj4A4g== +"@babel/helper-skip-transparent-expression-wrappers@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.27.1.tgz#62bb91b3abba8c7f1fec0252d9dbea11b3ee7a56" + integrity sha512-Tub4ZKEXqbPjXgWLl2+3JpQAYBJ8+ikpQ2Ocj/q/r0LwE3UhENh7EUabyHjz2kCEsrRY83ew2DQdHluuiDQFzg== dependencies: - "@babel/template" "^7.25.9" - "@babel/traverse" "^7.25.9" - "@babel/types" "^7.25.9" + "@babel/traverse" "^7.27.1" + "@babel/types" "^7.27.1" -"@babel/helpers@^7.26.10": - version "7.27.0" - resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.27.0.tgz#53d156098defa8243eab0f32fa17589075a1b808" - integrity sha512-U5eyP/CTFPuNE3qk+WZMxFkp/4zUzdceQlfzf7DdGdhp+Fezd7HD+i8Y24ZuTMKX3wQBld449jijbGq6OdGNQg== - dependencies: - "@babel/template" "^7.27.0" - "@babel/types" "^7.27.0" +"@babel/helper-string-parser@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.27.1.tgz#54da796097ab19ce67ed9f88b47bb2ec49367687" + integrity sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA== -"@babel/parser@^7.1.0", "@babel/parser@^7.14.7", "@babel/parser@^7.26.10", "@babel/parser@^7.27.0", "@babel/parser@^7.7.0": - version "7.27.0" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.27.0.tgz#3d7d6ee268e41d2600091cbd4e145ffee85a44ec" - integrity sha512-iaepho73/2Pz7w2eMS0Q5f83+0RKI7i4xmiYeBmDzfRVbQtTOG7Ts0S4HzJVsTMGI9keU8rNfuZr8DKfSt7Yyg== - dependencies: - "@babel/types" "^7.27.0" +"@babel/helper-validator-identifier@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.27.1.tgz#a7054dcc145a967dd4dc8fee845a57c1316c9df8" + integrity sha512-D2hP9eA+Sqx1kBZgzxZh0y1trbuU+JoDkiEwqhQ36nodYqJwyEIhPSdMNd7lOm/4io72luTPWH20Yda0xOuUow== -"@babel/plugin-bugfix-firefox-class-in-computed-class-key@^7.25.9": - version "7.25.9" - resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-firefox-class-in-computed-class-key/-/plugin-bugfix-firefox-class-in-computed-class-key-7.25.9.tgz#cc2e53ebf0a0340777fff5ed521943e253b4d8fe" - integrity sha512-ZkRyVkThtxQ/J6nv3JFYv1RYY+JT5BvU0y3k5bWrmuG4woXypRa4PXmm9RhOwodRkYFWqC0C0cqcJ4OqR7kW+g== - dependencies: - "@babel/helper-plugin-utils" "^7.25.9" - "@babel/traverse" "^7.25.9" +"@babel/helper-validator-option@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.27.1.tgz#fa52f5b1e7db1ab049445b421c4471303897702f" + integrity sha512-YvjJow9FxbhFFKDSuFnVCe2WxXk1zWc22fFePVNEaWJEu8IrZVlda6N0uHwzZrUM1il7NC9Mlp4MaJYbYd9JSg== -"@babel/plugin-bugfix-safari-class-field-initializer-scope@^7.25.9": - version "7.25.9" - resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-safari-class-field-initializer-scope/-/plugin-bugfix-safari-class-field-initializer-scope-7.25.9.tgz#af9e4fb63ccb8abcb92375b2fcfe36b60c774d30" - integrity sha512-MrGRLZxLD/Zjj0gdU15dfs+HH/OXvnw/U4jJD8vpcP2CJQapPEv1IWwjc/qMg7ItBlPwSv1hRBbb7LeuANdcnw== +"@babel/helper-wrap-function@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/helper-wrap-function/-/helper-wrap-function-7.27.1.tgz#b88285009c31427af318d4fe37651cd62a142409" + integrity sha512-NFJK2sHUvrjo8wAU/nQTWU890/zB2jj0qBcCbZbbf+005cAsv6tMjXz31fBign6M5ov1o0Bllu+9nbqkfsjjJQ== dependencies: - "@babel/helper-plugin-utils" "^7.25.9" + "@babel/template" "^7.27.1" + "@babel/traverse" "^7.27.1" + "@babel/types" "^7.27.1" -"@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@^7.25.9": - version "7.25.9" - resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/-/plugin-bugfix-safari-id-destructuring-collision-in-function-expression-7.25.9.tgz#e8dc26fcd616e6c5bf2bd0d5a2c151d4f92a9137" - integrity sha512-2qUwwfAFpJLZqxd02YW9btUCZHl+RFvdDkNfZwaIJrvB8Tesjsk8pEQkTvGwZXLqXUx/2oyY3ySRhm6HOXuCug== +"@babel/helpers@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.27.1.tgz#ffc27013038607cdba3288e692c3611c06a18aa4" + integrity sha512-FCvFTm0sWV8Fxhpp2McP5/W53GPllQ9QeQ7SiqGWjMf/LVG07lFa5+pgK05IRhVwtvafT22KF+ZSnM9I545CvQ== dependencies: - "@babel/helper-plugin-utils" "^7.25.9" + "@babel/template" "^7.27.1" + "@babel/types" "^7.27.1" -"@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@^7.25.9": - version "7.25.9" - resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining/-/plugin-bugfix-v8-spread-parameters-in-optional-chaining-7.25.9.tgz#807a667f9158acac6f6164b4beb85ad9ebc9e1d1" - integrity sha512-6xWgLZTJXwilVjlnV7ospI3xi+sl8lN8rXXbBD6vYn3UYDlGsag8wrZkKcSI8G6KgqKP7vNFaDgeDnfAABq61g== +"@babel/parser@^7.1.0", "@babel/parser@^7.14.7", "@babel/parser@^7.27.1", "@babel/parser@^7.7.0": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.27.1.tgz#c55d5bed74449d1223701f1869b9ee345cc94cc9" + integrity sha512-I0dZ3ZpCrJ1c04OqlNsQcKiZlsrXf/kkE4FXzID9rIOYICsAbA8mMDzhW/luRNAHdCNt7os/u8wenklZDlUVUQ== dependencies: - "@babel/helper-plugin-utils" "^7.25.9" - "@babel/helper-skip-transparent-expression-wrappers" "^7.25.9" - "@babel/plugin-transform-optional-chaining" "^7.25.9" + "@babel/types" "^7.27.1" -"@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly@^7.25.9": - version "7.25.9" - resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly/-/plugin-bugfix-v8-static-class-fields-redefine-readonly-7.25.9.tgz#de7093f1e7deaf68eadd7cc6b07f2ab82543269e" - integrity sha512-aLnMXYPnzwwqhYSCyXfKkIkYgJ8zv9RK+roo9DkTXz38ynIhd9XCbN08s3MGvqL2MYGVUGdRQLL/JqBIeJhJBg== +"@babel/plugin-bugfix-firefox-class-in-computed-class-key@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-firefox-class-in-computed-class-key/-/plugin-bugfix-firefox-class-in-computed-class-key-7.27.1.tgz#61dd8a8e61f7eb568268d1b5f129da3eee364bf9" + integrity sha512-QPG3C9cCVRQLxAVwmefEmwdTanECuUBMQZ/ym5kiw3XKCGA7qkuQLcjWWHcrD/GKbn/WmJwaezfuuAOcyKlRPA== dependencies: - "@babel/helper-plugin-utils" "^7.25.9" - "@babel/traverse" "^7.25.9" + "@babel/helper-plugin-utils" "^7.27.1" + "@babel/traverse" "^7.27.1" -"@babel/plugin-proposal-decorators@^7.25.9": - version "7.25.9" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-decorators/-/plugin-proposal-decorators-7.25.9.tgz#8680707f943d1a3da2cd66b948179920f097e254" - integrity sha512-smkNLL/O1ezy9Nhy4CNosc4Va+1wo5w4gzSZeLe6y6dM4mmHfYOCPolXQPHQxonZCF+ZyebxN9vqOolkYrSn5g== +"@babel/plugin-bugfix-safari-class-field-initializer-scope@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-safari-class-field-initializer-scope/-/plugin-bugfix-safari-class-field-initializer-scope-7.27.1.tgz#43f70a6d7efd52370eefbdf55ae03d91b293856d" + integrity sha512-qNeq3bCKnGgLkEXUuFry6dPlGfCdQNZbn7yUAPCInwAJHMU7THJfrBSozkcWq5sNM6RcF3S8XyQL2A52KNR9IA== dependencies: - "@babel/helper-create-class-features-plugin" "^7.25.9" - "@babel/helper-plugin-utils" "^7.25.9" - "@babel/plugin-syntax-decorators" "^7.25.9" + "@babel/helper-plugin-utils" "^7.27.1" + +"@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/-/plugin-bugfix-safari-id-destructuring-collision-in-function-expression-7.27.1.tgz#beb623bd573b8b6f3047bd04c32506adc3e58a72" + integrity sha512-g4L7OYun04N1WyqMNjldFwlfPCLVkgB54A/YCXICZYBsvJJE3kByKv9c9+R/nAfmIfjl2rKYLNyMHboYbZaWaA== + dependencies: + "@babel/helper-plugin-utils" "^7.27.1" + +"@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining/-/plugin-bugfix-v8-spread-parameters-in-optional-chaining-7.27.1.tgz#e134a5479eb2ba9c02714e8c1ebf1ec9076124fd" + integrity sha512-oO02gcONcD5O1iTLi/6frMJBIwWEHceWGSGqrpCmEL8nogiS6J9PBlE48CaK20/Jx1LuRml9aDftLgdjXT8+Cw== + dependencies: + "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-skip-transparent-expression-wrappers" "^7.27.1" + "@babel/plugin-transform-optional-chaining" "^7.27.1" + +"@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly/-/plugin-bugfix-v8-static-class-fields-redefine-readonly-7.27.1.tgz#bb1c25af34d75115ce229a1de7fa44bf8f955670" + integrity sha512-6BpaYGDavZqkI6yT+KSPdpZFfpnd68UKXbcjI9pJ13pvHhPrCKWOOLp+ysvMeA+DxnhuPpgIaRpxRxo5A9t5jw== + dependencies: + "@babel/helper-plugin-utils" "^7.27.1" + "@babel/traverse" "^7.27.1" + +"@babel/plugin-proposal-decorators@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-decorators/-/plugin-proposal-decorators-7.27.1.tgz#3686f424b2f8b2fee7579aa4df133a4f5244a596" + integrity sha512-DTxe4LBPrtFdsWzgpmbBKevg3e9PBy+dXRt19kSbucbZvL2uqtdqwwpluL1jfxYE0wIDTFp1nTy/q6gNLsxXrg== + dependencies: + "@babel/helper-create-class-features-plugin" "^7.27.1" + "@babel/helper-plugin-utils" "^7.27.1" + "@babel/plugin-syntax-decorators" "^7.27.1" "@babel/plugin-proposal-private-property-in-object@7.21.0-placeholder-for-preset-env.2": version "7.21.0-placeholder-for-preset-env.2" @@ -978,26 +1002,26 @@ dependencies: "@babel/helper-plugin-utils" "^7.12.13" -"@babel/plugin-syntax-decorators@^7.25.9": - version "7.25.9" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-decorators/-/plugin-syntax-decorators-7.25.9.tgz#986b4ca8b7b5df3f67cee889cedeffc2e2bf14b3" - integrity sha512-ryzI0McXUPJnRCvMo4lumIKZUzhYUO/ScI+Mz4YVaTLt04DHNSjEUjKVvbzQjZFLuod/cYEc07mJWhzl6v4DPg== +"@babel/plugin-syntax-decorators@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-decorators/-/plugin-syntax-decorators-7.27.1.tgz#ee7dd9590aeebc05f9d4c8c0560007b05979a63d" + integrity sha512-YMq8Z87Lhl8EGkmb0MwYkt36QnxC+fzCgrl66ereamPlYToRpIk5nUjKUY3QKLWq8mwUB1BgbeXcTJhZOCDg5A== dependencies: - "@babel/helper-plugin-utils" "^7.25.9" + "@babel/helper-plugin-utils" "^7.27.1" -"@babel/plugin-syntax-import-assertions@^7.26.0": - version "7.26.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-import-assertions/-/plugin-syntax-import-assertions-7.26.0.tgz#620412405058efa56e4a564903b79355020f445f" - integrity sha512-QCWT5Hh830hK5EQa7XzuqIkQU9tT/whqbDz7kuaZMHFl1inRRg7JnuAEOQ0Ur0QUl0NufCk1msK2BeY79Aj/eg== +"@babel/plugin-syntax-import-assertions@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-import-assertions/-/plugin-syntax-import-assertions-7.27.1.tgz#88894aefd2b03b5ee6ad1562a7c8e1587496aecd" + integrity sha512-UT/Jrhw57xg4ILHLFnzFpPDlMbcdEicaAtjPQpbj9wa8T4r5KVWCimHcL/460g8Ht0DMxDyjsLgiWSkVjnwPFg== dependencies: - "@babel/helper-plugin-utils" "^7.25.9" + "@babel/helper-plugin-utils" "^7.27.1" -"@babel/plugin-syntax-import-attributes@^7.26.0": - version "7.26.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-import-attributes/-/plugin-syntax-import-attributes-7.26.0.tgz#3b1412847699eea739b4f2602c74ce36f6b0b0f7" - integrity sha512-e2dttdsJ1ZTpi3B9UYGLw41hifAubg19AtCu/2I/F1QNVclOBr1dYpTdmdyZ84Xiz43BS/tCUkMAZNLv12Pi+A== +"@babel/plugin-syntax-import-attributes@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-import-attributes/-/plugin-syntax-import-attributes-7.27.1.tgz#34c017d54496f9b11b61474e7ea3dfd5563ffe07" + integrity sha512-oFT0FrKHgF53f4vOsZGi2Hh3I35PfSmVs4IBFLFj4dnafP+hIWDLg3VyKmUHfLoLHlyxY4C7DGtmHuJgn+IGww== dependencies: - "@babel/helper-plugin-utils" "^7.25.9" + "@babel/helper-plugin-utils" "^7.27.1" "@babel/plugin-syntax-import-meta@^7.8.3": version "7.10.4" @@ -1013,12 +1037,12 @@ dependencies: "@babel/helper-plugin-utils" "^7.8.0" -"@babel/plugin-syntax-jsx@^7.22.5", "@babel/plugin-syntax-jsx@^7.25.9", "@babel/plugin-syntax-jsx@^7.7.2": - version "7.25.9" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.25.9.tgz#a34313a178ea56f1951599b929c1ceacee719290" - integrity sha512-ld6oezHQMZsZfp6pWtbjaNDF2tiiCYYDqQszHt5VV437lewP9aSi2Of99CK0D0XB21k7FLgnLcmQKyKzynfeAA== +"@babel/plugin-syntax-jsx@^7.22.5", "@babel/plugin-syntax-jsx@^7.27.1", "@babel/plugin-syntax-jsx@^7.7.2": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.27.1.tgz#2f9beb5eff30fa507c5532d107daac7b888fa34c" + integrity sha512-y8YTNIeKoyhGd9O0Jiyzyyqk8gdjnumGTQPsz0xOZOQ2RmkVJeZ1vmmfIvFEKqucBG6axJGBZDE/7iI5suUI/w== dependencies: - "@babel/helper-plugin-utils" "^7.25.9" + "@babel/helper-plugin-utils" "^7.27.1" "@babel/plugin-syntax-logical-assignment-operators@^7.8.3": version "7.10.4" @@ -1069,7 +1093,14 @@ dependencies: "@babel/helper-plugin-utils" "^7.14.5" -"@babel/plugin-syntax-typescript@^7.25.9", "@babel/plugin-syntax-typescript@^7.7.2": +"@babel/plugin-syntax-typescript@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.27.1.tgz#5147d29066a793450f220c63fa3a9431b7e6dd18" + integrity sha512-xfYCBMxveHrRMnAWl1ZlPXOZjzkN82THFvLhQhFXFt81Z5HnN+EtUkZhv/zcKpmT3fzmWZB0ywiBrbC3vogbwQ== + dependencies: + "@babel/helper-plugin-utils" "^7.27.1" + +"@babel/plugin-syntax-typescript@^7.7.2": version "7.25.9" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.25.9.tgz#67dda2b74da43727cf21d46cf9afef23f4365399" integrity sha512-hjMgRy5hb8uJJjUcdWunWVcoi9bGpJp8p5Ol1229PoN6aytsLwNMgmdftO23wnCLMfVmTwZDWMPNq/D1SY60JQ== @@ -1084,316 +1115,316 @@ "@babel/helper-create-regexp-features-plugin" "^7.18.6" "@babel/helper-plugin-utils" "^7.18.6" -"@babel/plugin-transform-arrow-functions@^7.25.9": - version "7.25.9" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.25.9.tgz#7821d4410bee5daaadbb4cdd9a6649704e176845" - integrity sha512-6jmooXYIwn9ca5/RylZADJ+EnSxVUS5sjeJ9UPk6RWRzXCmOJCy6dqItPJFpw2cuCangPK4OYr5uhGKcmrm5Qg== +"@babel/plugin-transform-arrow-functions@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.27.1.tgz#6e2061067ba3ab0266d834a9f94811196f2aba9a" + integrity sha512-8Z4TGic6xW70FKThA5HYEKKyBpOOsucTOD1DjU3fZxDg+K3zBJcXMFnt/4yQiZnf5+MiOMSXQ9PaEK/Ilh1DeA== dependencies: - "@babel/helper-plugin-utils" "^7.25.9" + "@babel/helper-plugin-utils" "^7.27.1" -"@babel/plugin-transform-async-generator-functions@^7.26.8": - version "7.26.8" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-async-generator-functions/-/plugin-transform-async-generator-functions-7.26.8.tgz#5e3991135e3b9c6eaaf5eff56d1ae5a11df45ff8" - integrity sha512-He9Ej2X7tNf2zdKMAGOsmg2MrFc+hfoAhd3po4cWfo/NWjzEAKa0oQruj1ROVUdl0e6fb6/kE/G3SSxE0lRJOg== +"@babel/plugin-transform-async-generator-functions@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-async-generator-functions/-/plugin-transform-async-generator-functions-7.27.1.tgz#ca433df983d68e1375398e7ca71bf2a4f6fd89d7" + integrity sha512-eST9RrwlpaoJBDHShc+DS2SG4ATTi2MYNb4OxYkf3n+7eb49LWpnS+HSpVfW4x927qQwgk8A2hGNVaajAEw0EA== dependencies: - "@babel/helper-plugin-utils" "^7.26.5" - "@babel/helper-remap-async-to-generator" "^7.25.9" - "@babel/traverse" "^7.26.8" + "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-remap-async-to-generator" "^7.27.1" + "@babel/traverse" "^7.27.1" -"@babel/plugin-transform-async-to-generator@^7.25.9": - version "7.25.9" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.25.9.tgz#c80008dacae51482793e5a9c08b39a5be7e12d71" - integrity sha512-NT7Ejn7Z/LjUH0Gv5KsBCxh7BH3fbLTV0ptHvpeMvrt3cPThHfJfst9Wrb7S8EvJ7vRTFI7z+VAvFVEQn/m5zQ== +"@babel/plugin-transform-async-to-generator@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.27.1.tgz#9a93893b9379b39466c74474f55af03de78c66e7" + integrity sha512-NREkZsZVJS4xmTr8qzE5y8AfIPqsdQfRuUiLRTEzb7Qii8iFWCyDKaUV2c0rCuh4ljDZ98ALHP/PetiBV2nddA== dependencies: - "@babel/helper-module-imports" "^7.25.9" - "@babel/helper-plugin-utils" "^7.25.9" - "@babel/helper-remap-async-to-generator" "^7.25.9" + "@babel/helper-module-imports" "^7.27.1" + "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-remap-async-to-generator" "^7.27.1" -"@babel/plugin-transform-block-scoped-functions@^7.26.5": - version "7.26.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.26.5.tgz#3dc4405d31ad1cbe45293aa57205a6e3b009d53e" - integrity sha512-chuTSY+hq09+/f5lMj8ZSYgCFpppV2CbYrhNFJ1BFoXpiWPnnAb7R0MqrafCpN8E1+YRrtM1MXZHJdIx8B6rMQ== +"@babel/plugin-transform-block-scoped-functions@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.27.1.tgz#558a9d6e24cf72802dd3b62a4b51e0d62c0f57f9" + integrity sha512-cnqkuOtZLapWYZUYM5rVIdv1nXYuFVIltZ6ZJ7nIj585QsjKM5dhL2Fu/lICXZ1OyIAFc7Qy+bvDAtTXqGrlhg== dependencies: - "@babel/helper-plugin-utils" "^7.26.5" + "@babel/helper-plugin-utils" "^7.27.1" -"@babel/plugin-transform-block-scoping@^7.25.9": - version "7.25.9" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.25.9.tgz#c33665e46b06759c93687ca0f84395b80c0473a1" - integrity sha512-1F05O7AYjymAtqbsFETboN1NvBdcnzMerO+zlMyJBEz6WkMdejvGWw9p05iTSjC85RLlBseHHQpYaM4gzJkBGg== +"@babel/plugin-transform-block-scoping@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.27.1.tgz#bc0dbe8ac6de5602981ba58ef68c6df8ef9bfbb3" + integrity sha512-QEcFlMl9nGTgh1rn2nIeU5bkfb9BAjaQcWbiP4LvKxUot52ABcTkpcyJ7f2Q2U2RuQ84BNLgts3jRme2dTx6Fw== dependencies: - "@babel/helper-plugin-utils" "^7.25.9" + "@babel/helper-plugin-utils" "^7.27.1" -"@babel/plugin-transform-class-properties@^7.25.9": - version "7.25.9" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-class-properties/-/plugin-transform-class-properties-7.25.9.tgz#a8ce84fedb9ad512549984101fa84080a9f5f51f" - integrity sha512-bbMAII8GRSkcd0h0b4X+36GksxuheLFjP65ul9w6C3KgAamI3JqErNgSrosX6ZPj+Mpim5VvEbawXxJCyEUV3Q== +"@babel/plugin-transform-class-properties@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-class-properties/-/plugin-transform-class-properties-7.27.1.tgz#dd40a6a370dfd49d32362ae206ddaf2bb082a925" + integrity sha512-D0VcalChDMtuRvJIu3U/fwWjf8ZMykz5iZsg77Nuj821vCKI3zCyRLwRdWbsuJ/uRwZhZ002QtCqIkwC/ZkvbA== dependencies: - "@babel/helper-create-class-features-plugin" "^7.25.9" - "@babel/helper-plugin-utils" "^7.25.9" + "@babel/helper-create-class-features-plugin" "^7.27.1" + "@babel/helper-plugin-utils" "^7.27.1" -"@babel/plugin-transform-class-static-block@^7.26.0": - version "7.26.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-class-static-block/-/plugin-transform-class-static-block-7.26.0.tgz#6c8da219f4eb15cae9834ec4348ff8e9e09664a0" - integrity sha512-6J2APTs7BDDm+UMqP1useWqhcRAXo0WIoVj26N7kPFB6S73Lgvyka4KTZYIxtgYXiN5HTyRObA72N2iu628iTQ== +"@babel/plugin-transform-class-static-block@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-class-static-block/-/plugin-transform-class-static-block-7.27.1.tgz#7e920d5625b25bbccd3061aefbcc05805ed56ce4" + integrity sha512-s734HmYU78MVzZ++joYM+NkJusItbdRcbm+AGRgJCt3iA+yux0QpD9cBVdz3tKyrjVYWRl7j0mHSmv4lhV0aoA== dependencies: - "@babel/helper-create-class-features-plugin" "^7.25.9" - "@babel/helper-plugin-utils" "^7.25.9" + "@babel/helper-create-class-features-plugin" "^7.27.1" + "@babel/helper-plugin-utils" "^7.27.1" -"@babel/plugin-transform-classes@^7.25.9": - version "7.25.9" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-classes/-/plugin-transform-classes-7.25.9.tgz#7152457f7880b593a63ade8a861e6e26a4469f52" - integrity sha512-mD8APIXmseE7oZvZgGABDyM34GUmK45Um2TXiBUt7PnuAxrgoSVf123qUzPxEr/+/BHrRn5NMZCdE2m/1F8DGg== +"@babel/plugin-transform-classes@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-classes/-/plugin-transform-classes-7.27.1.tgz#03bb04bea2c7b2f711f0db7304a8da46a85cced4" + integrity sha512-7iLhfFAubmpeJe/Wo2TVuDrykh/zlWXLzPNdL0Jqn/Xu8R3QQ8h9ff8FQoISZOsw74/HFqFI7NX63HN7QFIHKA== dependencies: - "@babel/helper-annotate-as-pure" "^7.25.9" - "@babel/helper-compilation-targets" "^7.25.9" - "@babel/helper-plugin-utils" "^7.25.9" - "@babel/helper-replace-supers" "^7.25.9" - "@babel/traverse" "^7.25.9" + "@babel/helper-annotate-as-pure" "^7.27.1" + "@babel/helper-compilation-targets" "^7.27.1" + "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-replace-supers" "^7.27.1" + "@babel/traverse" "^7.27.1" globals "^11.1.0" -"@babel/plugin-transform-computed-properties@^7.25.9": - version "7.25.9" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.25.9.tgz#db36492c78460e534b8852b1d5befe3c923ef10b" - integrity sha512-HnBegGqXZR12xbcTHlJ9HGxw1OniltT26J5YpfruGqtUHlz/xKf/G2ak9e+t0rVqrjXa9WOhvYPz1ERfMj23AA== +"@babel/plugin-transform-computed-properties@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.27.1.tgz#81662e78bf5e734a97982c2b7f0a793288ef3caa" + integrity sha512-lj9PGWvMTVksbWiDT2tW68zGS/cyo4AkZ/QTp0sQT0mjPopCmrSkzxeXkznjqBxzDI6TclZhOJbBmbBLjuOZUw== dependencies: - "@babel/helper-plugin-utils" "^7.25.9" - "@babel/template" "^7.25.9" + "@babel/helper-plugin-utils" "^7.27.1" + "@babel/template" "^7.27.1" -"@babel/plugin-transform-destructuring@^7.25.9": - version "7.25.9" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.25.9.tgz#966ea2595c498224340883602d3cfd7a0c79cea1" - integrity sha512-WkCGb/3ZxXepmMiX101nnGiU+1CAdut8oHyEOHxkKuS1qKpU2SMXE2uSvfz8PBuLd49V6LEsbtyPhWC7fnkgvQ== +"@babel/plugin-transform-destructuring@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.27.1.tgz#d5916ef7089cb254df0418ae524533c1b72ba656" + integrity sha512-ttDCqhfvpE9emVkXbPD8vyxxh4TWYACVybGkDj+oReOGwnp066ITEivDlLwe0b1R0+evJ13IXQuLNB5w1fhC5Q== dependencies: - "@babel/helper-plugin-utils" "^7.25.9" + "@babel/helper-plugin-utils" "^7.27.1" -"@babel/plugin-transform-dotall-regex@^7.25.9": - version "7.25.9" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.25.9.tgz#bad7945dd07734ca52fe3ad4e872b40ed09bb09a" - integrity sha512-t7ZQ7g5trIgSRYhI9pIJtRl64KHotutUJsh4Eze5l7olJv+mRSg4/MmbZ0tv1eeqRbdvo/+trvJD/Oc5DmW2cA== +"@babel/plugin-transform-dotall-regex@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.27.1.tgz#aa6821de864c528b1fecf286f0a174e38e826f4d" + integrity sha512-gEbkDVGRvjj7+T1ivxrfgygpT7GUd4vmODtYpbs0gZATdkX8/iSnOtZSxiZnsgm1YjTgjI6VKBGSJJevkrclzw== dependencies: - "@babel/helper-create-regexp-features-plugin" "^7.25.9" - "@babel/helper-plugin-utils" "^7.25.9" + "@babel/helper-create-regexp-features-plugin" "^7.27.1" + "@babel/helper-plugin-utils" "^7.27.1" -"@babel/plugin-transform-duplicate-keys@^7.25.9": - version "7.25.9" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.25.9.tgz#8850ddf57dce2aebb4394bb434a7598031059e6d" - integrity sha512-LZxhJ6dvBb/f3x8xwWIuyiAHy56nrRG3PeYTpBkkzkYRRQ6tJLu68lEF5VIqMUZiAV7a8+Tb78nEoMCMcqjXBw== +"@babel/plugin-transform-duplicate-keys@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.27.1.tgz#f1fbf628ece18e12e7b32b175940e68358f546d1" + integrity sha512-MTyJk98sHvSs+cvZ4nOauwTTG1JeonDjSGvGGUNHreGQns+Mpt6WX/dVzWBHgg+dYZhkC4X+zTDfkTU+Vy9y7Q== dependencies: - "@babel/helper-plugin-utils" "^7.25.9" + "@babel/helper-plugin-utils" "^7.27.1" -"@babel/plugin-transform-duplicate-named-capturing-groups-regex@^7.25.9": - version "7.25.9" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-duplicate-named-capturing-groups-regex/-/plugin-transform-duplicate-named-capturing-groups-regex-7.25.9.tgz#6f7259b4de127721a08f1e5165b852fcaa696d31" - integrity sha512-0UfuJS0EsXbRvKnwcLjFtJy/Sxc5J5jhLHnFhy7u4zih97Hz6tJkLU+O+FMMrNZrosUPxDi6sYxJ/EA8jDiAog== +"@babel/plugin-transform-duplicate-named-capturing-groups-regex@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-duplicate-named-capturing-groups-regex/-/plugin-transform-duplicate-named-capturing-groups-regex-7.27.1.tgz#5043854ca620a94149372e69030ff8cb6a9eb0ec" + integrity sha512-hkGcueTEzuhB30B3eJCbCYeCaaEQOmQR0AdvzpD4LoN0GXMWzzGSuRrxR2xTnCrvNbVwK9N6/jQ92GSLfiZWoQ== dependencies: - "@babel/helper-create-regexp-features-plugin" "^7.25.9" - "@babel/helper-plugin-utils" "^7.25.9" + "@babel/helper-create-regexp-features-plugin" "^7.27.1" + "@babel/helper-plugin-utils" "^7.27.1" -"@babel/plugin-transform-dynamic-import@^7.25.9": - version "7.25.9" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-dynamic-import/-/plugin-transform-dynamic-import-7.25.9.tgz#23e917de63ed23c6600c5dd06d94669dce79f7b8" - integrity sha512-GCggjexbmSLaFhqsojeugBpeaRIgWNTcgKVq/0qIteFEqY2A+b9QidYadrWlnbWQUrW5fn+mCvf3tr7OeBFTyg== +"@babel/plugin-transform-dynamic-import@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-dynamic-import/-/plugin-transform-dynamic-import-7.27.1.tgz#4c78f35552ac0e06aa1f6e3c573d67695e8af5a4" + integrity sha512-MHzkWQcEmjzzVW9j2q8LGjwGWpG2mjwaaB0BNQwst3FIjqsg8Ct/mIZlvSPJvfi9y2AC8mi/ktxbFVL9pZ1I4A== dependencies: - "@babel/helper-plugin-utils" "^7.25.9" + "@babel/helper-plugin-utils" "^7.27.1" -"@babel/plugin-transform-exponentiation-operator@^7.26.3": - version "7.26.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.26.3.tgz#e29f01b6de302c7c2c794277a48f04a9ca7f03bc" - integrity sha512-7CAHcQ58z2chuXPWblnn1K6rLDnDWieghSOEmqQsrBenH0P9InCUtOJYD89pvngljmZlJcz3fcmgYsXFNGa1ZQ== +"@babel/plugin-transform-exponentiation-operator@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.27.1.tgz#fc497b12d8277e559747f5a3ed868dd8064f83e1" + integrity sha512-uspvXnhHvGKf2r4VVtBpeFnuDWsJLQ6MF6lGJLC89jBR1uoVeqM416AZtTuhTezOfgHicpJQmoD5YUakO/YmXQ== dependencies: - "@babel/helper-plugin-utils" "^7.25.9" + "@babel/helper-plugin-utils" "^7.27.1" -"@babel/plugin-transform-export-namespace-from@^7.25.9": - version "7.25.9" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-export-namespace-from/-/plugin-transform-export-namespace-from-7.25.9.tgz#90745fe55053394f554e40584cda81f2c8a402a2" - integrity sha512-2NsEz+CxzJIVOPx2o9UsW1rXLqtChtLoVnwYHHiB04wS5sgn7mrV45fWMBX0Kk+ub9uXytVYfNP2HjbVbCB3Ww== +"@babel/plugin-transform-export-namespace-from@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-export-namespace-from/-/plugin-transform-export-namespace-from-7.27.1.tgz#71ca69d3471edd6daa711cf4dfc3400415df9c23" + integrity sha512-tQvHWSZ3/jH2xuq/vZDy0jNn+ZdXJeM8gHvX4lnJmsc3+50yPlWdZXIc5ay+umX+2/tJIqHqiEqcJvxlmIvRvQ== dependencies: - "@babel/helper-plugin-utils" "^7.25.9" + "@babel/helper-plugin-utils" "^7.27.1" -"@babel/plugin-transform-for-of@^7.26.9": - version "7.26.9" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.26.9.tgz#27231f79d5170ef33b5111f07fe5cafeb2c96a56" - integrity sha512-Hry8AusVm8LW5BVFgiyUReuoGzPUpdHQQqJY5bZnbbf+ngOHWuCuYFKw/BqaaWlvEUrF91HMhDtEaI1hZzNbLg== +"@babel/plugin-transform-for-of@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.27.1.tgz#bc24f7080e9ff721b63a70ac7b2564ca15b6c40a" + integrity sha512-BfbWFFEJFQzLCQ5N8VocnCtA8J1CLkNTe2Ms2wocj75dd6VpiqS5Z5quTYcUoo4Yq+DN0rtikODccuv7RU81sw== dependencies: - "@babel/helper-plugin-utils" "^7.26.5" - "@babel/helper-skip-transparent-expression-wrappers" "^7.25.9" + "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-skip-transparent-expression-wrappers" "^7.27.1" -"@babel/plugin-transform-function-name@^7.25.9": - version "7.25.9" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.25.9.tgz#939d956e68a606661005bfd550c4fc2ef95f7b97" - integrity sha512-8lP+Yxjv14Vc5MuWBpJsoUCd3hD6V9DgBon2FVYL4jJgbnVQ9fTgYmonchzZJOVNgzEgbxp4OwAf6xz6M/14XA== +"@babel/plugin-transform-function-name@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.27.1.tgz#4d0bf307720e4dce6d7c30fcb1fd6ca77bdeb3a7" + integrity sha512-1bQeydJF9Nr1eBCMMbC+hdwmRlsv5XYOMu03YSWFwNs0HsAmtSxxF1fyuYPqemVldVyFmlCU7w8UE14LupUSZQ== dependencies: - "@babel/helper-compilation-targets" "^7.25.9" - "@babel/helper-plugin-utils" "^7.25.9" - "@babel/traverse" "^7.25.9" + "@babel/helper-compilation-targets" "^7.27.1" + "@babel/helper-plugin-utils" "^7.27.1" + "@babel/traverse" "^7.27.1" -"@babel/plugin-transform-json-strings@^7.25.9": - version "7.25.9" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-json-strings/-/plugin-transform-json-strings-7.25.9.tgz#c86db407cb827cded902a90c707d2781aaa89660" - integrity sha512-xoTMk0WXceiiIvsaquQQUaLLXSW1KJ159KP87VilruQm0LNNGxWzahxSS6T6i4Zg3ezp4vA4zuwiNUR53qmQAw== +"@babel/plugin-transform-json-strings@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-json-strings/-/plugin-transform-json-strings-7.27.1.tgz#a2e0ce6ef256376bd527f290da023983527a4f4c" + integrity sha512-6WVLVJiTjqcQauBhn1LkICsR2H+zm62I3h9faTDKt1qP4jn2o72tSvqMwtGFKGTpojce0gJs+76eZ2uCHRZh0Q== dependencies: - "@babel/helper-plugin-utils" "^7.25.9" + "@babel/helper-plugin-utils" "^7.27.1" -"@babel/plugin-transform-literals@^7.25.9": - version "7.25.9" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-literals/-/plugin-transform-literals-7.25.9.tgz#1a1c6b4d4aa59bc4cad5b6b3a223a0abd685c9de" - integrity sha512-9N7+2lFziW8W9pBl2TzaNht3+pgMIRP74zizeCSrtnSKVdUl8mAjjOP2OOVQAfZ881P2cNjDj1uAMEdeD50nuQ== +"@babel/plugin-transform-literals@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-literals/-/plugin-transform-literals-7.27.1.tgz#baaefa4d10a1d4206f9dcdda50d7d5827bb70b24" + integrity sha512-0HCFSepIpLTkLcsi86GG3mTUzxV5jpmbv97hTETW3yzrAij8aqlD36toB1D0daVFJM8NK6GvKO0gslVQmm+zZA== dependencies: - "@babel/helper-plugin-utils" "^7.25.9" + "@babel/helper-plugin-utils" "^7.27.1" -"@babel/plugin-transform-logical-assignment-operators@^7.25.9": - version "7.25.9" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-logical-assignment-operators/-/plugin-transform-logical-assignment-operators-7.25.9.tgz#b19441a8c39a2fda0902900b306ea05ae1055db7" - integrity sha512-wI4wRAzGko551Y8eVf6iOY9EouIDTtPb0ByZx+ktDGHwv6bHFimrgJM/2T021txPZ2s4c7bqvHbd+vXG6K948Q== +"@babel/plugin-transform-logical-assignment-operators@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-logical-assignment-operators/-/plugin-transform-logical-assignment-operators-7.27.1.tgz#890cb20e0270e0e5bebe3f025b434841c32d5baa" + integrity sha512-SJvDs5dXxiae4FbSL1aBJlG4wvl594N6YEVVn9e3JGulwioy6z3oPjx/sQBO3Y4NwUu5HNix6KJ3wBZoewcdbw== dependencies: - "@babel/helper-plugin-utils" "^7.25.9" + "@babel/helper-plugin-utils" "^7.27.1" -"@babel/plugin-transform-member-expression-literals@^7.25.9": - version "7.25.9" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.25.9.tgz#63dff19763ea64a31f5e6c20957e6a25e41ed5de" - integrity sha512-PYazBVfofCQkkMzh2P6IdIUaCEWni3iYEerAsRWuVd8+jlM1S9S9cz1dF9hIzyoZ8IA3+OwVYIp9v9e+GbgZhA== +"@babel/plugin-transform-member-expression-literals@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.27.1.tgz#37b88ba594d852418e99536f5612f795f23aeaf9" + integrity sha512-hqoBX4dcZ1I33jCSWcXrP+1Ku7kdqXf1oeah7ooKOIiAdKQ+uqftgCFNOSzA5AMS2XIHEYeGFg4cKRCdpxzVOQ== dependencies: - "@babel/helper-plugin-utils" "^7.25.9" + "@babel/helper-plugin-utils" "^7.27.1" -"@babel/plugin-transform-modules-amd@^7.25.9": - version "7.25.9" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.25.9.tgz#49ba478f2295101544abd794486cd3088dddb6c5" - integrity sha512-g5T11tnI36jVClQlMlt4qKDLlWnG5pP9CSM4GhdRciTNMRgkfpo5cR6b4rGIOYPgRRuFAvwjPQ/Yk+ql4dyhbw== +"@babel/plugin-transform-modules-amd@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.27.1.tgz#a4145f9d87c2291fe2d05f994b65dba4e3e7196f" + integrity sha512-iCsytMg/N9/oFq6n+gFTvUYDZQOMK5kEdeYxmxt91fcJGycfxVP9CnrxoliM0oumFERba2i8ZtwRUCMhvP1LnA== dependencies: - "@babel/helper-module-transforms" "^7.25.9" - "@babel/helper-plugin-utils" "^7.25.9" + "@babel/helper-module-transforms" "^7.27.1" + "@babel/helper-plugin-utils" "^7.27.1" -"@babel/plugin-transform-modules-commonjs@^7.26.3": - version "7.26.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.26.3.tgz#8f011d44b20d02c3de44d8850d971d8497f981fb" - integrity sha512-MgR55l4q9KddUDITEzEFYn5ZsGDXMSsU9E+kh7fjRXTIC3RHqfCo8RPRbyReYJh44HQ/yomFkqbOFohXvDCiIQ== +"@babel/plugin-transform-modules-commonjs@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.27.1.tgz#8e44ed37c2787ecc23bdc367f49977476614e832" + integrity sha512-OJguuwlTYlN0gBZFRPqwOGNWssZjfIUdS7HMYtN8c1KmwpwHFBwTeFZrg9XZa+DFTitWOW5iTAG7tyCUPsCCyw== dependencies: - "@babel/helper-module-transforms" "^7.26.0" - "@babel/helper-plugin-utils" "^7.25.9" + "@babel/helper-module-transforms" "^7.27.1" + "@babel/helper-plugin-utils" "^7.27.1" -"@babel/plugin-transform-modules-systemjs@^7.25.9": - version "7.25.9" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.25.9.tgz#8bd1b43836269e3d33307151a114bcf3ba6793f8" - integrity sha512-hyss7iIlH/zLHaehT+xwiymtPOpsiwIIRlCAOwBB04ta5Tt+lNItADdlXw3jAWZ96VJ2jlhl/c+PNIQPKNfvcA== +"@babel/plugin-transform-modules-systemjs@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.27.1.tgz#00e05b61863070d0f3292a00126c16c0e024c4ed" + integrity sha512-w5N1XzsRbc0PQStASMksmUeqECuzKuTJer7kFagK8AXgpCMkeDMO5S+aaFb7A51ZYDF7XI34qsTX+fkHiIm5yA== dependencies: - "@babel/helper-module-transforms" "^7.25.9" - "@babel/helper-plugin-utils" "^7.25.9" - "@babel/helper-validator-identifier" "^7.25.9" - "@babel/traverse" "^7.25.9" + "@babel/helper-module-transforms" "^7.27.1" + "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-validator-identifier" "^7.27.1" + "@babel/traverse" "^7.27.1" -"@babel/plugin-transform-modules-umd@^7.25.9": - version "7.25.9" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.25.9.tgz#6710079cdd7c694db36529a1e8411e49fcbf14c9" - integrity sha512-bS9MVObUgE7ww36HEfwe6g9WakQ0KF07mQF74uuXdkoziUPfKyu/nIm663kz//e5O1nPInPFx36z7WJmJ4yNEw== +"@babel/plugin-transform-modules-umd@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.27.1.tgz#63f2cf4f6dc15debc12f694e44714863d34cd334" + integrity sha512-iQBE/xC5BV1OxJbp6WG7jq9IWiD+xxlZhLrdwpPkTX3ydmXdvoCpyfJN7acaIBZaOqTfr76pgzqBJflNbeRK+w== dependencies: - "@babel/helper-module-transforms" "^7.25.9" - "@babel/helper-plugin-utils" "^7.25.9" + "@babel/helper-module-transforms" "^7.27.1" + "@babel/helper-plugin-utils" "^7.27.1" -"@babel/plugin-transform-named-capturing-groups-regex@^7.25.9": - version "7.25.9" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.25.9.tgz#454990ae6cc22fd2a0fa60b3a2c6f63a38064e6a" - integrity sha512-oqB6WHdKTGl3q/ItQhpLSnWWOpjUJLsOCLVyeFgeTktkBSCiurvPOsyt93gibI9CmuKvTUEtWmG5VhZD+5T/KA== +"@babel/plugin-transform-named-capturing-groups-regex@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.27.1.tgz#f32b8f7818d8fc0cc46ee20a8ef75f071af976e1" + integrity sha512-SstR5JYy8ddZvD6MhV0tM/j16Qds4mIpJTOd1Yu9J9pJjH93bxHECF7pgtc28XvkzTD6Pxcm/0Z73Hvk7kb3Ng== dependencies: - "@babel/helper-create-regexp-features-plugin" "^7.25.9" - "@babel/helper-plugin-utils" "^7.25.9" + "@babel/helper-create-regexp-features-plugin" "^7.27.1" + "@babel/helper-plugin-utils" "^7.27.1" -"@babel/plugin-transform-new-target@^7.25.9": - version "7.25.9" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.25.9.tgz#42e61711294b105c248336dcb04b77054ea8becd" - integrity sha512-U/3p8X1yCSoKyUj2eOBIx3FOn6pElFOKvAAGf8HTtItuPyB+ZeOqfn+mvTtg9ZlOAjsPdK3ayQEjqHjU/yLeVQ== +"@babel/plugin-transform-new-target@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.27.1.tgz#259c43939728cad1706ac17351b7e6a7bea1abeb" + integrity sha512-f6PiYeqXQ05lYq3TIfIDu/MtliKUbNwkGApPUvyo6+tc7uaR4cPjPe7DFPr15Uyycg2lZU6btZ575CuQoYh7MQ== dependencies: - "@babel/helper-plugin-utils" "^7.25.9" + "@babel/helper-plugin-utils" "^7.27.1" -"@babel/plugin-transform-nullish-coalescing-operator@^7.26.6": - version "7.26.6" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-nullish-coalescing-operator/-/plugin-transform-nullish-coalescing-operator-7.26.6.tgz#fbf6b3c92cb509e7b319ee46e3da89c5bedd31fe" - integrity sha512-CKW8Vu+uUZneQCPtXmSBUC6NCAUdya26hWCElAWh5mVSlSRsmiCPUUDKb3Z0szng1hiAJa098Hkhg9o4SE35Qw== +"@babel/plugin-transform-nullish-coalescing-operator@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-nullish-coalescing-operator/-/plugin-transform-nullish-coalescing-operator-7.27.1.tgz#4f9d3153bf6782d73dd42785a9d22d03197bc91d" + integrity sha512-aGZh6xMo6q9vq1JGcw58lZ1Z0+i0xB2x0XaauNIUXd6O1xXc3RwoWEBlsTQrY4KQ9Jf0s5rgD6SiNkaUdJegTA== dependencies: - "@babel/helper-plugin-utils" "^7.26.5" + "@babel/helper-plugin-utils" "^7.27.1" -"@babel/plugin-transform-numeric-separator@^7.25.9": - version "7.25.9" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-numeric-separator/-/plugin-transform-numeric-separator-7.25.9.tgz#bfed75866261a8b643468b0ccfd275f2033214a1" - integrity sha512-TlprrJ1GBZ3r6s96Yq8gEQv82s8/5HnCVHtEJScUj90thHQbwe+E5MLhi2bbNHBEJuzrvltXSru+BUxHDoog7Q== +"@babel/plugin-transform-numeric-separator@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-numeric-separator/-/plugin-transform-numeric-separator-7.27.1.tgz#614e0b15cc800e5997dadd9bd6ea524ed6c819c6" + integrity sha512-fdPKAcujuvEChxDBJ5c+0BTaS6revLV7CJL08e4m3de8qJfNIuCc2nc7XJYOjBoTMJeqSmwXJ0ypE14RCjLwaw== dependencies: - "@babel/helper-plugin-utils" "^7.25.9" + "@babel/helper-plugin-utils" "^7.27.1" -"@babel/plugin-transform-object-rest-spread@^7.25.9": - version "7.25.9" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-object-rest-spread/-/plugin-transform-object-rest-spread-7.25.9.tgz#0203725025074164808bcf1a2cfa90c652c99f18" - integrity sha512-fSaXafEE9CVHPweLYw4J0emp1t8zYTXyzN3UuG+lylqkvYd7RMrsOQ8TYx5RF231be0vqtFC6jnx3UmpJmKBYg== +"@babel/plugin-transform-object-rest-spread@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-object-rest-spread/-/plugin-transform-object-rest-spread-7.27.1.tgz#845bdcd74c87b8f565c25cc6812f7f4f43c9ed79" + integrity sha512-/sSliVc9gHE20/7D5qsdGlq7RG5NCDTWsAhyqzGuq174EtWJoGzIu1BQ7G56eDsTcy1jseBZwv50olSdXOlGuA== dependencies: - "@babel/helper-compilation-targets" "^7.25.9" - "@babel/helper-plugin-utils" "^7.25.9" - "@babel/plugin-transform-parameters" "^7.25.9" + "@babel/helper-compilation-targets" "^7.27.1" + "@babel/helper-plugin-utils" "^7.27.1" + "@babel/plugin-transform-parameters" "^7.27.1" -"@babel/plugin-transform-object-super@^7.25.9": - version "7.25.9" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.25.9.tgz#385d5de135162933beb4a3d227a2b7e52bb4cf03" - integrity sha512-Kj/Gh+Rw2RNLbCK1VAWj2U48yxxqL2x0k10nPtSdRa0O2xnHXalD0s+o1A6a0W43gJ00ANo38jxkQreckOzv5A== +"@babel/plugin-transform-object-super@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.27.1.tgz#1c932cd27bf3874c43a5cac4f43ebf970c9871b5" + integrity sha512-SFy8S9plRPbIcxlJ8A6mT/CxFdJx/c04JEctz4jf8YZaVS2px34j7NXRrlGlHkN/M2gnpL37ZpGRGVFLd3l8Ng== dependencies: - "@babel/helper-plugin-utils" "^7.25.9" - "@babel/helper-replace-supers" "^7.25.9" + "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-replace-supers" "^7.27.1" -"@babel/plugin-transform-optional-catch-binding@^7.25.9": - version "7.25.9" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-optional-catch-binding/-/plugin-transform-optional-catch-binding-7.25.9.tgz#10e70d96d52bb1f10c5caaac59ac545ea2ba7ff3" - integrity sha512-qM/6m6hQZzDcZF3onzIhZeDHDO43bkNNlOX0i8n3lR6zLbu0GN2d8qfM/IERJZYauhAHSLHy39NF0Ctdvcid7g== +"@babel/plugin-transform-optional-catch-binding@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-optional-catch-binding/-/plugin-transform-optional-catch-binding-7.27.1.tgz#84c7341ebde35ccd36b137e9e45866825072a30c" + integrity sha512-txEAEKzYrHEX4xSZN4kJ+OfKXFVSWKB2ZxM9dpcE3wT7smwkNmXo5ORRlVzMVdJbD+Q8ILTgSD7959uj+3Dm3Q== dependencies: - "@babel/helper-plugin-utils" "^7.25.9" + "@babel/helper-plugin-utils" "^7.27.1" -"@babel/plugin-transform-optional-chaining@^7.25.9": - version "7.25.9" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-optional-chaining/-/plugin-transform-optional-chaining-7.25.9.tgz#e142eb899d26ef715435f201ab6e139541eee7dd" - integrity sha512-6AvV0FsLULbpnXeBjrY4dmWF8F7gf8QnvTEoO/wX/5xm/xE1Xo8oPuD3MPS+KS9f9XBEAWN7X1aWr4z9HdOr7A== +"@babel/plugin-transform-optional-chaining@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-optional-chaining/-/plugin-transform-optional-chaining-7.27.1.tgz#874ce3c4f06b7780592e946026eb76a32830454f" + integrity sha512-BQmKPPIuc8EkZgNKsv0X4bPmOoayeu4F1YCwx2/CfmDSXDbp7GnzlUH+/ul5VGfRg1AoFPsrIThlEBj2xb4CAg== dependencies: - "@babel/helper-plugin-utils" "^7.25.9" - "@babel/helper-skip-transparent-expression-wrappers" "^7.25.9" + "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-skip-transparent-expression-wrappers" "^7.27.1" -"@babel/plugin-transform-parameters@^7.25.9": - version "7.25.9" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.25.9.tgz#b856842205b3e77e18b7a7a1b94958069c7ba257" - integrity sha512-wzz6MKwpnshBAiRmn4jR8LYz/g8Ksg0o80XmwZDlordjwEk9SxBzTWC7F5ef1jhbrbOW2DJ5J6ayRukrJmnr0g== +"@babel/plugin-transform-parameters@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.27.1.tgz#80334b54b9b1ac5244155a0c8304a187a618d5a7" + integrity sha512-018KRk76HWKeZ5l4oTj2zPpSh+NbGdt0st5S6x0pga6HgrjBOJb24mMDHorFopOOd6YHkLgOZ+zaCjZGPO4aKg== dependencies: - "@babel/helper-plugin-utils" "^7.25.9" + "@babel/helper-plugin-utils" "^7.27.1" -"@babel/plugin-transform-private-methods@^7.25.9": - version "7.25.9" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-private-methods/-/plugin-transform-private-methods-7.25.9.tgz#847f4139263577526455d7d3223cd8bda51e3b57" - integrity sha512-D/JUozNpQLAPUVusvqMxyvjzllRaF8/nSrP1s2YGQT/W4LHK4xxsMcHjhOGTS01mp9Hda8nswb+FblLdJornQw== +"@babel/plugin-transform-private-methods@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-private-methods/-/plugin-transform-private-methods-7.27.1.tgz#fdacbab1c5ed81ec70dfdbb8b213d65da148b6af" + integrity sha512-10FVt+X55AjRAYI9BrdISN9/AQWHqldOeZDUoLyif1Kn05a56xVBXb8ZouL8pZ9jem8QpXaOt8TS7RHUIS+GPA== dependencies: - "@babel/helper-create-class-features-plugin" "^7.25.9" - "@babel/helper-plugin-utils" "^7.25.9" + "@babel/helper-create-class-features-plugin" "^7.27.1" + "@babel/helper-plugin-utils" "^7.27.1" -"@babel/plugin-transform-private-property-in-object@^7.25.9": - version "7.25.9" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-private-property-in-object/-/plugin-transform-private-property-in-object-7.25.9.tgz#9c8b73e64e6cc3cbb2743633885a7dd2c385fe33" - integrity sha512-Evf3kcMqzXA3xfYJmZ9Pg1OvKdtqsDMSWBDzZOPLvHiTt36E75jLDQo5w1gtRU95Q4E5PDttrTf25Fw8d/uWLw== +"@babel/plugin-transform-private-property-in-object@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-private-property-in-object/-/plugin-transform-private-property-in-object-7.27.1.tgz#4dbbef283b5b2f01a21e81e299f76e35f900fb11" + integrity sha512-5J+IhqTi1XPa0DXF83jYOaARrX+41gOewWbkPyjMNRDqgOCqdffGh8L3f/Ek5utaEBZExjSAzcyjmV9SSAWObQ== dependencies: - "@babel/helper-annotate-as-pure" "^7.25.9" - "@babel/helper-create-class-features-plugin" "^7.25.9" - "@babel/helper-plugin-utils" "^7.25.9" + "@babel/helper-annotate-as-pure" "^7.27.1" + "@babel/helper-create-class-features-plugin" "^7.27.1" + "@babel/helper-plugin-utils" "^7.27.1" -"@babel/plugin-transform-property-literals@^7.25.9": - version "7.25.9" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.25.9.tgz#d72d588bd88b0dec8b62e36f6fda91cedfe28e3f" - integrity sha512-IvIUeV5KrS/VPavfSM/Iu+RE6llrHrYIKY1yfCzyO/lMXHQ+p7uGhonmGVisv6tSBSVgWzMBohTcvkC9vQcQFA== +"@babel/plugin-transform-property-literals@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.27.1.tgz#07eafd618800591e88073a0af1b940d9a42c6424" + integrity sha512-oThy3BCuCha8kDZ8ZkgOg2exvPYUlprMukKQXI1r1pJ47NCvxfkEy8vK+r/hT9nF0Aa4H1WUPZZjHTFtAhGfmQ== dependencies: - "@babel/helper-plugin-utils" "^7.25.9" + "@babel/helper-plugin-utils" "^7.27.1" -"@babel/plugin-transform-react-display-name@^7.25.9": - version "7.25.9" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-display-name/-/plugin-transform-react-display-name-7.25.9.tgz#4b79746b59efa1f38c8695065a92a9f5afb24f7d" - integrity sha512-KJfMlYIUxQB1CJfO3e0+h0ZHWOTLCPP115Awhaz8U0Zpq36Gl/cXlpoyMRnUWlhNUBAzldnCiAZNvCDj7CrKxQ== +"@babel/plugin-transform-react-display-name@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-display-name/-/plugin-transform-react-display-name-7.27.1.tgz#43af31362d71f7848cfac0cbc212882b1a16e80f" + integrity sha512-p9+Vl3yuHPmkirRrg021XiP+EETmPMQTLr6Ayjj85RLNEbb3Eya/4VI0vAdzQG9SEAl2Lnt7fy5lZyMzjYoZQQ== dependencies: - "@babel/helper-plugin-utils" "^7.25.9" + "@babel/helper-plugin-utils" "^7.27.1" -"@babel/plugin-transform-react-jsx-development@^7.25.9": - version "7.25.9" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-jsx-development/-/plugin-transform-react-jsx-development-7.25.9.tgz#8fd220a77dd139c07e25225a903b8be8c829e0d7" - integrity sha512-9mj6rm7XVYs4mdLIpbZnHOYdpW42uoiBCTVowg7sP1thUOiANgMb4UtpRivR0pp5iL+ocvUv7X4mZgFRpJEzGw== +"@babel/plugin-transform-react-jsx-development@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-jsx-development/-/plugin-transform-react-jsx-development-7.27.1.tgz#47ff95940e20a3a70e68ad3d4fcb657b647f6c98" + integrity sha512-ykDdF5yI4f1WrAolLqeF3hmYU12j9ntLQl/AOG1HAS21jxyg1Q0/J/tpREuYLfatGdGmXp/3yS0ZA76kOlVq9Q== dependencies: - "@babel/plugin-transform-react-jsx" "^7.25.9" + "@babel/plugin-transform-react-jsx" "^7.27.1" "@babel/plugin-transform-react-jsx-self@^7.18.6": version "7.18.6" @@ -1409,47 +1440,46 @@ dependencies: "@babel/helper-plugin-utils" "^7.19.0" -"@babel/plugin-transform-react-jsx@^7.25.9": - version "7.25.9" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-jsx/-/plugin-transform-react-jsx-7.25.9.tgz#06367940d8325b36edff5e2b9cbe782947ca4166" - integrity sha512-s5XwpQYCqGerXl+Pu6VDL3x0j2d82eiV77UJ8a2mDHAW7j9SWRqQ2y1fNo1Z74CdcYipl5Z41zvjj4Nfzq36rw== +"@babel/plugin-transform-react-jsx@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-jsx/-/plugin-transform-react-jsx-7.27.1.tgz#1023bc94b78b0a2d68c82b5e96aed573bcfb9db0" + integrity sha512-2KH4LWGSrJIkVf5tSiBFYuXDAoWRq2MMwgivCf+93dd0GQi8RXLjKA/0EvRnVV5G0hrHczsquXuD01L8s6dmBw== dependencies: - "@babel/helper-annotate-as-pure" "^7.25.9" - "@babel/helper-module-imports" "^7.25.9" - "@babel/helper-plugin-utils" "^7.25.9" - "@babel/plugin-syntax-jsx" "^7.25.9" - "@babel/types" "^7.25.9" + "@babel/helper-annotate-as-pure" "^7.27.1" + "@babel/helper-module-imports" "^7.27.1" + "@babel/helper-plugin-utils" "^7.27.1" + "@babel/plugin-syntax-jsx" "^7.27.1" + "@babel/types" "^7.27.1" -"@babel/plugin-transform-react-pure-annotations@^7.25.9": - version "7.25.9" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-pure-annotations/-/plugin-transform-react-pure-annotations-7.25.9.tgz#ea1c11b2f9dbb8e2d97025f43a3b5bc47e18ae62" - integrity sha512-KQ/Takk3T8Qzj5TppkS1be588lkbTp5uj7w6a0LeQaTMSckU/wK0oJ/pih+T690tkgI5jfmg2TqDJvd41Sj1Cg== +"@babel/plugin-transform-react-pure-annotations@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-pure-annotations/-/plugin-transform-react-pure-annotations-7.27.1.tgz#339f1ce355eae242e0649f232b1c68907c02e879" + integrity sha512-JfuinvDOsD9FVMTHpzA/pBLisxpv1aSf+OIV8lgH3MuWrks19R27e6a6DipIg4aX1Zm9Wpb04p8wljfKrVSnPA== dependencies: - "@babel/helper-annotate-as-pure" "^7.25.9" - "@babel/helper-plugin-utils" "^7.25.9" + "@babel/helper-annotate-as-pure" "^7.27.1" + "@babel/helper-plugin-utils" "^7.27.1" -"@babel/plugin-transform-regenerator@^7.25.9", "@babel/plugin-transform-regenerator@^7.27.0": - version "7.27.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.27.0.tgz#822feebef43d6a59a81f696b2512df5b1682db31" - integrity sha512-LX/vCajUJQDqE7Aum/ELUMZAY19+cDpghxrnyt5I1tV6X5PyC86AOoWXWFYFeIvauyeSA6/ktn4tQVn/3ZifsA== +"@babel/plugin-transform-regenerator@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.27.1.tgz#0a471df9213416e44cd66bf67176b66f65768401" + integrity sha512-B19lbbL7PMrKr52BNPjCqg1IyNUIjTcxKj8uX9zHO+PmWN93s19NDr/f69mIkEp2x9nmDJ08a7lgHaTTzvW7mw== dependencies: - "@babel/helper-plugin-utils" "^7.26.5" - regenerator-transform "^0.15.2" + "@babel/helper-plugin-utils" "^7.27.1" -"@babel/plugin-transform-regexp-modifiers@^7.26.0": - version "7.26.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-regexp-modifiers/-/plugin-transform-regexp-modifiers-7.26.0.tgz#2f5837a5b5cd3842a919d8147e9903cc7455b850" - integrity sha512-vN6saax7lrA2yA/Pak3sCxuD6F5InBjn9IcrIKQPjpsLvuHYLVroTxjdlVRHjjBWxKOqIwpTXDkOssYT4BFdRw== +"@babel/plugin-transform-regexp-modifiers@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-regexp-modifiers/-/plugin-transform-regexp-modifiers-7.27.1.tgz#df9ba5577c974e3f1449888b70b76169998a6d09" + integrity sha512-TtEciroaiODtXvLZv4rmfMhkCv8jx3wgKpL68PuiPh2M4fvz5jhsA7697N1gMvkvr/JTF13DrFYyEbY9U7cVPA== dependencies: - "@babel/helper-create-regexp-features-plugin" "^7.25.9" - "@babel/helper-plugin-utils" "^7.25.9" + "@babel/helper-create-regexp-features-plugin" "^7.27.1" + "@babel/helper-plugin-utils" "^7.27.1" -"@babel/plugin-transform-reserved-words@^7.25.9": - version "7.25.9" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-reserved-words/-/plugin-transform-reserved-words-7.25.9.tgz#0398aed2f1f10ba3f78a93db219b27ef417fb9ce" - integrity sha512-7DL7DKYjn5Su++4RXu8puKZm2XBPHyjWLUidaPEkCUBbE7IPcsrkRHggAOOKydH1dASWdcUBxrkOGNxUv5P3Jg== +"@babel/plugin-transform-reserved-words@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-reserved-words/-/plugin-transform-reserved-words-7.27.1.tgz#40fba4878ccbd1c56605a4479a3a891ac0274bb4" + integrity sha512-V2ABPHIJX4kC7HegLkYoDpfg9PVmuWy/i6vUM5eGK22bx4YVFD3M5F0QQnWQoDs6AGsUWTVOopBiMFQgHaSkVw== dependencies: - "@babel/helper-plugin-utils" "^7.25.9" + "@babel/helper-plugin-utils" "^7.27.1" "@babel/plugin-transform-runtime@^7.12.1": version "7.14.5" @@ -1463,152 +1493,152 @@ babel-plugin-polyfill-regenerator "^0.2.2" semver "^6.3.0" -"@babel/plugin-transform-shorthand-properties@^7.25.9": - version "7.25.9" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.25.9.tgz#bb785e6091f99f826a95f9894fc16fde61c163f2" - integrity sha512-MUv6t0FhO5qHnS/W8XCbHmiRWOphNufpE1IVxhK5kuN3Td9FT1x4rx4K42s3RYdMXCXpfWkGSbCSd0Z64xA7Ng== +"@babel/plugin-transform-shorthand-properties@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.27.1.tgz#532abdacdec87bfee1e0ef8e2fcdee543fe32b90" + integrity sha512-N/wH1vcn4oYawbJ13Y/FxcQrWk63jhfNa7jef0ih7PHSIHX2LB7GWE1rkPrOnka9kwMxb6hMl19p7lidA+EHmQ== dependencies: - "@babel/helper-plugin-utils" "^7.25.9" + "@babel/helper-plugin-utils" "^7.27.1" -"@babel/plugin-transform-spread@^7.25.9": - version "7.25.9" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-spread/-/plugin-transform-spread-7.25.9.tgz#24a35153931b4ba3d13cec4a7748c21ab5514ef9" - integrity sha512-oNknIB0TbURU5pqJFVbOOFspVlrpVwo2H1+HUIsVDvp5VauGGDP1ZEvO8Nn5xyMEs3dakajOxlmkNW7kNgSm6A== +"@babel/plugin-transform-spread@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-spread/-/plugin-transform-spread-7.27.1.tgz#1a264d5fc12750918f50e3fe3e24e437178abb08" + integrity sha512-kpb3HUqaILBJcRFVhFUs6Trdd4mkrzcGXss+6/mxUd273PfbWqSDHRzMT2234gIg2QYfAjvXLSquP1xECSg09Q== dependencies: - "@babel/helper-plugin-utils" "^7.25.9" - "@babel/helper-skip-transparent-expression-wrappers" "^7.25.9" + "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-skip-transparent-expression-wrappers" "^7.27.1" -"@babel/plugin-transform-sticky-regex@^7.25.9": - version "7.25.9" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.25.9.tgz#c7f02b944e986a417817b20ba2c504dfc1453d32" - integrity sha512-WqBUSgeVwucYDP9U/xNRQam7xV8W5Zf+6Eo7T2SRVUFlhRiMNFdFz58u0KZmCVVqs2i7SHgpRnAhzRNmKfi2uA== +"@babel/plugin-transform-sticky-regex@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.27.1.tgz#18984935d9d2296843a491d78a014939f7dcd280" + integrity sha512-lhInBO5bi/Kowe2/aLdBAawijx+q1pQzicSgnkB6dUPc1+RC8QmJHKf2OjvU+NZWitguJHEaEmbV6VWEouT58g== dependencies: - "@babel/helper-plugin-utils" "^7.25.9" + "@babel/helper-plugin-utils" "^7.27.1" -"@babel/plugin-transform-template-literals@^7.26.8": - version "7.26.8" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.26.8.tgz#966b15d153a991172a540a69ad5e1845ced990b5" - integrity sha512-OmGDL5/J0CJPJZTHZbi2XpO0tyT2Ia7fzpW5GURwdtp2X3fMmN8au/ej6peC/T33/+CRiIpA8Krse8hFGVmT5Q== +"@babel/plugin-transform-template-literals@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.27.1.tgz#1a0eb35d8bb3e6efc06c9fd40eb0bcef548328b8" + integrity sha512-fBJKiV7F2DxZUkg5EtHKXQdbsbURW3DZKQUWphDum0uRP6eHGGa/He9mc0mypL680pb+e/lDIthRohlv8NCHkg== dependencies: - "@babel/helper-plugin-utils" "^7.26.5" + "@babel/helper-plugin-utils" "^7.27.1" -"@babel/plugin-transform-typeof-symbol@^7.26.7": - version "7.26.7" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.26.7.tgz#d0e33acd9223744c1e857dbd6fa17bd0a3786937" - integrity sha512-jfoTXXZTgGg36BmhqT3cAYK5qkmqvJpvNrPhaK/52Vgjhw4Rq29s9UqpWWV0D6yuRmgiFH/BUVlkl96zJWqnaw== +"@babel/plugin-transform-typeof-symbol@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.27.1.tgz#70e966bb492e03509cf37eafa6dcc3051f844369" + integrity sha512-RiSILC+nRJM7FY5srIyc4/fGIwUhyDuuBSdWn4y6yT6gm652DpCHZjIipgn6B7MQ1ITOUnAKWixEUjQRIBIcLw== dependencies: - "@babel/helper-plugin-utils" "^7.26.5" + "@babel/helper-plugin-utils" "^7.27.1" -"@babel/plugin-transform-typescript@^7.27.0": - version "7.27.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.27.0.tgz#a29fd3481da85601c7e34091296e9746d2cccba8" - integrity sha512-fRGGjO2UEGPjvEcyAZXRXAS8AfdaQoq7HnxAbJoAoW10B9xOKesmmndJv+Sym2a+9FHWZ9KbyyLCe9s0Sn5jtg== +"@babel/plugin-transform-typescript@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.27.1.tgz#d3bb65598bece03f773111e88cc4e8e5070f1140" + integrity sha512-Q5sT5+O4QUebHdbwKedFBEwRLb02zJ7r4A5Gg2hUoLuU3FjdMcyqcywqUrLCaDsFCxzokf7u9kuy7qz51YUuAg== dependencies: - "@babel/helper-annotate-as-pure" "^7.25.9" - "@babel/helper-create-class-features-plugin" "^7.27.0" - "@babel/helper-plugin-utils" "^7.26.5" - "@babel/helper-skip-transparent-expression-wrappers" "^7.25.9" - "@babel/plugin-syntax-typescript" "^7.25.9" + "@babel/helper-annotate-as-pure" "^7.27.1" + "@babel/helper-create-class-features-plugin" "^7.27.1" + "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-skip-transparent-expression-wrappers" "^7.27.1" + "@babel/plugin-syntax-typescript" "^7.27.1" -"@babel/plugin-transform-unicode-escapes@^7.25.9": - version "7.25.9" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-escapes/-/plugin-transform-unicode-escapes-7.25.9.tgz#a75ef3947ce15363fccaa38e2dd9bc70b2788b82" - integrity sha512-s5EDrE6bW97LtxOcGj1Khcx5AaXwiMmi4toFWRDP9/y0Woo6pXC+iyPu/KuhKtfSrNFd7jJB+/fkOtZy6aIC6Q== +"@babel/plugin-transform-unicode-escapes@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-escapes/-/plugin-transform-unicode-escapes-7.27.1.tgz#3e3143f8438aef842de28816ece58780190cf806" + integrity sha512-Ysg4v6AmF26k9vpfFuTZg8HRfVWzsh1kVfowA23y9j/Gu6dOuahdUVhkLqpObp3JIv27MLSii6noRnuKN8H0Mg== dependencies: - "@babel/helper-plugin-utils" "^7.25.9" + "@babel/helper-plugin-utils" "^7.27.1" -"@babel/plugin-transform-unicode-property-regex@^7.25.9": - version "7.25.9" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-property-regex/-/plugin-transform-unicode-property-regex-7.25.9.tgz#a901e96f2c1d071b0d1bb5dc0d3c880ce8f53dd3" - integrity sha512-Jt2d8Ga+QwRluxRQ307Vlxa6dMrYEMZCgGxoPR8V52rxPyldHu3hdlHspxaqYmE7oID5+kB+UKUB/eWS+DkkWg== +"@babel/plugin-transform-unicode-property-regex@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-property-regex/-/plugin-transform-unicode-property-regex-7.27.1.tgz#bdfe2d3170c78c5691a3c3be934c8c0087525956" + integrity sha512-uW20S39PnaTImxp39O5qFlHLS9LJEmANjMG7SxIhap8rCHqu0Ik+tLEPX5DKmHn6CsWQ7j3lix2tFOa5YtL12Q== dependencies: - "@babel/helper-create-regexp-features-plugin" "^7.25.9" - "@babel/helper-plugin-utils" "^7.25.9" + "@babel/helper-create-regexp-features-plugin" "^7.27.1" + "@babel/helper-plugin-utils" "^7.27.1" -"@babel/plugin-transform-unicode-regex@^7.25.9": - version "7.25.9" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.25.9.tgz#5eae747fe39eacf13a8bd006a4fb0b5d1fa5e9b1" - integrity sha512-yoxstj7Rg9dlNn9UQxzk4fcNivwv4nUYz7fYXBaKxvw/lnmPuOm/ikoELygbYq68Bls3D/D+NBPHiLwZdZZ4HA== +"@babel/plugin-transform-unicode-regex@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.27.1.tgz#25948f5c395db15f609028e370667ed8bae9af97" + integrity sha512-xvINq24TRojDuyt6JGtHmkVkrfVV3FPT16uytxImLeBZqW3/H52yN+kM1MGuyPkIQxrzKwPHs5U/MP3qKyzkGw== dependencies: - "@babel/helper-create-regexp-features-plugin" "^7.25.9" - "@babel/helper-plugin-utils" "^7.25.9" + "@babel/helper-create-regexp-features-plugin" "^7.27.1" + "@babel/helper-plugin-utils" "^7.27.1" -"@babel/plugin-transform-unicode-sets-regex@^7.25.9": - version "7.25.9" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-sets-regex/-/plugin-transform-unicode-sets-regex-7.25.9.tgz#65114c17b4ffc20fa5b163c63c70c0d25621fabe" - integrity sha512-8BYqO3GeVNHtx69fdPshN3fnzUNLrWdHhk/icSwigksJGczKSizZ+Z6SBCxTs723Fr5VSNorTIK7a+R2tISvwQ== +"@babel/plugin-transform-unicode-sets-regex@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-sets-regex/-/plugin-transform-unicode-sets-regex-7.27.1.tgz#6ab706d10f801b5c72da8bb2548561fa04193cd1" + integrity sha512-EtkOujbc4cgvb0mlpQefi4NTPBzhSIevblFevACNLUspmrALgmEBdL/XfnyyITfd8fKBZrZys92zOWcik7j9Tw== dependencies: - "@babel/helper-create-regexp-features-plugin" "^7.25.9" - "@babel/helper-plugin-utils" "^7.25.9" + "@babel/helper-create-regexp-features-plugin" "^7.27.1" + "@babel/helper-plugin-utils" "^7.27.1" -"@babel/preset-env@^7.11.0", "@babel/preset-env@^7.26.9": - version "7.26.9" - resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.26.9.tgz#2ec64e903d0efe743699f77a10bdf7955c2123c3" - integrity sha512-vX3qPGE8sEKEAZCWk05k3cpTAE3/nOYca++JA+Rd0z2NCNzabmYvEiSShKzm10zdquOIAVXsy2Ei/DTW34KlKQ== +"@babel/preset-env@^7.11.0", "@babel/preset-env@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.27.1.tgz#23463ab94f36540630924f5de3b4c7a8dde3b6a2" + integrity sha512-TZ5USxFpLgKDpdEt8YWBR7p6g+bZo6sHaXLqP2BY/U0acaoI8FTVflcYCr/v94twM1C5IWFdZ/hscq9WjUeLXA== dependencies: - "@babel/compat-data" "^7.26.8" - "@babel/helper-compilation-targets" "^7.26.5" - "@babel/helper-plugin-utils" "^7.26.5" - "@babel/helper-validator-option" "^7.25.9" - "@babel/plugin-bugfix-firefox-class-in-computed-class-key" "^7.25.9" - "@babel/plugin-bugfix-safari-class-field-initializer-scope" "^7.25.9" - "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression" "^7.25.9" - "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining" "^7.25.9" - "@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly" "^7.25.9" + "@babel/compat-data" "^7.27.1" + "@babel/helper-compilation-targets" "^7.27.1" + "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-validator-option" "^7.27.1" + "@babel/plugin-bugfix-firefox-class-in-computed-class-key" "^7.27.1" + "@babel/plugin-bugfix-safari-class-field-initializer-scope" "^7.27.1" + "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression" "^7.27.1" + "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining" "^7.27.1" + "@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly" "^7.27.1" "@babel/plugin-proposal-private-property-in-object" "7.21.0-placeholder-for-preset-env.2" - "@babel/plugin-syntax-import-assertions" "^7.26.0" - "@babel/plugin-syntax-import-attributes" "^7.26.0" + "@babel/plugin-syntax-import-assertions" "^7.27.1" + "@babel/plugin-syntax-import-attributes" "^7.27.1" "@babel/plugin-syntax-unicode-sets-regex" "^7.18.6" - "@babel/plugin-transform-arrow-functions" "^7.25.9" - "@babel/plugin-transform-async-generator-functions" "^7.26.8" - "@babel/plugin-transform-async-to-generator" "^7.25.9" - "@babel/plugin-transform-block-scoped-functions" "^7.26.5" - "@babel/plugin-transform-block-scoping" "^7.25.9" - "@babel/plugin-transform-class-properties" "^7.25.9" - "@babel/plugin-transform-class-static-block" "^7.26.0" - "@babel/plugin-transform-classes" "^7.25.9" - "@babel/plugin-transform-computed-properties" "^7.25.9" - "@babel/plugin-transform-destructuring" "^7.25.9" - "@babel/plugin-transform-dotall-regex" "^7.25.9" - "@babel/plugin-transform-duplicate-keys" "^7.25.9" - "@babel/plugin-transform-duplicate-named-capturing-groups-regex" "^7.25.9" - "@babel/plugin-transform-dynamic-import" "^7.25.9" - "@babel/plugin-transform-exponentiation-operator" "^7.26.3" - "@babel/plugin-transform-export-namespace-from" "^7.25.9" - "@babel/plugin-transform-for-of" "^7.26.9" - "@babel/plugin-transform-function-name" "^7.25.9" - "@babel/plugin-transform-json-strings" "^7.25.9" - "@babel/plugin-transform-literals" "^7.25.9" - "@babel/plugin-transform-logical-assignment-operators" "^7.25.9" - "@babel/plugin-transform-member-expression-literals" "^7.25.9" - "@babel/plugin-transform-modules-amd" "^7.25.9" - "@babel/plugin-transform-modules-commonjs" "^7.26.3" - "@babel/plugin-transform-modules-systemjs" "^7.25.9" - "@babel/plugin-transform-modules-umd" "^7.25.9" - "@babel/plugin-transform-named-capturing-groups-regex" "^7.25.9" - "@babel/plugin-transform-new-target" "^7.25.9" - "@babel/plugin-transform-nullish-coalescing-operator" "^7.26.6" - "@babel/plugin-transform-numeric-separator" "^7.25.9" - "@babel/plugin-transform-object-rest-spread" "^7.25.9" - "@babel/plugin-transform-object-super" "^7.25.9" - "@babel/plugin-transform-optional-catch-binding" "^7.25.9" - "@babel/plugin-transform-optional-chaining" "^7.25.9" - "@babel/plugin-transform-parameters" "^7.25.9" - "@babel/plugin-transform-private-methods" "^7.25.9" - "@babel/plugin-transform-private-property-in-object" "^7.25.9" - "@babel/plugin-transform-property-literals" "^7.25.9" - "@babel/plugin-transform-regenerator" "^7.25.9" - "@babel/plugin-transform-regexp-modifiers" "^7.26.0" - "@babel/plugin-transform-reserved-words" "^7.25.9" - "@babel/plugin-transform-shorthand-properties" "^7.25.9" - "@babel/plugin-transform-spread" "^7.25.9" - "@babel/plugin-transform-sticky-regex" "^7.25.9" - "@babel/plugin-transform-template-literals" "^7.26.8" - "@babel/plugin-transform-typeof-symbol" "^7.26.7" - "@babel/plugin-transform-unicode-escapes" "^7.25.9" - "@babel/plugin-transform-unicode-property-regex" "^7.25.9" - "@babel/plugin-transform-unicode-regex" "^7.25.9" - "@babel/plugin-transform-unicode-sets-regex" "^7.25.9" + "@babel/plugin-transform-arrow-functions" "^7.27.1" + "@babel/plugin-transform-async-generator-functions" "^7.27.1" + "@babel/plugin-transform-async-to-generator" "^7.27.1" + "@babel/plugin-transform-block-scoped-functions" "^7.27.1" + "@babel/plugin-transform-block-scoping" "^7.27.1" + "@babel/plugin-transform-class-properties" "^7.27.1" + "@babel/plugin-transform-class-static-block" "^7.27.1" + "@babel/plugin-transform-classes" "^7.27.1" + "@babel/plugin-transform-computed-properties" "^7.27.1" + "@babel/plugin-transform-destructuring" "^7.27.1" + "@babel/plugin-transform-dotall-regex" "^7.27.1" + "@babel/plugin-transform-duplicate-keys" "^7.27.1" + "@babel/plugin-transform-duplicate-named-capturing-groups-regex" "^7.27.1" + "@babel/plugin-transform-dynamic-import" "^7.27.1" + "@babel/plugin-transform-exponentiation-operator" "^7.27.1" + "@babel/plugin-transform-export-namespace-from" "^7.27.1" + "@babel/plugin-transform-for-of" "^7.27.1" + "@babel/plugin-transform-function-name" "^7.27.1" + "@babel/plugin-transform-json-strings" "^7.27.1" + "@babel/plugin-transform-literals" "^7.27.1" + "@babel/plugin-transform-logical-assignment-operators" "^7.27.1" + "@babel/plugin-transform-member-expression-literals" "^7.27.1" + "@babel/plugin-transform-modules-amd" "^7.27.1" + "@babel/plugin-transform-modules-commonjs" "^7.27.1" + "@babel/plugin-transform-modules-systemjs" "^7.27.1" + "@babel/plugin-transform-modules-umd" "^7.27.1" + "@babel/plugin-transform-named-capturing-groups-regex" "^7.27.1" + "@babel/plugin-transform-new-target" "^7.27.1" + "@babel/plugin-transform-nullish-coalescing-operator" "^7.27.1" + "@babel/plugin-transform-numeric-separator" "^7.27.1" + "@babel/plugin-transform-object-rest-spread" "^7.27.1" + "@babel/plugin-transform-object-super" "^7.27.1" + "@babel/plugin-transform-optional-catch-binding" "^7.27.1" + "@babel/plugin-transform-optional-chaining" "^7.27.1" + "@babel/plugin-transform-parameters" "^7.27.1" + "@babel/plugin-transform-private-methods" "^7.27.1" + "@babel/plugin-transform-private-property-in-object" "^7.27.1" + "@babel/plugin-transform-property-literals" "^7.27.1" + "@babel/plugin-transform-regenerator" "^7.27.1" + "@babel/plugin-transform-regexp-modifiers" "^7.27.1" + "@babel/plugin-transform-reserved-words" "^7.27.1" + "@babel/plugin-transform-shorthand-properties" "^7.27.1" + "@babel/plugin-transform-spread" "^7.27.1" + "@babel/plugin-transform-sticky-regex" "^7.27.1" + "@babel/plugin-transform-template-literals" "^7.27.1" + "@babel/plugin-transform-typeof-symbol" "^7.27.1" + "@babel/plugin-transform-unicode-escapes" "^7.27.1" + "@babel/plugin-transform-unicode-property-regex" "^7.27.1" + "@babel/plugin-transform-unicode-regex" "^7.27.1" + "@babel/plugin-transform-unicode-sets-regex" "^7.27.1" "@babel/preset-modules" "0.1.6-no-external-plugins" babel-plugin-polyfill-corejs2 "^0.4.10" babel-plugin-polyfill-corejs3 "^0.11.0" @@ -1625,65 +1655,65 @@ "@babel/types" "^7.4.4" esutils "^2.0.2" -"@babel/preset-react@^7.26.3": - version "7.26.3" - resolved "https://registry.yarnpkg.com/@babel/preset-react/-/preset-react-7.26.3.tgz#7c5e028d623b4683c1f83a0bd4713b9100560caa" - integrity sha512-Nl03d6T9ky516DGK2YMxrTqvnpUW63TnJMOMonj+Zae0JiPC5BC9xPMSL6L8fiSpA5vP88qfygavVQvnLp+6Cw== +"@babel/preset-react@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/preset-react/-/preset-react-7.27.1.tgz#86ea0a5ca3984663f744be2fd26cb6747c3fd0ec" + integrity sha512-oJHWh2gLhU9dW9HHr42q0cI0/iHHXTLGe39qvpAZZzagHy0MzYLCnCVV0symeRvzmjHyVU7mw2K06E6u/JwbhA== dependencies: - "@babel/helper-plugin-utils" "^7.25.9" - "@babel/helper-validator-option" "^7.25.9" - "@babel/plugin-transform-react-display-name" "^7.25.9" - "@babel/plugin-transform-react-jsx" "^7.25.9" - "@babel/plugin-transform-react-jsx-development" "^7.25.9" - "@babel/plugin-transform-react-pure-annotations" "^7.25.9" + "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-validator-option" "^7.27.1" + "@babel/plugin-transform-react-display-name" "^7.27.1" + "@babel/plugin-transform-react-jsx" "^7.27.1" + "@babel/plugin-transform-react-jsx-development" "^7.27.1" + "@babel/plugin-transform-react-pure-annotations" "^7.27.1" -"@babel/preset-typescript@^7.27.0": - version "7.27.0" - resolved "https://registry.yarnpkg.com/@babel/preset-typescript/-/preset-typescript-7.27.0.tgz#4dcb8827225975f4290961b0b089f9c694ca50c7" - integrity sha512-vxaPFfJtHhgeOVXRKuHpHPAOgymmy8V8I65T1q53R7GCZlefKeCaTyDs3zOPHTTbmquvNlQYC5klEvWsBAtrBQ== +"@babel/preset-typescript@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/preset-typescript/-/preset-typescript-7.27.1.tgz#190742a6428d282306648a55b0529b561484f912" + integrity sha512-l7WfQfX0WK4M0v2RudjuQK4u99BS6yLHYEmdtVPP7lKV013zr9DygFuWNlnbvQ9LR+LS0Egz/XAvGx5U9MX0fQ== dependencies: - "@babel/helper-plugin-utils" "^7.26.5" - "@babel/helper-validator-option" "^7.25.9" - "@babel/plugin-syntax-jsx" "^7.25.9" - "@babel/plugin-transform-modules-commonjs" "^7.26.3" - "@babel/plugin-transform-typescript" "^7.27.0" + "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-validator-option" "^7.27.1" + "@babel/plugin-syntax-jsx" "^7.27.1" + "@babel/plugin-transform-modules-commonjs" "^7.27.1" + "@babel/plugin-transform-typescript" "^7.27.1" -"@babel/runtime@^7.0.0", "@babel/runtime@^7.1.2", "@babel/runtime@^7.11.2", "@babel/runtime@^7.12.13", "@babel/runtime@^7.12.5", "@babel/runtime@^7.13.10", "@babel/runtime@^7.17.8", "@babel/runtime@^7.20.6", "@babel/runtime@^7.21.0", "@babel/runtime@^7.23.2", "@babel/runtime@^7.6.2", "@babel/runtime@^7.8.4", "@babel/runtime@^7.9.2": +"@babel/runtime@^7.0.0", "@babel/runtime@^7.1.2", "@babel/runtime@^7.11.2", "@babel/runtime@^7.12.13", "@babel/runtime@^7.12.5", "@babel/runtime@^7.13.10", "@babel/runtime@^7.17.8", "@babel/runtime@^7.20.6", "@babel/runtime@^7.21.0", "@babel/runtime@^7.23.2", "@babel/runtime@^7.6.2", "@babel/runtime@^7.9.2": version "7.26.10" resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.26.10.tgz#a07b4d8fa27af131a633d7b3524db803eb4764c2" integrity sha512-2WJMeRQPHKSPemqk/awGrAiuFfzBmOIPXKizAsVhWH9YJqLZ0H+HS4c8loHGgW6utJ3E/ejXQUsiGaQy2NZ9Fw== dependencies: regenerator-runtime "^0.14.0" -"@babel/template@^7.25.9", "@babel/template@^7.26.9", "@babel/template@^7.27.0", "@babel/template@^7.3.3": - version "7.27.0" - resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.27.0.tgz#b253e5406cc1df1c57dcd18f11760c2dbf40c0b4" - integrity sha512-2ncevenBqXI6qRMukPlXwHKHchC7RyMuu4xv5JBXRfOGVcTy1mXCD12qrp7Jsoxll1EV3+9sE4GugBVRjT2jFA== +"@babel/template@^7.27.1", "@babel/template@^7.3.3": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.27.1.tgz#b9e4f55c17a92312774dfbdde1b3c01c547bbae2" + integrity sha512-Fyo3ghWMqkHHpHQCoBs2VnYjR4iWFFjguTDEqA5WgZDOrFesVjMhMM2FSqTKSoUSDO1VQtavj8NFpdRBEvJTtg== dependencies: - "@babel/code-frame" "^7.26.2" - "@babel/parser" "^7.27.0" - "@babel/types" "^7.27.0" + "@babel/code-frame" "^7.27.1" + "@babel/parser" "^7.27.1" + "@babel/types" "^7.27.1" -"@babel/traverse@^7.13.0", "@babel/traverse@^7.25.9", "@babel/traverse@^7.26.10", "@babel/traverse@^7.26.5", "@babel/traverse@^7.26.8", "@babel/traverse@^7.27.0", "@babel/traverse@^7.4.5", "@babel/traverse@^7.7.0": - version "7.27.0" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.27.0.tgz#11d7e644779e166c0442f9a07274d02cd91d4a70" - integrity sha512-19lYZFzYVQkkHkl4Cy4WrAVcqBkgvV2YM2TU3xG6DIwO7O3ecbDPfW3yM3bjAGcqcQHi+CCtjMR3dIEHxsd6bA== +"@babel/traverse@^7.13.0", "@babel/traverse@^7.25.9", "@babel/traverse@^7.27.1", "@babel/traverse@^7.4.5", "@babel/traverse@^7.7.0": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.27.1.tgz#4db772902b133bbddd1c4f7a7ee47761c1b9f291" + integrity sha512-ZCYtZciz1IWJB4U61UPu4KEaqyfj+r5T1Q5mqPo+IBpcG9kHv30Z0aD8LXPgC1trYa6rK0orRyAhqUgk4MjmEg== dependencies: - "@babel/code-frame" "^7.26.2" - "@babel/generator" "^7.27.0" - "@babel/parser" "^7.27.0" - "@babel/template" "^7.27.0" - "@babel/types" "^7.27.0" + "@babel/code-frame" "^7.27.1" + "@babel/generator" "^7.27.1" + "@babel/parser" "^7.27.1" + "@babel/template" "^7.27.1" + "@babel/types" "^7.27.1" debug "^4.3.1" globals "^11.1.0" -"@babel/types@^7.0.0", "@babel/types@^7.25.9", "@babel/types@^7.26.10", "@babel/types@^7.27.0", "@babel/types@^7.3.0", "@babel/types@^7.3.3", "@babel/types@^7.4.4", "@babel/types@^7.7.0": - version "7.27.0" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.27.0.tgz#ef9acb6b06c3173f6632d993ecb6d4ae470b4559" - integrity sha512-H45s8fVLYjbhFH62dIJ3WtmJ6RSPt/3DRO0ZcT2SUiYiQyz3BLVb9ADEnLl91m74aQPS3AzzeajZHYOalWe3bg== +"@babel/types@^7.0.0", "@babel/types@^7.25.9", "@babel/types@^7.27.1", "@babel/types@^7.3.0", "@babel/types@^7.3.3", "@babel/types@^7.4.4", "@babel/types@^7.7.0": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.27.1.tgz#9defc53c16fc899e46941fc6901a9eea1c9d8560" + integrity sha512-+EzkxvLNfiUeKMgy/3luqfsCWFRXLb7U6wNQTk60tovuckwB15B191tJWvpp4HjiQWdJkCxO3Wbvc6jlk3Xb2Q== dependencies: - "@babel/helper-string-parser" "^7.25.9" - "@babel/helper-validator-identifier" "^7.25.9" + "@babel/helper-string-parser" "^7.27.1" + "@babel/helper-validator-identifier" "^7.27.1" "@bcoe/v8-coverage@^0.2.3": version "0.2.3" @@ -13811,13 +13841,6 @@ regenerator-runtime@^0.14.0: resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.14.0.tgz#5e19d68eb12d486f797e15a3c6a918f7cec5eb45" integrity "sha1-XhnWjrEtSG95fhWjxqkY987F60U= sha512-srw17NI0TUWHuGa5CFGGmhfNIeja30WMBfbslPNhf6JrqQlLN5gcrvig1oqPxiVaXb0oW0XRKtH6Nngs5lKCIA==" -regenerator-transform@^0.15.2: - version "0.15.2" - resolved "https://registry.yarnpkg.com/regenerator-transform/-/regenerator-transform-0.15.2.tgz#5bbae58b522098ebdf09bca2f83838929001c7a4" - integrity "sha1-W7rli1IgmOvfCbyi+Dg4kpABx6Q= sha512-hfMp2BoF0qOk3uc5V20ALGDS2ddjQaLrdl7xrGXvAIow7qeWRM2VA2HuCHkUKk9slq3VwEwLNK3DFBqDfPGYtg==" - dependencies: - "@babel/runtime" "^7.8.4" - regexp.prototype.flags@^1.5.1, regexp.prototype.flags@^1.5.3: version "1.5.3" resolved "https://registry.yarnpkg.com/regexp.prototype.flags/-/regexp.prototype.flags-1.5.3.tgz#b3ae40b1d2499b8350ab2c3fe6ef3845d3a96f42" From 810b7908e41135afd5c35a64e7ace46b098b4f4b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 6 May 2025 08:02:14 -0400 Subject: [PATCH 53/64] chore(deps): bump the aws group with 5 updates (#9136) Bumps the aws group with 5 updates: | Package | From | To | | --- | --- | --- | | [@aws-sdk/client-s3](https://github.com/aws/aws-sdk-js-v3/tree/HEAD/clients/client-s3) | `3.797.0` | `3.802.0` | | [@aws-sdk/lib-storage](https://github.com/aws/aws-sdk-js-v3/tree/HEAD/lib/lib-storage) | `3.797.0` | `3.802.0` | | [@aws-sdk/s3-presigned-post](https://github.com/aws/aws-sdk-js-v3/tree/HEAD/packages/s3-presigned-post) | `3.797.0` | `3.802.0` | | [@aws-sdk/s3-request-presigner](https://github.com/aws/aws-sdk-js-v3/tree/HEAD/packages/s3-request-presigner) | `3.797.0` | `3.802.0` | | [@aws-sdk/signature-v4-crt](https://github.com/aws/aws-sdk-js-v3/tree/HEAD/packages/signature-v4-crt) | `3.796.0` | `3.800.0` | Updates `@aws-sdk/client-s3` from 3.797.0 to 3.802.0 - [Release notes](https://github.com/aws/aws-sdk-js-v3/releases) - [Changelog](https://github.com/aws/aws-sdk-js-v3/blob/main/clients/client-s3/CHANGELOG.md) - [Commits](https://github.com/aws/aws-sdk-js-v3/commits/v3.802.0/clients/client-s3) Updates `@aws-sdk/lib-storage` from 3.797.0 to 3.802.0 - [Release notes](https://github.com/aws/aws-sdk-js-v3/releases) - [Changelog](https://github.com/aws/aws-sdk-js-v3/blob/main/lib/lib-storage/CHANGELOG.md) - [Commits](https://github.com/aws/aws-sdk-js-v3/commits/v3.802.0/lib/lib-storage) Updates `@aws-sdk/s3-presigned-post` from 3.797.0 to 3.802.0 - [Release notes](https://github.com/aws/aws-sdk-js-v3/releases) - [Changelog](https://github.com/aws/aws-sdk-js-v3/blob/main/packages/s3-presigned-post/CHANGELOG.md) - [Commits](https://github.com/aws/aws-sdk-js-v3/commits/v3.802.0/packages/s3-presigned-post) Updates `@aws-sdk/s3-request-presigner` from 3.797.0 to 3.802.0 - [Release notes](https://github.com/aws/aws-sdk-js-v3/releases) - [Changelog](https://github.com/aws/aws-sdk-js-v3/blob/main/packages/s3-request-presigner/CHANGELOG.md) - [Commits](https://github.com/aws/aws-sdk-js-v3/commits/v3.802.0/packages/s3-request-presigner) Updates `@aws-sdk/signature-v4-crt` from 3.796.0 to 3.800.0 - [Release notes](https://github.com/aws/aws-sdk-js-v3/releases) - [Changelog](https://github.com/aws/aws-sdk-js-v3/blob/main/packages/signature-v4-crt/CHANGELOG.md) - [Commits](https://github.com/aws/aws-sdk-js-v3/commits/v3.800.0/packages/signature-v4-crt) --- updated-dependencies: - dependency-name: "@aws-sdk/client-s3" dependency-version: 3.802.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: aws - dependency-name: "@aws-sdk/lib-storage" dependency-version: 3.802.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: aws - dependency-name: "@aws-sdk/s3-presigned-post" dependency-version: 3.802.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: aws - dependency-name: "@aws-sdk/s3-request-presigner" dependency-version: 3.802.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: aws - dependency-name: "@aws-sdk/signature-v4-crt" dependency-version: 3.800.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: aws ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 10 +- yarn.lock | 412 +++++++++++++++++++++++++-------------------------- 2 files changed, 211 insertions(+), 211 deletions(-) diff --git a/package.json b/package.json index ed2b9544e8..337a2efc94 100644 --- a/package.json +++ b/package.json @@ -48,11 +48,11 @@ "> 0.25%, not dead" ], "dependencies": { - "@aws-sdk/client-s3": "3.797.0", - "@aws-sdk/lib-storage": "3.797.0", - "@aws-sdk/s3-presigned-post": "3.797.0", - "@aws-sdk/s3-request-presigner": "3.797.0", - "@aws-sdk/signature-v4-crt": "^3.796.0", + "@aws-sdk/client-s3": "3.803.0", + "@aws-sdk/lib-storage": "3.803.0", + "@aws-sdk/s3-presigned-post": "3.803.0", + "@aws-sdk/s3-request-presigner": "3.803.0", + "@aws-sdk/signature-v4-crt": "^3.803.0", "@babel/core": "^7.27.1", "@babel/plugin-proposal-decorators": "^7.27.1", "@babel/plugin-transform-class-properties": "^7.27.1", diff --git a/yarn.lock b/yarn.lock index e7b1a7cf05..9a594bc55b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -105,35 +105,35 @@ "@smithy/util-utf8" "^2.0.0" tslib "^2.6.2" -"@aws-sdk/client-s3@3.797.0": - version "3.797.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/client-s3/-/client-s3-3.797.0.tgz#27d809ddc08b4f026bdf3b01c1c43c5cb5d06e43" - integrity sha512-N7pB94mXi4fCt+rYmR9TzfbbwZsWs6Mnk/jDNX9sAZyWkZQnS3AZ/nRtnUmdCimdnOPOMNVjmAoZ4mW3Ff8LDw== +"@aws-sdk/client-s3@3.803.0": + version "3.803.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/client-s3/-/client-s3-3.803.0.tgz#a1a39be3de26c1e6cc53ca8e5df6aa192b5b15eb" + integrity sha512-Y8gw9Lun2qV5wU2diAqB1qEynV7wiz/oM9rtwhLagMvB6u9uO65+0qIN/gDInReCyI0XQ7sULqW8FjYhfSnWhQ== dependencies: "@aws-crypto/sha1-browser" "5.2.0" "@aws-crypto/sha256-browser" "5.2.0" "@aws-crypto/sha256-js" "5.2.0" - "@aws-sdk/core" "3.796.0" - "@aws-sdk/credential-provider-node" "3.797.0" + "@aws-sdk/core" "3.799.0" + "@aws-sdk/credential-provider-node" "3.803.0" "@aws-sdk/middleware-bucket-endpoint" "3.775.0" "@aws-sdk/middleware-expect-continue" "3.775.0" - "@aws-sdk/middleware-flexible-checksums" "3.796.0" + "@aws-sdk/middleware-flexible-checksums" "3.799.0" "@aws-sdk/middleware-host-header" "3.775.0" "@aws-sdk/middleware-location-constraint" "3.775.0" "@aws-sdk/middleware-logger" "3.775.0" "@aws-sdk/middleware-recursion-detection" "3.775.0" - "@aws-sdk/middleware-sdk-s3" "3.796.0" + "@aws-sdk/middleware-sdk-s3" "3.799.0" "@aws-sdk/middleware-ssec" "3.775.0" - "@aws-sdk/middleware-user-agent" "3.796.0" + "@aws-sdk/middleware-user-agent" "3.799.0" "@aws-sdk/region-config-resolver" "3.775.0" - "@aws-sdk/signature-v4-multi-region" "3.796.0" + "@aws-sdk/signature-v4-multi-region" "3.803.0" "@aws-sdk/types" "3.775.0" "@aws-sdk/util-endpoints" "3.787.0" "@aws-sdk/util-user-agent-browser" "3.775.0" - "@aws-sdk/util-user-agent-node" "3.796.0" + "@aws-sdk/util-user-agent-node" "3.799.0" "@aws-sdk/xml-builder" "3.775.0" "@smithy/config-resolver" "^4.1.0" - "@smithy/core" "^3.2.0" + "@smithy/core" "^3.3.0" "@smithy/eventstream-serde-browser" "^4.0.2" "@smithy/eventstream-serde-config-resolver" "^4.1.0" "@smithy/eventstream-serde-node" "^4.0.2" @@ -144,129 +144,129 @@ "@smithy/invalid-dependency" "^4.0.2" "@smithy/md5-js" "^4.0.2" "@smithy/middleware-content-length" "^4.0.2" - "@smithy/middleware-endpoint" "^4.1.0" - "@smithy/middleware-retry" "^4.1.0" + "@smithy/middleware-endpoint" "^4.1.1" + "@smithy/middleware-retry" "^4.1.2" "@smithy/middleware-serde" "^4.0.3" "@smithy/middleware-stack" "^4.0.2" "@smithy/node-config-provider" "^4.0.2" "@smithy/node-http-handler" "^4.0.4" "@smithy/protocol-http" "^5.1.0" - "@smithy/smithy-client" "^4.2.0" + "@smithy/smithy-client" "^4.2.1" "@smithy/types" "^4.2.0" "@smithy/url-parser" "^4.0.2" "@smithy/util-base64" "^4.0.0" "@smithy/util-body-length-browser" "^4.0.0" "@smithy/util-body-length-node" "^4.0.0" - "@smithy/util-defaults-mode-browser" "^4.0.8" - "@smithy/util-defaults-mode-node" "^4.0.8" + "@smithy/util-defaults-mode-browser" "^4.0.9" + "@smithy/util-defaults-mode-node" "^4.0.9" "@smithy/util-endpoints" "^3.0.2" "@smithy/util-middleware" "^4.0.2" - "@smithy/util-retry" "^4.0.2" + "@smithy/util-retry" "^4.0.3" "@smithy/util-stream" "^4.2.0" "@smithy/util-utf8" "^4.0.0" "@smithy/util-waiter" "^4.0.3" tslib "^2.6.2" -"@aws-sdk/client-sso@3.797.0": - version "3.797.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/client-sso/-/client-sso-3.797.0.tgz#94d123568830788980cc8712a94d3b20de735e4c" - integrity sha512-9xuR918p7tShR67ZL+AOSbydpJxSHAOdXcQswxxWR/hKCF7tULX7tyL3gNo3l/ETp0CDcStvorOdH/nCbzEOjw== +"@aws-sdk/client-sso@3.803.0": + version "3.803.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/client-sso/-/client-sso-3.803.0.tgz#16a4611e279694effcbb65d9d65ed1d64c635855" + integrity sha512-TT3BRD1yiL3IGXBKfq560vvEdyOJtJr8bp+R82dD6P0IoS8aFcNtF822BOJy7CqvxksOc3hQKLaPVzE82gE8Ow== dependencies: "@aws-crypto/sha256-browser" "5.2.0" "@aws-crypto/sha256-js" "5.2.0" - "@aws-sdk/core" "3.796.0" + "@aws-sdk/core" "3.799.0" "@aws-sdk/middleware-host-header" "3.775.0" "@aws-sdk/middleware-logger" "3.775.0" "@aws-sdk/middleware-recursion-detection" "3.775.0" - "@aws-sdk/middleware-user-agent" "3.796.0" + "@aws-sdk/middleware-user-agent" "3.799.0" "@aws-sdk/region-config-resolver" "3.775.0" "@aws-sdk/types" "3.775.0" "@aws-sdk/util-endpoints" "3.787.0" "@aws-sdk/util-user-agent-browser" "3.775.0" - "@aws-sdk/util-user-agent-node" "3.796.0" + "@aws-sdk/util-user-agent-node" "3.799.0" "@smithy/config-resolver" "^4.1.0" - "@smithy/core" "^3.2.0" + "@smithy/core" "^3.3.0" "@smithy/fetch-http-handler" "^5.0.2" "@smithy/hash-node" "^4.0.2" "@smithy/invalid-dependency" "^4.0.2" "@smithy/middleware-content-length" "^4.0.2" - "@smithy/middleware-endpoint" "^4.1.0" - "@smithy/middleware-retry" "^4.1.0" + "@smithy/middleware-endpoint" "^4.1.1" + "@smithy/middleware-retry" "^4.1.2" "@smithy/middleware-serde" "^4.0.3" "@smithy/middleware-stack" "^4.0.2" "@smithy/node-config-provider" "^4.0.2" "@smithy/node-http-handler" "^4.0.4" "@smithy/protocol-http" "^5.1.0" - "@smithy/smithy-client" "^4.2.0" + "@smithy/smithy-client" "^4.2.1" "@smithy/types" "^4.2.0" "@smithy/url-parser" "^4.0.2" "@smithy/util-base64" "^4.0.0" "@smithy/util-body-length-browser" "^4.0.0" "@smithy/util-body-length-node" "^4.0.0" - "@smithy/util-defaults-mode-browser" "^4.0.8" - "@smithy/util-defaults-mode-node" "^4.0.8" + "@smithy/util-defaults-mode-browser" "^4.0.9" + "@smithy/util-defaults-mode-node" "^4.0.9" "@smithy/util-endpoints" "^3.0.2" "@smithy/util-middleware" "^4.0.2" - "@smithy/util-retry" "^4.0.2" + "@smithy/util-retry" "^4.0.3" "@smithy/util-utf8" "^4.0.0" tslib "^2.6.2" -"@aws-sdk/core@3.796.0": - version "3.796.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/core/-/core-3.796.0.tgz#6076b78772c1eb97ec6ea9064c85ce500e0aa889" - integrity sha512-tH8Sp7lCxISVoLnkyv4AouuXs2CDlMhTuesWa0lq2NX1f+DXsMwSBtN37ttZdpFMw3F8mWdsJt27X9h2Oq868A== +"@aws-sdk/core@3.799.0": + version "3.799.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/core/-/core-3.799.0.tgz#383f903ede137df108dcd5f817074515d2b1242e" + integrity sha512-hkKF3Zpc6+H8GI1rlttYVRh9uEE77cqAzLmLpY3iu7sql8cZgPERRBfaFct8p1SaDyrksLNiboD1vKW58mbsYg== dependencies: "@aws-sdk/types" "3.775.0" - "@smithy/core" "^3.2.0" + "@smithy/core" "^3.3.0" "@smithy/node-config-provider" "^4.0.2" "@smithy/property-provider" "^4.0.2" "@smithy/protocol-http" "^5.1.0" "@smithy/signature-v4" "^5.1.0" - "@smithy/smithy-client" "^4.2.0" + "@smithy/smithy-client" "^4.2.1" "@smithy/types" "^4.2.0" "@smithy/util-middleware" "^4.0.2" fast-xml-parser "4.4.1" tslib "^2.6.2" -"@aws-sdk/credential-provider-env@3.796.0": - version "3.796.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/credential-provider-env/-/credential-provider-env-3.796.0.tgz#4ed6903814868b0f9daa8c8db449b1f1adcda041" - integrity sha512-kQzGKm4IOYYO6vUrai2JocNwhJm4Aml2BsAV+tBhFhhkutE7khf9PUucoVjB78b0J48nF+kdSacqzY+gB81/Uw== +"@aws-sdk/credential-provider-env@3.799.0": + version "3.799.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/credential-provider-env/-/credential-provider-env-3.799.0.tgz#d933265b54b18ef1232762c318ff0d75bc7785f9" + integrity sha512-vT/SSWtbUIOW/U21qgEySmmO44SFWIA7WeQPX1OrI8WJ5n7OEI23JWLHjLvHTkYmuZK6z1rPcv7HzRgmuGRibA== dependencies: - "@aws-sdk/core" "3.796.0" + "@aws-sdk/core" "3.799.0" "@aws-sdk/types" "3.775.0" "@smithy/property-provider" "^4.0.2" "@smithy/types" "^4.2.0" tslib "^2.6.2" -"@aws-sdk/credential-provider-http@3.796.0": - version "3.796.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/credential-provider-http/-/credential-provider-http-3.796.0.tgz#7f36074021b2605dba4b758b4b0ca98fb5b965ad" - integrity sha512-wWOT6VAHIKOuHdKFGm1iyKvx7f6+Kc/YTzFWJPuT+l+CPlXR6ylP1UMIDsHHLKpMzsrh3CH77QDsjkhQrnKkfg== +"@aws-sdk/credential-provider-http@3.799.0": + version "3.799.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/credential-provider-http/-/credential-provider-http-3.799.0.tgz#9286235bb30c4f22fbeac0ecf2fe5e5f99aaa282" + integrity sha512-2CjBpOWmhaPAExOgHnIB5nOkS5ef+mfRlJ1JC4nsnjAx0nrK4tk0XRE0LYz11P3+ue+a86cU8WTmBo+qjnGxPQ== dependencies: - "@aws-sdk/core" "3.796.0" + "@aws-sdk/core" "3.799.0" "@aws-sdk/types" "3.775.0" "@smithy/fetch-http-handler" "^5.0.2" "@smithy/node-http-handler" "^4.0.4" "@smithy/property-provider" "^4.0.2" "@smithy/protocol-http" "^5.1.0" - "@smithy/smithy-client" "^4.2.0" + "@smithy/smithy-client" "^4.2.1" "@smithy/types" "^4.2.0" "@smithy/util-stream" "^4.2.0" tslib "^2.6.2" -"@aws-sdk/credential-provider-ini@3.797.0": - version "3.797.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/credential-provider-ini/-/credential-provider-ini-3.797.0.tgz#e617edac6dbd761e13826d49092b85a337bf29a2" - integrity sha512-Zpj6pJ2hnebrhLDr+x61ArMUkjHG6mfJRfamHxeVTgZkhLcwHjC5aM4u9pWTVugIaPY+VBtgkKPbi3TRbHlt2g== +"@aws-sdk/credential-provider-ini@3.803.0": + version "3.803.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/credential-provider-ini/-/credential-provider-ini-3.803.0.tgz#5f831e53cf475756052aba81b128d66d8ba5a52f" + integrity sha512-XtbFftJex18GobpRWJxg5V7stVwvmV2gdBYW+zRM0YW6NZAR4NP/4vcc9ktM3++BWW5OF4Kvl7Nu7N4mAzRHmw== dependencies: - "@aws-sdk/core" "3.796.0" - "@aws-sdk/credential-provider-env" "3.796.0" - "@aws-sdk/credential-provider-http" "3.796.0" - "@aws-sdk/credential-provider-process" "3.796.0" - "@aws-sdk/credential-provider-sso" "3.797.0" - "@aws-sdk/credential-provider-web-identity" "3.797.0" - "@aws-sdk/nested-clients" "3.797.0" + "@aws-sdk/core" "3.799.0" + "@aws-sdk/credential-provider-env" "3.799.0" + "@aws-sdk/credential-provider-http" "3.799.0" + "@aws-sdk/credential-provider-process" "3.799.0" + "@aws-sdk/credential-provider-sso" "3.803.0" + "@aws-sdk/credential-provider-web-identity" "3.803.0" + "@aws-sdk/nested-clients" "3.803.0" "@aws-sdk/types" "3.775.0" "@smithy/credential-provider-imds" "^4.0.2" "@smithy/property-provider" "^4.0.2" @@ -274,17 +274,17 @@ "@smithy/types" "^4.2.0" tslib "^2.6.2" -"@aws-sdk/credential-provider-node@3.797.0": - version "3.797.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/credential-provider-node/-/credential-provider-node-3.797.0.tgz#bf82e239b14c8fcc7da660c2bc1ec042123638d9" - integrity sha512-xJSWvvnmzEfHbqbpN4F3E3mI9+zJ/VWLGiKOjzX1Inbspa5WqNn2GoMamolZR2TvvZS4F3Hp73TD1WoBzkIjuw== +"@aws-sdk/credential-provider-node@3.803.0": + version "3.803.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/credential-provider-node/-/credential-provider-node-3.803.0.tgz#bcfd9638f7f8e8a1b78fc2c58346daf7f67389e2" + integrity sha512-lPdRYbjxwmv7gRqbaEe1Y1Yl5fD4c43AuK3P31eKjf1j41hZEQ0dg9a9KLk7i6ehEoVsxewnJrvbC2pVoYrCmQ== dependencies: - "@aws-sdk/credential-provider-env" "3.796.0" - "@aws-sdk/credential-provider-http" "3.796.0" - "@aws-sdk/credential-provider-ini" "3.797.0" - "@aws-sdk/credential-provider-process" "3.796.0" - "@aws-sdk/credential-provider-sso" "3.797.0" - "@aws-sdk/credential-provider-web-identity" "3.797.0" + "@aws-sdk/credential-provider-env" "3.799.0" + "@aws-sdk/credential-provider-http" "3.799.0" + "@aws-sdk/credential-provider-ini" "3.803.0" + "@aws-sdk/credential-provider-process" "3.799.0" + "@aws-sdk/credential-provider-sso" "3.803.0" + "@aws-sdk/credential-provider-web-identity" "3.803.0" "@aws-sdk/types" "3.775.0" "@smithy/credential-provider-imds" "^4.0.2" "@smithy/property-provider" "^4.0.2" @@ -292,61 +292,61 @@ "@smithy/types" "^4.2.0" tslib "^2.6.2" -"@aws-sdk/credential-provider-process@3.796.0": - version "3.796.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/credential-provider-process/-/credential-provider-process-3.796.0.tgz#d22d8adf73985fb218ff74365cd86b71bbd64513" - integrity sha512-r4e8/4AdKn/qQbRVocW7oXkpoiuXdTv0qty8AASNLnbQnT1vjD1bvmP6kp4fbHPWgwY8I9h0Dqjp49uy9Bqyuw== +"@aws-sdk/credential-provider-process@3.799.0": + version "3.799.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/credential-provider-process/-/credential-provider-process-3.799.0.tgz#34e8b3d7c889bbb87dfe7c171255a8b99a34df25" + integrity sha512-g8jmNs2k98WNHMYcea1YKA+7ao2Ma4w0P42Dz4YpcI155pQHxHx25RwbOG+rsAKuo3bKwkW53HVE/ZTKhcWFgw== dependencies: - "@aws-sdk/core" "3.796.0" + "@aws-sdk/core" "3.799.0" "@aws-sdk/types" "3.775.0" "@smithy/property-provider" "^4.0.2" "@smithy/shared-ini-file-loader" "^4.0.2" "@smithy/types" "^4.2.0" tslib "^2.6.2" -"@aws-sdk/credential-provider-sso@3.797.0": - version "3.797.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/credential-provider-sso/-/credential-provider-sso-3.797.0.tgz#ea22714498157c937acd3170660b10ae0348366a" - integrity sha512-VlyWnjTsTnBXqXcEW0nw3S7nj00n9fYwF6uU6HPO9t860yIySG01lNPAWTvAt3DfVL5SRS0GANriCZF6ohcMcQ== +"@aws-sdk/credential-provider-sso@3.803.0": + version "3.803.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/credential-provider-sso/-/credential-provider-sso-3.803.0.tgz#8a0a48a9acaab8f4e5c172427cc476a2f3513aaa" + integrity sha512-HEAcxSHrHxVekGnZqjFrkqdYAf4jFiZIMhuh0jqiqY6A4udEyXy1V623HVcTz/XXj6UBRnyD+zmOmlbzBvkfQg== dependencies: - "@aws-sdk/client-sso" "3.797.0" - "@aws-sdk/core" "3.796.0" - "@aws-sdk/token-providers" "3.797.0" + "@aws-sdk/client-sso" "3.803.0" + "@aws-sdk/core" "3.799.0" + "@aws-sdk/token-providers" "3.803.0" "@aws-sdk/types" "3.775.0" "@smithy/property-provider" "^4.0.2" "@smithy/shared-ini-file-loader" "^4.0.2" "@smithy/types" "^4.2.0" tslib "^2.6.2" -"@aws-sdk/credential-provider-web-identity@3.797.0": - version "3.797.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/credential-provider-web-identity/-/credential-provider-web-identity-3.797.0.tgz#e52b5a054a71f83ffafe3461b41851d5008d84de" - integrity sha512-DIb05FEmdOX7bNsqSVEAB3UkaDgrYHonQ2+gcBLqZ7LoDNnovHIlvC5jii93usgEStxITZstnzw+49keNEgVWw== +"@aws-sdk/credential-provider-web-identity@3.803.0": + version "3.803.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/credential-provider-web-identity/-/credential-provider-web-identity-3.803.0.tgz#9612bd4e2a2bdf2d3826f18b2138f8bd996605bb" + integrity sha512-oChnEpwI25OW4GPvhI1VnXM3IQEkDhESGFZd5JHzJDHyvSF2NU58V86jkJyaa4H4X25IbGaThuulNI5xCOngjw== dependencies: - "@aws-sdk/core" "3.796.0" - "@aws-sdk/nested-clients" "3.797.0" + "@aws-sdk/core" "3.799.0" + "@aws-sdk/nested-clients" "3.803.0" "@aws-sdk/types" "3.775.0" "@smithy/property-provider" "^4.0.2" "@smithy/types" "^4.2.0" tslib "^2.6.2" -"@aws-sdk/crt-loader@3.796.0": - version "3.796.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/crt-loader/-/crt-loader-3.796.0.tgz#1cba5b2ea9f50b7a904cb5902a7751b90b65b1b3" - integrity sha512-dfTl4hCDKJSJTq4mPSQsv65p9XlYof+SVWKxQRu6OQBCOuhGPEhr7vN0byONBdwjhiY0WECjCANDi84lDVysdQ== +"@aws-sdk/crt-loader@3.799.0": + version "3.799.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/crt-loader/-/crt-loader-3.799.0.tgz#d9552a6fd7ae533b79de23a6f82f39ebfd752053" + integrity sha512-I35Vu2UdqZso/tm1qcCNRhXEmkzbikeG3zmrcIhtTJajnOIyurZj92N9mcwXfRVQXc3N6WUduv+4pRKc7PAHmw== dependencies: - "@aws-sdk/util-user-agent-node" "3.796.0" + "@aws-sdk/util-user-agent-node" "3.799.0" aws-crt "^1.24.0" tslib "^2.6.2" -"@aws-sdk/lib-storage@3.797.0": - version "3.797.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/lib-storage/-/lib-storage-3.797.0.tgz#8947c3f27fcd7b77ce171929b2ee96feed9ba3b7" - integrity sha512-hGacJXiFBnhkDhDuirptViR0ZfpvE6ENt+xJFV76F5OX8RvO7UhEkq9wdq/GzlSwrPB2XBfoYQgdtHJpjHs2zA== +"@aws-sdk/lib-storage@3.803.0": + version "3.803.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/lib-storage/-/lib-storage-3.803.0.tgz#71f08ffc449f33681a133e3d0a2f0570b7547990" + integrity sha512-MDep7r9jmLzadMgDHsuElmCa1gPv79pAieswqFif6fSyYxTHuuhNH/znJDQceY4JIq4J9k+te+VFhv7/OcmBZg== dependencies: "@smithy/abort-controller" "^4.0.2" - "@smithy/middleware-endpoint" "^4.1.0" - "@smithy/smithy-client" "^4.2.0" + "@smithy/middleware-endpoint" "^4.1.1" + "@smithy/smithy-client" "^4.2.1" buffer "5.6.0" events "3.3.0" stream-browserify "3.0.0" @@ -375,15 +375,15 @@ "@smithy/types" "^4.2.0" tslib "^2.6.2" -"@aws-sdk/middleware-flexible-checksums@3.796.0": - version "3.796.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/middleware-flexible-checksums/-/middleware-flexible-checksums-3.796.0.tgz#c5a13c5dc7fd217e3d3514d3a75ae71c4b0ce5c6" - integrity sha512-JTqnyzGlbvXDcEnBtd5LFNrCFKUHnGyp/V9+BkvzNP02WXABLWzYvj1TCaf5pQySwK/b4kVn5lvbpTi0rXqjZw== +"@aws-sdk/middleware-flexible-checksums@3.799.0": + version "3.799.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/middleware-flexible-checksums/-/middleware-flexible-checksums-3.799.0.tgz#218ac9b04e1d0cefcec0634f42523ca977ecbaaa" + integrity sha512-vBIAdDl2neaFiUMxyr7dAtX7m9Iw5c0bz7OirD0JGW0nYn0mBcqKpFZEU75ewA5p2+Cm7RQDdt6099ne3gj0WA== dependencies: "@aws-crypto/crc32" "5.2.0" "@aws-crypto/crc32c" "5.2.0" "@aws-crypto/util" "5.2.0" - "@aws-sdk/core" "3.796.0" + "@aws-sdk/core" "3.799.0" "@aws-sdk/types" "3.775.0" "@smithy/is-array-buffer" "^4.0.0" "@smithy/node-config-provider" "^4.0.2" @@ -432,19 +432,19 @@ "@smithy/types" "^4.2.0" tslib "^2.6.2" -"@aws-sdk/middleware-sdk-s3@3.796.0": - version "3.796.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/middleware-sdk-s3/-/middleware-sdk-s3-3.796.0.tgz#f20d77f02f27fd47178500581ae340f012652004" - integrity sha512-5o78oE79sGOtYkL7Up02h2nmr9UhGQZJgxE29EBdTw4dZ1EaA46L+C8oA+fBCmAB5xPQsjQqvhRrsr4Lcp+jZQ== +"@aws-sdk/middleware-sdk-s3@3.799.0": + version "3.799.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/middleware-sdk-s3/-/middleware-sdk-s3-3.799.0.tgz#ed5a492b2c32ae64f5a8c8b3127a36b0c1ddba90" + integrity sha512-Zwdge5NArgcJwPuGZwgfXY6XXkWEBmMS9dqu5g3DcfHmZUuSjQUqmOsDdSZlE3RFHrDAEbuGQlrFUE8zuwdKQA== dependencies: - "@aws-sdk/core" "3.796.0" + "@aws-sdk/core" "3.799.0" "@aws-sdk/types" "3.775.0" "@aws-sdk/util-arn-parser" "3.723.0" - "@smithy/core" "^3.2.0" + "@smithy/core" "^3.3.0" "@smithy/node-config-provider" "^4.0.2" "@smithy/protocol-http" "^5.1.0" "@smithy/signature-v4" "^5.1.0" - "@smithy/smithy-client" "^4.2.0" + "@smithy/smithy-client" "^4.2.1" "@smithy/types" "^4.2.0" "@smithy/util-config-provider" "^4.0.0" "@smithy/util-middleware" "^4.0.2" @@ -461,60 +461,60 @@ "@smithy/types" "^4.2.0" tslib "^2.6.2" -"@aws-sdk/middleware-user-agent@3.796.0": - version "3.796.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/middleware-user-agent/-/middleware-user-agent-3.796.0.tgz#80149d7f9034d41d35de88d96a6b73c1cb06413b" - integrity sha512-IeNg+3jNWT37J45opi5Jx89hGF0lOnZjiNwlMp3rKq7PlOqy8kWq5J1Gxk0W3tIkPpuf68CtBs/QFrRXWOjsZw== +"@aws-sdk/middleware-user-agent@3.799.0": + version "3.799.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/middleware-user-agent/-/middleware-user-agent-3.799.0.tgz#e120e6e1341bcba5427cee0385172170e4615186" + integrity sha512-TropQZanbOTxa+p+Nl4fWkzlRhgFwDfW+Wb6TR3jZN7IXHNlPpgGFpdrgvBExhW/RBhqr+94OsR8Ou58lp3hhA== dependencies: - "@aws-sdk/core" "3.796.0" + "@aws-sdk/core" "3.799.0" "@aws-sdk/types" "3.775.0" "@aws-sdk/util-endpoints" "3.787.0" - "@smithy/core" "^3.2.0" + "@smithy/core" "^3.3.0" "@smithy/protocol-http" "^5.1.0" "@smithy/types" "^4.2.0" tslib "^2.6.2" -"@aws-sdk/nested-clients@3.797.0": - version "3.797.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/nested-clients/-/nested-clients-3.797.0.tgz#59699196a9b3fa43b021bdf1715e531d74885f75" - integrity sha512-xCsRKdsv0GAg9E28fvYBdC3JR2xdtZ2o41MVknOs+pSFtMsZm3SsgxObN35p1OTMk/o/V0LORGVLnFQMlc5QiA== +"@aws-sdk/nested-clients@3.803.0": + version "3.803.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/nested-clients/-/nested-clients-3.803.0.tgz#aa5852a9c8b48bcad903ac841952b93ffd0bd3b3" + integrity sha512-wiWiYaFQxK2u37G9IOXuWkHelEbU8ulLxdHpoPf0TSu/1boqLW7fcofuZATAvFcvigQx3oebwO8G4c/mmixTTw== dependencies: "@aws-crypto/sha256-browser" "5.2.0" "@aws-crypto/sha256-js" "5.2.0" - "@aws-sdk/core" "3.796.0" + "@aws-sdk/core" "3.799.0" "@aws-sdk/middleware-host-header" "3.775.0" "@aws-sdk/middleware-logger" "3.775.0" "@aws-sdk/middleware-recursion-detection" "3.775.0" - "@aws-sdk/middleware-user-agent" "3.796.0" + "@aws-sdk/middleware-user-agent" "3.799.0" "@aws-sdk/region-config-resolver" "3.775.0" "@aws-sdk/types" "3.775.0" "@aws-sdk/util-endpoints" "3.787.0" "@aws-sdk/util-user-agent-browser" "3.775.0" - "@aws-sdk/util-user-agent-node" "3.796.0" + "@aws-sdk/util-user-agent-node" "3.799.0" "@smithy/config-resolver" "^4.1.0" - "@smithy/core" "^3.2.0" + "@smithy/core" "^3.3.0" "@smithy/fetch-http-handler" "^5.0.2" "@smithy/hash-node" "^4.0.2" "@smithy/invalid-dependency" "^4.0.2" "@smithy/middleware-content-length" "^4.0.2" - "@smithy/middleware-endpoint" "^4.1.0" - "@smithy/middleware-retry" "^4.1.0" + "@smithy/middleware-endpoint" "^4.1.1" + "@smithy/middleware-retry" "^4.1.2" "@smithy/middleware-serde" "^4.0.3" "@smithy/middleware-stack" "^4.0.2" "@smithy/node-config-provider" "^4.0.2" "@smithy/node-http-handler" "^4.0.4" "@smithy/protocol-http" "^5.1.0" - "@smithy/smithy-client" "^4.2.0" + "@smithy/smithy-client" "^4.2.1" "@smithy/types" "^4.2.0" "@smithy/url-parser" "^4.0.2" "@smithy/util-base64" "^4.0.0" "@smithy/util-body-length-browser" "^4.0.0" "@smithy/util-body-length-node" "^4.0.0" - "@smithy/util-defaults-mode-browser" "^4.0.8" - "@smithy/util-defaults-mode-node" "^4.0.8" + "@smithy/util-defaults-mode-browser" "^4.0.9" + "@smithy/util-defaults-mode-node" "^4.0.9" "@smithy/util-endpoints" "^3.0.2" "@smithy/util-middleware" "^4.0.2" - "@smithy/util-retry" "^4.0.2" + "@smithy/util-retry" "^4.0.3" "@smithy/util-utf8" "^4.0.0" tslib "^2.6.2" @@ -530,42 +530,42 @@ "@smithy/util-middleware" "^4.0.2" tslib "^2.6.2" -"@aws-sdk/s3-presigned-post@3.797.0": - version "3.797.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/s3-presigned-post/-/s3-presigned-post-3.797.0.tgz#37f87d205bbb649c82ecd0ce1831755e4ff25d7b" - integrity sha512-imfnmmH4P6hVh7NE51wP5FoBzyzph2dYqzAC/bF2bXjCv+/FaiPEt598K0A1mt4BUB5Y+0J3GcigOwzWHFU/SA== +"@aws-sdk/s3-presigned-post@3.803.0": + version "3.803.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/s3-presigned-post/-/s3-presigned-post-3.803.0.tgz#b3909867960a6f2754376626e604516d7a04a35b" + integrity sha512-+KImbVhKglyGE9AoQbpPAntabuLf7kt89Rh3TJYgb+sgoPx51sRYQEBqJYIY2NRuvPY/E3Gm0X7CH+0YTBIVmA== dependencies: - "@aws-sdk/client-s3" "3.797.0" + "@aws-sdk/client-s3" "3.803.0" "@aws-sdk/types" "3.775.0" "@aws-sdk/util-format-url" "3.775.0" - "@smithy/middleware-endpoint" "^4.1.0" + "@smithy/middleware-endpoint" "^4.1.1" "@smithy/signature-v4" "^5.1.0" "@smithy/types" "^4.2.0" "@smithy/util-hex-encoding" "^4.0.0" "@smithy/util-utf8" "^4.0.0" tslib "^2.6.2" -"@aws-sdk/s3-request-presigner@3.797.0": - version "3.797.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/s3-request-presigner/-/s3-request-presigner-3.797.0.tgz#f375beb8a892f2b8452d0d6da38bd60f46afc4ab" - integrity sha512-ncEsGwmQIkXi3IREbGLC6X5sY38WM1WUAdaU5uQmBPOGEVQHtDyrIObBsIzK99j83SGWi8RqO7/n0jMGZPmeQw== +"@aws-sdk/s3-request-presigner@3.803.0": + version "3.803.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/s3-request-presigner/-/s3-request-presigner-3.803.0.tgz#6bd579dfafcd547edab2cebdeb6526029c8d8599" + integrity sha512-DsLkGqV3FrnZxTS8Z5ZvmiiTjR/zD/V4piNG1EL5uG3tLEtIDjeTQOEnA8fdQaGl0m/SI6TDW/L3J3BIFfg34g== dependencies: - "@aws-sdk/signature-v4-multi-region" "3.796.0" + "@aws-sdk/signature-v4-multi-region" "3.803.0" "@aws-sdk/types" "3.775.0" "@aws-sdk/util-format-url" "3.775.0" - "@smithy/middleware-endpoint" "^4.1.0" + "@smithy/middleware-endpoint" "^4.1.1" "@smithy/protocol-http" "^5.1.0" - "@smithy/smithy-client" "^4.2.0" + "@smithy/smithy-client" "^4.2.1" "@smithy/types" "^4.2.0" tslib "^2.6.2" -"@aws-sdk/signature-v4-crt@^3.796.0": - version "3.796.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/signature-v4-crt/-/signature-v4-crt-3.796.0.tgz#28df0cf702aa7e2c5e50e359776bf0f36b648e0b" - integrity sha512-RCYhLuRE8mhzpE5DzU3Mu11M1KdC480OQ+coB/h0c39VlYkcE8MGTB+eOjGOoYQx3RtFBs/y0RTSR4kj8Oo21Q== +"@aws-sdk/signature-v4-crt@^3.803.0": + version "3.803.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/signature-v4-crt/-/signature-v4-crt-3.803.0.tgz#3f817381719fb2ca5bd610bc3e8696ea7a5766c7" + integrity sha512-HjJIBJk7IKPNoTWwxLsVEfBf2kiY5FVZvcS1kOucpfz/J/3In/ZguX+3qs3ASOrbX7bSf/XbUVP2aETgoKCFvQ== dependencies: - "@aws-sdk/crt-loader" "3.796.0" - "@aws-sdk/signature-v4-multi-region" "3.796.0" + "@aws-sdk/crt-loader" "3.799.0" + "@aws-sdk/signature-v4-multi-region" "3.803.0" "@aws-sdk/types" "3.775.0" "@smithy/querystring-parser" "^4.0.2" "@smithy/signature-v4" "^5.1.0" @@ -573,24 +573,24 @@ "@smithy/util-middleware" "^4.0.2" tslib "^2.6.2" -"@aws-sdk/signature-v4-multi-region@3.796.0": - version "3.796.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/signature-v4-multi-region/-/signature-v4-multi-region-3.796.0.tgz#b32b0ee252c87a7c18c215407b1f189927ef850c" - integrity sha512-JAOLdvazTc9HlTFslSrIOrKRMuOruuM3FeGw0hyfLP/RIbjd9bqe/xLIzDSJr3wpCpJs0sXoofwJgXtgTipvjA== +"@aws-sdk/signature-v4-multi-region@3.803.0": + version "3.803.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/signature-v4-multi-region/-/signature-v4-multi-region-3.803.0.tgz#8eef7dfb2c40e77881a42a9972a70af3f0594156" + integrity sha512-9ZyjR68r5N6meBUSLwus7W+1ojYllD67WrrY8JOMQkiQLMoLty6VzlbFgQtRYaJxJx1IzNWvrdU+SgXRm+L5oQ== dependencies: - "@aws-sdk/middleware-sdk-s3" "3.796.0" + "@aws-sdk/middleware-sdk-s3" "3.799.0" "@aws-sdk/types" "3.775.0" "@smithy/protocol-http" "^5.1.0" "@smithy/signature-v4" "^5.1.0" "@smithy/types" "^4.2.0" tslib "^2.6.2" -"@aws-sdk/token-providers@3.797.0": - version "3.797.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/token-providers/-/token-providers-3.797.0.tgz#9f8c316f1adfda592c8dc6e69082879896720696" - integrity sha512-TLFkP4BBdkH2zCXhG3JjaYrRft25MMZ+6/YDz1C/ikq2Zk8krUbVoSmhtYMVz10JtxAPiQ++w0vI/qbz2JSDXg== +"@aws-sdk/token-providers@3.803.0": + version "3.803.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/token-providers/-/token-providers-3.803.0.tgz#ba0f6b2919521125cf9c280bc3de1135c4e47e25" + integrity sha512-lDbMgVjWWEPT7a6lLaAEPPljwOeLTjPX2sJ7MoDICpQotg4Yd8cQfX3nqScSyLAGSc7Rq/21UPnPoij/E0K3lg== dependencies: - "@aws-sdk/nested-clients" "3.797.0" + "@aws-sdk/nested-clients" "3.803.0" "@aws-sdk/types" "3.775.0" "@smithy/property-provider" "^4.0.2" "@smithy/shared-ini-file-loader" "^4.0.2" @@ -649,12 +649,12 @@ bowser "^2.11.0" tslib "^2.6.2" -"@aws-sdk/util-user-agent-node@3.796.0": - version "3.796.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/util-user-agent-node/-/util-user-agent-node-3.796.0.tgz#72c2ea1f32d2eb1200e111f48fd8a3c005f5202c" - integrity sha512-9fQpNcHgVFitf1tbTT8V1xGRoRHSmOAWjrhevo6Tc0WoINMAKz+4JNqfVGWRE5Tmtpq0oHKo1RmvxXQQtJYciA== +"@aws-sdk/util-user-agent-node@3.799.0": + version "3.799.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/util-user-agent-node/-/util-user-agent-node-3.799.0.tgz#8d0794add4efc79830143277f5faa27f16531c7a" + integrity sha512-iXBk38RbIWPF5Nq9O4AnktORAzXovSVqWYClvS1qbE7ILsnTLJbagU9HlU25O2iV5COVh1qZkwuP5NHQ2yTEyw== dependencies: - "@aws-sdk/middleware-user-agent" "3.796.0" + "@aws-sdk/middleware-user-agent" "3.799.0" "@aws-sdk/types" "3.775.0" "@smithy/node-config-provider" "^4.0.2" "@smithy/types" "^4.2.0" @@ -4152,10 +4152,10 @@ "@smithy/util-middleware" "^4.0.2" tslib "^2.6.2" -"@smithy/core@^3.2.0": - version "3.2.0" - resolved "https://registry.yarnpkg.com/@smithy/core/-/core-3.2.0.tgz#613b15f76eab9a6be396b1d5453b6bc8f22ba99c" - integrity sha512-k17bgQhVZ7YmUvA8at4af1TDpl0NDMBuBKJl8Yg0nrefwmValU+CnA5l/AriVdQNthU/33H3nK71HrLgqOPr1Q== +"@smithy/core@^3.3.0", "@smithy/core@^3.3.1": + version "3.3.1" + resolved "https://registry.yarnpkg.com/@smithy/core/-/core-3.3.1.tgz#6119a683f62099158eb193e3745f4ade6de741dd" + integrity sha512-W7AppgQD3fP1aBmo8wWo0id5zeR2/aYRy067vZsDVaa6v/mdhkg6DxXwEVuSPjZl+ZnvWAQbUMCd5ckw38+tHQ== dependencies: "@smithy/middleware-serde" "^4.0.3" "@smithy/protocol-http" "^5.1.0" @@ -4302,12 +4302,12 @@ "@smithy/types" "^4.2.0" tslib "^2.6.2" -"@smithy/middleware-endpoint@^4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@smithy/middleware-endpoint/-/middleware-endpoint-4.1.0.tgz#cbfe47c5632942c960dbcf71fb02fd0d9985444d" - integrity sha512-xhLimgNCbCzsUppRTGXWkZywksuTThxaIB0HwbpsVLY5sceac4e1TZ/WKYqufQLaUy+gUSJGNdwD2jo3cXL0iA== +"@smithy/middleware-endpoint@^4.1.1", "@smithy/middleware-endpoint@^4.1.2": + version "4.1.2" + resolved "https://registry.yarnpkg.com/@smithy/middleware-endpoint/-/middleware-endpoint-4.1.2.tgz#d8ad5e4e439126d7bcc79f0046fc5f9518d8afd8" + integrity sha512-EqOy3xaEGQpsKxLlzYstDRJ8eY90CbyBP4cl+w7r45mE60S8YliyL9AgWsdWcyNiB95E2PMqHBEv67nNl1zLfg== dependencies: - "@smithy/core" "^3.2.0" + "@smithy/core" "^3.3.1" "@smithy/middleware-serde" "^4.0.3" "@smithy/node-config-provider" "^4.0.2" "@smithy/shared-ini-file-loader" "^4.0.2" @@ -4316,18 +4316,18 @@ "@smithy/util-middleware" "^4.0.2" tslib "^2.6.2" -"@smithy/middleware-retry@^4.1.0": - version "4.1.0" - resolved "https://registry.yarnpkg.com/@smithy/middleware-retry/-/middleware-retry-4.1.0.tgz#338ac1e025bbc6fd7b008152c4efa8bc0591acc9" - integrity sha512-2zAagd1s6hAaI/ap6SXi5T3dDwBOczOMCSkkYzktqN1+tzbk1GAsHNAdo/1uzxz3Ky02jvZQwbi/vmDA6z4Oyg== +"@smithy/middleware-retry@^4.1.2": + version "4.1.3" + resolved "https://registry.yarnpkg.com/@smithy/middleware-retry/-/middleware-retry-4.1.3.tgz#6d22d21321b2089b4caeb79577a9b40bf4ac6ace" + integrity sha512-AsJtI9KiFoEGAhcEKZyzzPfrszAQGcf4HSYKmenz0WGx/6YNvoPPv4OSGfZTCsDmgPHv4pXzxE+7QV7jcGWNKw== dependencies: "@smithy/node-config-provider" "^4.0.2" "@smithy/protocol-http" "^5.1.0" - "@smithy/service-error-classification" "^4.0.2" - "@smithy/smithy-client" "^4.2.0" + "@smithy/service-error-classification" "^4.0.3" + "@smithy/smithy-client" "^4.2.2" "@smithy/types" "^4.2.0" "@smithy/util-middleware" "^4.0.2" - "@smithy/util-retry" "^4.0.2" + "@smithy/util-retry" "^4.0.3" tslib "^2.6.2" uuid "^9.0.1" @@ -4401,10 +4401,10 @@ "@smithy/types" "^4.2.0" tslib "^2.6.2" -"@smithy/service-error-classification@^4.0.2": - version "4.0.2" - resolved "https://registry.yarnpkg.com/@smithy/service-error-classification/-/service-error-classification-4.0.2.tgz#96740ed8be7ac5ad7d6f296d4ddf3f66444b8dcc" - integrity sha512-LA86xeFpTKn270Hbkixqs5n73S+LVM0/VZco8dqd+JT75Dyx3Lcw/MraL7ybjmz786+160K8rPOmhsq0SocoJQ== +"@smithy/service-error-classification@^4.0.3": + version "4.0.3" + resolved "https://registry.yarnpkg.com/@smithy/service-error-classification/-/service-error-classification-4.0.3.tgz#df43e3ec00a9f2d15415185561d98cd602c8bc67" + integrity sha512-FTbcajmltovWMjj3tksDQdD23b2w6gH+A0DYA1Yz3iSpjDj8fmkwy62UnXcWMy4d5YoMoSyLFHMfkEVEzbiN8Q== dependencies: "@smithy/types" "^4.2.0" @@ -4430,13 +4430,13 @@ "@smithy/util-utf8" "^4.0.0" tslib "^2.6.2" -"@smithy/smithy-client@^4.2.0": - version "4.2.0" - resolved "https://registry.yarnpkg.com/@smithy/smithy-client/-/smithy-client-4.2.0.tgz#0c64cae4fb5bb4f26386e9b2c33fc9a3c24c9df3" - integrity sha512-Qs65/w30pWV7LSFAez9DKy0Koaoh3iHhpcpCCJ4waj/iqwsuSzJna2+vYwq46yBaqO5ZbP9TjUsATUNxrKeBdw== +"@smithy/smithy-client@^4.2.1", "@smithy/smithy-client@^4.2.2": + version "4.2.2" + resolved "https://registry.yarnpkg.com/@smithy/smithy-client/-/smithy-client-4.2.2.tgz#b599c841c376994a3b3019942b1d3f1ecfaf964b" + integrity sha512-3AnHfsMdq9Wg7+3BeR1HuLWI9+DMA/SoHVpCWq6xSsa52ikNd6nlF/wFzdpHyGtVa+Aji6lMgvwOF4sGcVA7SA== dependencies: - "@smithy/core" "^3.2.0" - "@smithy/middleware-endpoint" "^4.1.0" + "@smithy/core" "^3.3.1" + "@smithy/middleware-endpoint" "^4.1.2" "@smithy/middleware-stack" "^4.0.2" "@smithy/protocol-http" "^5.1.0" "@smithy/types" "^4.2.0" @@ -4505,27 +4505,27 @@ dependencies: tslib "^2.6.2" -"@smithy/util-defaults-mode-browser@^4.0.8": - version "4.0.8" - resolved "https://registry.yarnpkg.com/@smithy/util-defaults-mode-browser/-/util-defaults-mode-browser-4.0.8.tgz#77bc4590cdc928901b80f3482e79607a2cbcb150" - integrity sha512-ZTypzBra+lI/LfTYZeop9UjoJhhGRTg3pxrNpfSTQLd3AJ37r2z4AXTKpq1rFXiiUIJsYyFgNJdjWRGP/cbBaQ== +"@smithy/util-defaults-mode-browser@^4.0.9": + version "4.0.10" + resolved "https://registry.yarnpkg.com/@smithy/util-defaults-mode-browser/-/util-defaults-mode-browser-4.0.10.tgz#50cc8aff3e1881848d574ea777439ff74a465550" + integrity sha512-2k6fgUNOZ1Rn0gEjvGPGrDEINLG8qSBHsN7xlkkbO+fnHJ36BQPDzhFfMmYSDS8AgzoygqQiDOQ+6Hp2vBTUdA== dependencies: "@smithy/property-provider" "^4.0.2" - "@smithy/smithy-client" "^4.2.0" + "@smithy/smithy-client" "^4.2.2" "@smithy/types" "^4.2.0" bowser "^2.11.0" tslib "^2.6.2" -"@smithy/util-defaults-mode-node@^4.0.8": - version "4.0.8" - resolved "https://registry.yarnpkg.com/@smithy/util-defaults-mode-node/-/util-defaults-mode-node-4.0.8.tgz#123b517efe6434977139b341d1f64b5f1e743aac" - integrity sha512-Rgk0Jc/UDfRTzVthye/k2dDsz5Xxs9LZaKCNPgJTRyoyBoeiNCnHsYGOyu1PKN+sDyPnJzMOz22JbwxzBp9NNA== +"@smithy/util-defaults-mode-node@^4.0.9": + version "4.0.10" + resolved "https://registry.yarnpkg.com/@smithy/util-defaults-mode-node/-/util-defaults-mode-node-4.0.10.tgz#f85b0a12fe3d1bc63e776ee8100d14055a211526" + integrity sha512-2XR1WRglLVmoIFts7bODUTgBdVyvkfKNkydHrlsI5VxW9q3s1hnJCuY+f1OHzvj5ue23q4vydM2fjrMjf2HSdQ== dependencies: "@smithy/config-resolver" "^4.1.0" "@smithy/credential-provider-imds" "^4.0.2" "@smithy/node-config-provider" "^4.0.2" "@smithy/property-provider" "^4.0.2" - "@smithy/smithy-client" "^4.2.0" + "@smithy/smithy-client" "^4.2.2" "@smithy/types" "^4.2.0" tslib "^2.6.2" @@ -4553,12 +4553,12 @@ "@smithy/types" "^4.2.0" tslib "^2.6.2" -"@smithy/util-retry@^4.0.2": - version "4.0.2" - resolved "https://registry.yarnpkg.com/@smithy/util-retry/-/util-retry-4.0.2.tgz#9b64cf460d63555884e641721d19e3c0abff8ee6" - integrity sha512-Qryc+QG+7BCpvjloFLQrmlSd0RsVRHejRXd78jNO3+oREueCjwG1CCEH1vduw/ZkM1U9TztwIKVIi3+8MJScGg== +"@smithy/util-retry@^4.0.3": + version "4.0.3" + resolved "https://registry.yarnpkg.com/@smithy/util-retry/-/util-retry-4.0.3.tgz#42d54b3a100915b61c6f9bee43c966e96139584d" + integrity sha512-DPuYjZQDXmKr/sNvy9Spu8R/ESa2e22wXZzSAY6NkjOLj6spbIje/Aq8rT97iUMdDj0qHMRIe+bTxvlU74d9Ng== dependencies: - "@smithy/service-error-classification" "^4.0.2" + "@smithy/service-error-classification" "^4.0.3" "@smithy/types" "^4.2.0" tslib "^2.6.2" From b9387734c78899e0a1db580688c4486e3b41ae0c Mon Sep 17 00:00:00 2001 From: Tom Moor <tom@getoutline.com> Date: Wed, 7 May 2025 07:47:57 -0400 Subject: [PATCH 54/64] perf: Remove `documentStructure` from default query select (#9141) * perf: Remove documentStructure from default query select * test --- package.json | 1 + server/commands/documentLoader.ts | 49 ++++++-------- server/commands/documentMover.ts | 28 ++++---- server/models/Collection.test.ts | 64 ++++++++++--------- server/models/Collection.ts | 13 ++++ server/models/Document.test.ts | 7 +- server/models/Document.ts | 57 +++++++++++------ server/routes/api/collections/collections.ts | 8 ++- server/routes/api/documents/documents.test.ts | 4 +- server/routes/api/documents/documents.ts | 12 ++-- server/routes/api/shares/shares.ts | 6 +- server/storage/database.ts | 5 +- server/test/factories.ts | 6 +- server/utils/indexing.ts | 1 - yarn.lock | 44 +++---------- 15 files changed, 161 insertions(+), 144 deletions(-) diff --git a/package.json b/package.json index 337a2efc94..9bb5bf2002 100644 --- a/package.json +++ b/package.json @@ -228,6 +228,7 @@ "sequelize": "^6.37.3", "sequelize-cli": "^6.6.2", "sequelize-encrypted": "^1.0.0", + "sequelize-strict-attributes": "^1.0.2", "sequelize-typescript": "^2.1.6", "slug": "^5.3.0", "slugify": "^1.6.6", diff --git a/server/commands/documentLoader.ts b/server/commands/documentLoader.ts index 24132ce9a0..4b717f0a40 100644 --- a/server/commands/documentLoader.ts +++ b/server/commands/documentLoader.ts @@ -1,4 +1,3 @@ -import invariant from "invariant"; import { Op, WhereOptions } from "sequelize"; import isUUID from "validator/lib/isUUID"; import { UrlHelper } from "@shared/utils/UrlHelper"; @@ -22,8 +21,8 @@ type Props = { type Result = { document: Document; - share?: Share; - collection?: Collection | null; + share: Share | null; + collection: Collection | null; }; export default async function loadDocument({ @@ -33,9 +32,9 @@ export default async function loadDocument({ user, includeState, }: Props): Promise<Result> { - let document; - let collection; - let share; + let document: Document | null = null; + let collection: Collection | null = null; + let share: Share | null = null; if (!shareId && !(id && user)) { throw AuthenticationError(`Authentication or shareId required`); @@ -72,20 +71,7 @@ export default async function loadDocument({ where: whereClause, include: [ { - // unscoping here allows us to return unpublished documents - model: Document.unscoped(), - include: [ - { - model: User, - as: "createdBy", - paranoid: false, - }, - { - model: User, - as: "updatedBy", - paranoid: false, - }, - ], + model: Document.scope("withDrafts"), required: true, as: "document", }, @@ -129,14 +115,13 @@ export default async function loadDocument({ const canReadDocument = user && can(user, "read", document); if (canReadDocument) { - // Cannot use document.collection here as it does not include the - // documentStructure by default through the relationship. if (document.collectionId) { - collection = await Collection.findByPk(document.collectionId); - - if (!collection) { - throw NotFoundError("Collection could not be found for document"); - } + collection = await Collection.scope("withDocumentStructure").findByPk( + document.collectionId, + { + rejectOnEmpty: true, + } + ); } return { @@ -155,11 +140,15 @@ export default async function loadDocument({ // It is possible to disable sharing at the collection so we must check if (document.collectionId) { - collection = await Collection.findByPk(document.collectionId); + collection = await Collection.scope("withDocumentStructure").findByPk( + document.collectionId, + { + rejectOnEmpty: true, + } + ); } - invariant(collection, "collection not found"); - if (!collection.sharing) { + if (!collection?.sharing) { throw AuthorizationError(); } diff --git a/server/commands/documentMover.ts b/server/commands/documentMover.ts index cf1b150783..76a3a947d3 100644 --- a/server/commands/documentMover.ts +++ b/server/commands/documentMover.ts @@ -1,4 +1,3 @@ -import invariant from "invariant"; import { Transaction } from "sequelize"; import { createContext } from "@server/context"; import { traceFunction } from "@server/logging/tracing"; @@ -66,16 +65,21 @@ async function documentMover({ result.documents.push(document); } else { // Load the current and the next collection upfront and lock them - const collection = await Collection.findByPk(document.collectionId!, { - transaction, - lock: Transaction.LOCK.UPDATE, - paranoid: false, - }); + const collection = await Collection.scope("withDocumentStructure").findByPk( + document.collectionId!, + { + transaction, + lock: Transaction.LOCK.UPDATE, + paranoid: false, + } + ); let newCollection = collection; if (collectionChanged) { if (collectionId) { - newCollection = await Collection.findByPk(collectionId, { + newCollection = await Collection.scope( + "withDocumentStructure" + ).findByPk(collectionId, { transaction, lock: Transaction.LOCK.UPDATE, }); @@ -144,12 +148,14 @@ async function documentMover({ if (collectionId) { // Reload the collection to get relationship data - newCollection = await Collection.scope({ - method: ["withMembership", user.id], - }).findByPk(collectionId, { + newCollection = await Collection.scope([ + { + method: ["withMembership", user.id], + }, + ]).findByPk(collectionId, { transaction, + rejectOnEmpty: true, }); - invariant(newCollection, "Collection not found"); result.collections.push(newCollection); diff --git a/server/models/Collection.test.ts b/server/models/Collection.test.ts index 46a076b1b2..9c85f344b7 100644 --- a/server/models/Collection.test.ts +++ b/server/models/Collection.test.ts @@ -16,7 +16,7 @@ beforeEach(() => { }); describe("#url", () => { - test("should return correct url for the collection", () => { + it("should return correct url for the collection", () => { const collection = new Collection({ id: "1234", }); @@ -25,7 +25,7 @@ describe("#url", () => { }); describe("getDocumentParents", () => { - test("should return array of parent document ids", async () => { + it("should return array of parent document ids", async () => { const parent = await buildDocument(); const document = await buildDocument(); const collection = await buildCollection({ @@ -41,7 +41,7 @@ describe("getDocumentParents", () => { expect(result ? result[0] : undefined).toBe(parent.id); }); - test("should return array of parent document ids", async () => { + it("should return array of parent document ids", async () => { const parent = await buildDocument(); const document = await buildDocument(); const collection = await buildCollection({ @@ -56,7 +56,7 @@ describe("getDocumentParents", () => { expect(result?.length).toBe(0); }); - test("should not error if documentStructure is empty", async () => { + it("should not error if documentStructure is empty", async () => { const parent = await buildDocument(); await buildDocument(); const collection = await buildCollection(); @@ -66,7 +66,7 @@ describe("getDocumentParents", () => { }); describe("getDocumentTree", () => { - test("should return document tree", async () => { + it("should return document tree", async () => { const document = await buildDocument(); const collection = await buildCollection({ documentStructure: [await document.toNavigationNode()], @@ -76,7 +76,7 @@ describe("getDocumentTree", () => { ); }); - test("should return nested documents in tree", async () => { + it("should return nested documents in tree", async () => { const parent = await buildDocument(); const document = await buildDocument(); const collection = await buildCollection({ @@ -99,7 +99,7 @@ describe("getDocumentTree", () => { }); describe("#addDocumentToStructure", () => { - test("should add as last element without index", async () => { + it("should add as last element without index", async () => { const collection = await buildCollection(); const id = uuidv4(); const newDocument = await buildDocument({ @@ -117,7 +117,7 @@ describe("#addDocumentToStructure", () => { expect(collection.documentStructure!.length).toBe(1); }); - test("should add with an index", async () => { + it("should add with an index", async () => { const collection = await buildCollection(); const id = uuidv4(); const newDocument = await buildDocument({ @@ -131,7 +131,7 @@ describe("#addDocumentToStructure", () => { expect(collection.documentStructure![0].id).toBe(id); }); - test("should add as a child if with parent", async () => { + it("should add as a child if with parent", async () => { const collection = await buildCollection(); const document = await buildDocument({ collectionId: collection.id }); await collection.reload(); @@ -150,7 +150,7 @@ describe("#addDocumentToStructure", () => { expect(collection.documentStructure![0].children[0].id).toBe(id); }); - test("should add as a child if with parent with index", async () => { + it("should add as a child if with parent with index", async () => { const collection = await buildCollection(); const document = await buildDocument({ collectionId: collection.id }); await collection.reload(); @@ -176,7 +176,7 @@ describe("#addDocumentToStructure", () => { expect(collection.documentStructure![0].children[0].id).toBe(id); }); - test("should add the document along with its nested document(s)", async () => { + it("should add the document along with its nested document(s)", async () => { const collection = await buildCollection(); const document = await buildDocument({ @@ -204,7 +204,7 @@ describe("#addDocumentToStructure", () => { ); }); - test("should add the document along with its archived nested document(s)", async () => { + it("should add the document along with its archived nested document(s)", async () => { const collection = await buildCollection(); const document = await buildDocument({ @@ -237,7 +237,7 @@ describe("#addDocumentToStructure", () => { ); }); describe("options: documentJson", () => { - test("should append supplied json over document's own", async () => { + it("should append supplied json over document's own", async () => { const collection = await buildCollection(); const id = uuidv4(); const newDocument = await buildDocument({ @@ -268,7 +268,7 @@ describe("#addDocumentToStructure", () => { }); describe("#updateDocument", () => { - test("should update root document's data", async () => { + it("should update root document's data", async () => { const collection = await buildCollection(); const document = await buildDocument({ collectionId: collection.id }); await collection.reload(); @@ -279,7 +279,7 @@ describe("#updateDocument", () => { expect(collection.documentStructure![0].title).toBe("Updated title"); }); - test("should update child document's data", async () => { + it("should update child document's data", async () => { const collection = await buildCollection(); const document = await buildDocument({ collectionId: collection.id }); await collection.reload(); @@ -297,7 +297,7 @@ describe("#updateDocument", () => { newDocument.title = "Updated title"; await newDocument.save(); await collection.updateDocument(newDocument); - const reloaded = await Collection.findByPk(collection.id); + const reloaded = await collection.reload(); expect(reloaded!.documentStructure![0].children[0].title).toBe( "Updated title" ); @@ -305,7 +305,7 @@ describe("#updateDocument", () => { }); describe("#removeDocument", () => { - test("should save if removing", async () => { + it("should save if removing", async () => { const collection = await buildCollection(); const document = await buildDocument({ collectionId: collection.id }); await collection.reload(); @@ -315,7 +315,7 @@ describe("#removeDocument", () => { expect(collection.save).toBeCalled(); }); - test("should remove documents from root", async () => { + it("should remove documents from root", async () => { const collection = await buildCollection(); const document = await buildDocument({ collectionId: collection.id }); await collection.reload(); @@ -331,7 +331,7 @@ describe("#removeDocument", () => { expect(collectionDocuments.count).toBe(0); }); - test("should remove a document with child documents", async () => { + it("should remove a document with child documents", async () => { const collection = await buildCollection(); const document = await buildDocument({ collectionId: collection.id }); await collection.reload(); @@ -359,7 +359,7 @@ describe("#removeDocument", () => { expect(collectionDocuments.count).toBe(0); }); - test("should remove a child document", async () => { + it("should remove a child document", async () => { const collection = await buildCollection(); const document = await buildDocument({ collectionId: collection.id }); await collection.reload(); @@ -380,7 +380,7 @@ describe("#removeDocument", () => { expect(collection.documentStructure![0].children.length).toBe(1); // Remove the document await collection.deleteDocument(newDocument); - const reloaded = await Collection.findByPk(collection.id); + const reloaded = await collection.reload(); expect(reloaded!.documentStructure!.length).toBe(1); expect(reloaded!.documentStructure![0].children.length).toBe(0); const collectionDocuments = await Document.findAndCountAll({ @@ -393,7 +393,7 @@ describe("#removeDocument", () => { }); describe("#membershipUserIds", () => { - test("should return collection and group memberships", async () => { + it("should return collection and group memberships", async () => { const team = await buildTeam(); const teamId = team.id; // Make 6 users @@ -464,47 +464,53 @@ describe("#membershipUserIds", () => { }); describe("#findByPk", () => { - test("should return collection with collection Id", async () => { + it("should return collection with collection Id", async () => { const collection = await buildCollection(); const response = await Collection.findByPk(collection.id); expect(response!.id).toBe(collection.id); }); - test("should return collection when urlId is present", async () => { + it("should not return documentStructure by default", async () => { + const collection = await buildCollection(); + const response = await Collection.findByPk(collection.id); + expect(() => response!.documentStructure).toThrow(); + }); + + it("should return collection when urlId is present", async () => { const collection = await buildCollection(); const id = `${slugify(collection.name)}-${collection.urlId}`; const response = await Collection.findByPk(id); expect(response!.id).toBe(collection.id); }); - test("should return collection when urlId is present, but missing slug", async () => { + it("should return collection when urlId is present, but missing slug", async () => { const collection = await buildCollection(); const id = collection.urlId; const response = await Collection.findByPk(id); expect(response!.id).toBe(collection.id); }); - test("should return null when incorrect uuid type", async () => { + it("should return null when incorrect uuid type", async () => { const collection = await buildCollection(); const response = await Collection.findByPk(collection.id + "-incorrect"); expect(response).toBe(null); }); - test("should return null when incorrect urlId length", async () => { + it("should return null when incorrect urlId length", async () => { const collection = await buildCollection(); const id = `${slugify(collection.name)}-${collection.urlId}incorrect`; const response = await Collection.findByPk(id); expect(response).toBe(null); }); - test("should return null when no collection is found with uuid", async () => { + it("should return null when no collection is found with uuid", async () => { const response = await Collection.findByPk( "a9e71a81-7342-4ea3-9889-9b9cc8f667da" ); expect(response).toBe(null); }); - test("should return null when no collection is found with urlId", async () => { + it("should return null when no collection is found with urlId", async () => { const id = `${slugify("test collection")}-${randomstring.generate(15)}`; const response = await Collection.findByPk(id); expect(response).toBe(null); diff --git a/server/models/Collection.ts b/server/models/Collection.ts index 3c15ffcacd..a388a17844 100644 --- a/server/models/Collection.ts +++ b/server/models/Collection.ts @@ -37,6 +37,7 @@ import { AllowNull, BeforeCreate, BeforeUpdate, + DefaultScope, } from "sequelize-typescript"; import isUUID from "validator/lib/isUUID"; import type { CollectionSort, ProsemirrorData } from "@shared/types"; @@ -69,6 +70,11 @@ type AdditionalFindOptions = { rejectOnEmpty?: boolean | Error; }; +@DefaultScope(() => ({ + attributes: { + exclude: ["documentStructure"], + }, +})) @Scopes(() => ({ withAllMemberships: { include: [ @@ -121,6 +127,12 @@ type AdditionalFindOptions = { }, ], }), + withDocumentStructure: () => ({ + attributes: { + // resets to include the documentStructure column + exclude: [], + }, + }), withMembership: (userId: string) => { if (!userId) { return {}; @@ -238,6 +250,7 @@ class Collection extends ParanoidModel< @Column maintainerApprovalRequired: boolean; + @Default(null) @Column(DataType.JSONB) documentStructure: NavigationNode[] | null; diff --git a/server/models/Document.test.ts b/server/models/Document.test.ts index 1a58e7d502..ba301c3449 100644 --- a/server/models/Document.test.ts +++ b/server/models/Document.test.ts @@ -11,7 +11,6 @@ import { buildUser, buildGuestUser, } from "@server/test/factories"; -import Collection from "./Collection"; import UserMembership from "./UserMembership"; beforeEach(() => { @@ -96,10 +95,8 @@ describe("#delete", () => { await document.delete(user); const [newDocument, newCollection] = await Promise.all([ - Document.findByPk(document.id, { - paranoid: false, - }), - Collection.findByPk(collection.id), + document.reload({ paranoid: false }), + collection.reload(), ]); expect(newDocument?.lastModifiedById).toEqual(user.id); diff --git a/server/models/Document.ts b/server/models/Document.ts index 851f25089e..b13ff201b3 100644 --- a/server/models/Document.ts +++ b/server/models/Document.ts @@ -162,11 +162,13 @@ type AdditionalFindOptions = { return { include: [ { - attributes: ["id", "permission", "sharing", "teamId", "deletedAt"], model: userId - ? Collection.scope({ - method: ["withMembership", userId], - }) + ? Collection.scope([ + "defaultScope", + { + method: ["withMembership", userId], + }, + ]) : Collection, as: "collection", paranoid, @@ -414,10 +416,13 @@ class Document extends ArchivableModel< return; } - const collection = await Collection.findByPk(model.collectionId, { - transaction, - lock: Transaction.LOCK.UPDATE, - }); + const collection = await Collection.scope("withDocumentStructure").findByPk( + model.collectionId, + { + transaction, + lock: Transaction.LOCK.UPDATE, + } + ); if (!collection) { return; } @@ -438,7 +443,9 @@ class Document extends ArchivableModel< } return this.sequelize!.transaction(async (transaction: Transaction) => { - const collection = await Collection.findByPk(model.collectionId!, { + const collection = await Collection.scope( + "withDocumentStructure" + ).findByPk(model.collectionId!, { transaction, lock: transaction.LOCK.UPDATE, }); @@ -926,7 +933,9 @@ class Document extends ArchivableModel< } if (!this.template && this.collectionId) { - const collection = await Collection.findByPk(this.collectionId, { + const collection = await Collection.scope( + "withDocumentStructure" + ).findByPk(this.collectionId, { transaction, lock: Transaction.LOCK.UPDATE, }); @@ -993,10 +1002,13 @@ class Document extends ArchivableModel< await this.sequelize.transaction(async (transaction: Transaction) => { const collection = this.collectionId - ? await Collection.findByPk(this.collectionId, { - transaction, - lock: transaction.LOCK.UPDATE, - }) + ? await Collection.scope("withDocumentStructure").findByPk( + this.collectionId, + { + transaction, + lock: transaction.LOCK.UPDATE, + } + ) : undefined; if (collection) { @@ -1027,10 +1039,13 @@ class Document extends ArchivableModel< archive = async (user: User, options?: FindOptions) => { const { transaction } = { ...options }; const collection = this.collectionId - ? await Collection.findByPk(this.collectionId, { - transaction, - lock: transaction?.LOCK.UPDATE, - }) + ? await Collection.scope("withDocumentStructure").findByPk( + this.collectionId, + { + transaction, + lock: transaction?.LOCK.UPDATE, + } + ) : undefined; if (collection) { @@ -1051,7 +1066,7 @@ class Document extends ArchivableModel< ) => { const { transaction } = { ...options }; const collection = collectionId - ? await Collection.findByPk(collectionId, { + ? await Collection.scope("withDocumentStructure").findByPk(collectionId, { transaction, lock: transaction?.LOCK.UPDATE, }) @@ -1103,7 +1118,9 @@ class Document extends ArchivableModel< let deleted = false; if (!this.template && this.collectionId) { - const collection = await Collection.findByPk(this.collectionId!, { + const collection = await Collection.scope( + "withDocumentStructure" + ).findByPk(this.collectionId!, { transaction, lock: transaction.LOCK.UPDATE, paranoid: false, diff --git a/server/routes/api/collections/collections.ts b/server/routes/api/collections/collections.ts index 8dccd775da..dadd2eecf6 100644 --- a/server/routes/api/collections/collections.ts +++ b/server/routes/api/collections/collections.ts @@ -140,9 +140,11 @@ router.post( async (ctx: APIContext<T.CollectionsDocumentsReq>) => { const { id } = ctx.input.body; const { user } = ctx.state.auth; - const collection = await Collection.scope({ - method: ["withMembership", user.id], - }).findByPk(id); + const collection = await Collection.scope([ + { + method: ["withMembership", user.id], + }, + ]).findByPk(id); authorize(user, "readDocument", collection); diff --git a/server/routes/api/documents/documents.test.ts b/server/routes/api/documents/documents.test.ts index 986f366ce2..677d7db99e 100644 --- a/server/routes/api/documents/documents.test.ts +++ b/server/routes/api/documents/documents.test.ts @@ -977,7 +977,7 @@ describe("#documents.list", () => { const res = await server.post("/api/documents.list", { body: { token: user.getJwtToken(), - collection: document.collectionId, + collectionId: document.collectionId, }, }); const body = await res.json(); @@ -1013,7 +1013,7 @@ describe("#documents.list", () => { const res = await server.post("/api/documents.list", { body: { token: user.getJwtToken(), - collection: collection.id, + collectionId: collection.id, }, }); const body = await res.json(); diff --git a/server/routes/api/documents/documents.ts b/server/routes/api/documents/documents.ts index 8e626ed7a5..1ddda20176 100644 --- a/server/routes/api/documents/documents.ts +++ b/server/routes/api/documents/documents.ts @@ -133,15 +133,19 @@ router.post( // if a specific collection is passed then we need to check auth to view it if (collectionId) { where[Op.and].push({ collectionId: [collectionId] }); - const collection = await Collection.scope({ - method: ["withMembership", user.id], - }).findByPk(collectionId); + const collection = await Collection.scope([ + sort === "index" ? "withDocumentStructure" : "defaultScope", + { + method: ["withMembership", user.id], + }, + ]).findByPk(collectionId); + authorize(user, "readDocument", collection); // index sort is special because it uses the order of the documents in the // collection.documentStructure rather than a database column if (sort === "index") { - documentIds = (collection?.documentStructure || []) + documentIds = (collection.documentStructure || []) .map((node) => node.id) .slice(ctx.state.pagination.offset, ctx.state.pagination.limit); where[Op.and].push({ id: documentIds }); diff --git a/server/routes/api/shares/shares.ts b/server/routes/api/shares/shares.ts index 289552a06b..b782446d89 100644 --- a/server/routes/api/shares/shares.ts +++ b/server/routes/api/shares/shares.ts @@ -54,7 +54,11 @@ router.post( }); authorize(user, "read", document); - const collection = await document.$get("collection"); + const collection = document.collectionId + ? await Collection.scope("withDocumentStructure").findByPk( + document.collectionId + ) + : undefined; const parentIds = collection?.getDocumentParents(documentId); const parentShare = parentIds ? await Share.scope({ diff --git a/server/storage/database.ts b/server/storage/database.ts index 835cce85d0..ca32bde4fc 100644 --- a/server/storage/database.ts +++ b/server/storage/database.ts @@ -1,5 +1,6 @@ import path from "path"; import { InferAttributes, InferCreationAttributes } from "sequelize"; +import sequelizeStrictAttributes from "sequelize-strict-attributes"; import { Sequelize } from "sequelize-typescript"; import { Umzug, SequelizeStorage, MigrationError } from "umzug"; import env from "@server/env"; @@ -23,7 +24,7 @@ export function createDatabaseInstance( } ): Sequelize { try { - return new Sequelize(databaseUrl, { + const instance = new Sequelize(databaseUrl, { logging: (msg) => process.env.DEBUG?.includes("database") && Logger.debug("database", msg), @@ -47,6 +48,8 @@ export function createDatabaseInstance( }, schema, }); + sequelizeStrictAttributes(instance); + return instance; } catch (error) { Logger.fatal( "Could not connect to database", diff --git a/server/test/factories.ts b/server/test/factories.ts index f215227bec..6632be8aa0 100644 --- a/server/test/factories.ts +++ b/server/test/factories.ts @@ -310,7 +310,7 @@ export async function buildCollection( overrides.permission = CollectionPermission.ReadWrite; } - return Collection.create({ + return Collection.scope("withDocumentStructure").create({ name: faker.lorem.words(2), description: faker.lorem.words(4), createdById: overrides.userId, @@ -416,7 +416,9 @@ export async function buildDocument( if (overrides.collectionId && overrides.publishedAt !== null) { collection = collection - ? await Collection.findByPk(overrides.collectionId) + ? await Collection.scope("withDocumentStructure").findByPk( + overrides.collectionId + ) : undefined; await collection?.addDocumentToStructure(document, 0); diff --git a/server/utils/indexing.ts b/server/utils/indexing.ts index e464a46419..6befadcfbb 100644 --- a/server/utils/indexing.ts +++ b/server/utils/indexing.ts @@ -11,7 +11,6 @@ export async function collectionIndexing( where: { teamId, }, - attributes: ["id", "index", "name", "teamId"], transaction, }); diff --git a/yarn.lock b/yarn.lock index 9a594bc55b..9e02603e83 100644 --- a/yarn.lock +++ b/yarn.lock @@ -737,14 +737,7 @@ "@jridgewell/trace-mapping" "^0.3.25" jsesc "^3.0.2" -"@babel/helper-annotate-as-pure@^7.22.5", "@babel/helper-annotate-as-pure@^7.25.9": - version "7.25.9" - resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.25.9.tgz#d8eac4d2dc0d7b6e11fa6e535332e0d3184f06b4" - integrity sha512-gv7320KBUFJz1RnylIg5WWYPRXKZ884AGkYpgpWW02TH66Dl+HaC1t1CKd0z3R4b6hdYEcmrNZHUmfCP+1u3/g== - dependencies: - "@babel/types" "^7.25.9" - -"@babel/helper-annotate-as-pure@^7.27.1": +"@babel/helper-annotate-as-pure@^7.22.5", "@babel/helper-annotate-as-pure@^7.25.9", "@babel/helper-annotate-as-pure@^7.27.1": version "7.27.1" resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.27.1.tgz#4345d81a9a46a6486e24d069469f13e60445c05d" integrity sha512-WnuuDILl9oOBbKnb4L+DyODx7iC47XfzmNCpTttFsSp6hTG7XZxu60+4IO+2/hPfcGOoKbFiwoI/+zwARbNQow== @@ -775,16 +768,7 @@ "@babel/traverse" "^7.27.1" semver "^6.3.1" -"@babel/helper-create-regexp-features-plugin@^7.18.6": - version "7.26.3" - resolved "https://registry.yarnpkg.com/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.26.3.tgz#5169756ecbe1d95f7866b90bb555b022595302a0" - integrity sha512-G7ZRb40uUgdKOQqPLjfD12ZmGA54PzqDFUv2BKImnC9QIfGhIHKvVML0oN8IUiDq4iRqpq74ABpvOaerfWdong== - dependencies: - "@babel/helper-annotate-as-pure" "^7.25.9" - regexpu-core "^6.2.0" - semver "^6.3.1" - -"@babel/helper-create-regexp-features-plugin@^7.27.1": +"@babel/helper-create-regexp-features-plugin@^7.18.6", "@babel/helper-create-regexp-features-plugin@^7.27.1": version "7.27.1" resolved "https://registry.yarnpkg.com/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.27.1.tgz#05b0882d97ba1d4d03519e4bce615d70afa18c53" integrity sha512-uVDC72XVf8UbrH5qQTc18Agb8emwjTiZrQE11Nv3CuBEZmVvTwwE9CBUEvHku06gQCAyYf8Nv6ja1IN+6LMbxQ== @@ -826,15 +810,7 @@ "@babel/traverse" "^7.27.1" "@babel/types" "^7.27.1" -"@babel/helper-module-imports@^7.0.0", "@babel/helper-module-imports@^7.10.4", "@babel/helper-module-imports@^7.12.13", "@babel/helper-module-imports@^7.14.5", "@babel/helper-module-imports@^7.22.5": - version "7.25.9" - resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.25.9.tgz#e7f8d20602ebdbf9ebbea0a0751fb0f2a4141715" - integrity sha512-tnUA4RsrmflIM6W6RFTLFSXITtl0wKjgpnLgXyowocVPrbYrLUXSBXDgTs8BlbmIzIdlBySRQjINYs2BAkiLtw== - dependencies: - "@babel/traverse" "^7.25.9" - "@babel/types" "^7.25.9" - -"@babel/helper-module-imports@^7.27.1": +"@babel/helper-module-imports@^7.0.0", "@babel/helper-module-imports@^7.10.4", "@babel/helper-module-imports@^7.12.13", "@babel/helper-module-imports@^7.14.5", "@babel/helper-module-imports@^7.22.5", "@babel/helper-module-imports@^7.27.1": version "7.27.1" resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.27.1.tgz#7ef769a323e2655e126673bb6d2d6913bbead204" integrity sha512-0gSFWUPNXNopqtIPQvlD5WgXYI5GY2kP2cCvoT8kczjbfcfuIljTbcWrulD1CIPIX2gt1wghbDy08yE1p+/r3w== @@ -1093,20 +1069,13 @@ dependencies: "@babel/helper-plugin-utils" "^7.14.5" -"@babel/plugin-syntax-typescript@^7.27.1": +"@babel/plugin-syntax-typescript@^7.27.1", "@babel/plugin-syntax-typescript@^7.7.2": version "7.27.1" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.27.1.tgz#5147d29066a793450f220c63fa3a9431b7e6dd18" integrity sha512-xfYCBMxveHrRMnAWl1ZlPXOZjzkN82THFvLhQhFXFt81Z5HnN+EtUkZhv/zcKpmT3fzmWZB0ywiBrbC3vogbwQ== dependencies: "@babel/helper-plugin-utils" "^7.27.1" -"@babel/plugin-syntax-typescript@^7.7.2": - version "7.25.9" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.25.9.tgz#67dda2b74da43727cf21d46cf9afef23f4365399" - integrity sha512-hjMgRy5hb8uJJjUcdWunWVcoi9bGpJp8p5Ol1229PoN6aytsLwNMgmdftO23wnCLMfVmTwZDWMPNq/D1SY60JQ== - dependencies: - "@babel/helper-plugin-utils" "^7.25.9" - "@babel/plugin-syntax-unicode-sets-regex@^7.18.6": version "7.18.6" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-unicode-sets-regex/-/plugin-syntax-unicode-sets-regex-7.18.6.tgz#d49a3b3e6b52e5be6740022317580234a6a47357" @@ -14294,6 +14263,11 @@ sequelize-pool@^7.1.0: resolved "https://registry.yarnpkg.com/sequelize-pool/-/sequelize-pool-7.1.0.tgz#210b391af4002762f823188fd6ecfc7413020768" integrity "sha1-IQs5GvQAJ2L4IxiP1uz8dBMCB2g= sha512-G9c0qlIWQSK29pR/5U2JF5dDQeqqHRragoyahj/Nx4KOOQ3CPPfzxnfqFPCSB7x5UgjOgnZ61nSxz+fjDpRlJg==" +sequelize-strict-attributes@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/sequelize-strict-attributes/-/sequelize-strict-attributes-1.0.2.tgz#d51c5322551abe59e95249011fdb335c513ade53" + integrity sha512-FAzGrB4BAQzLD0xkGvAhWQf0Y8IRSn8ydaG6j8D8eMxT2z8iKIMzDdxtm9YFhHrTkLd+ILRktQLhEmGm921QvA== + sequelize-typescript@^2.1.6: version "2.1.6" resolved "https://registry.yarnpkg.com/sequelize-typescript/-/sequelize-typescript-2.1.6.tgz#9476c8a2510114ed1c3a26b424c47e05c2e6284e" From 06a149407a1e85e7366788cb5f0f9e522c8d4326 Mon Sep 17 00:00:00 2001 From: Tom Moor <tom@getoutline.com> Date: Wed, 7 May 2025 09:00:42 -0400 Subject: [PATCH 55/64] fix: withoutState scope should include state as fallback (#9144) --- server/models/Document.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/server/models/Document.ts b/server/models/Document.ts index b13ff201b3..0b64919ebd 100644 --- a/server/models/Document.ts +++ b/server/models/Document.ts @@ -15,6 +15,7 @@ import { FindOptions, WhereOptions, EmptyResultError, + Sequelize, } from "sequelize"; import { ForeignKey, @@ -104,10 +105,18 @@ type AdditionalFindOptions = { exclude: ["state"], }, })) +// @ts-expect-error Type 'Literal' is not assignable to type 'string | ProjectionAlias'. @Scopes(() => ({ withoutState: { attributes: { - exclude: ["state"], + include: [ + Sequelize.literal( + // If content (JSON) is null then we still need to return the state column (BINARY) + // as it's used as a fallback for content deserialization for older documents. + // This can be removed if content is 100% backfilled. + `CASE WHEN document.content IS NULL THEN document.state ELSE NULL END AS state` + ), + ], }, }, withCollection: { From 68b07eb46662407fb728b2b4582d3e94dc12b5e9 Mon Sep 17 00:00:00 2001 From: Tom Moor <tom@getoutline.com> Date: Wed, 7 May 2025 18:49:33 -0400 Subject: [PATCH 56/64] fix: withoutState scope should include state as fallback (#9145) --- server/models/Document.ts | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/server/models/Document.ts b/server/models/Document.ts index 0b64919ebd..4afc58bf3d 100644 --- a/server/models/Document.ts +++ b/server/models/Document.ts @@ -72,12 +72,20 @@ import Length from "./validators/Length"; export const DOCUMENT_VERSION = 2; +// If content (JSON) is null then we still need to return the state column (BINARY) +// as it's used as a fallback for content deserialization for older documents. +// This can be removed if content is 100% backfilled. +const stateIfContentEmpty = Sequelize.literal( + `CASE WHEN document.content IS NULL THEN document.state ELSE NULL END AS state` +); + type AdditionalFindOptions = { userId?: string; includeState?: boolean; rejectOnEmpty?: boolean | Error; }; +// @ts-expect-error Type 'Literal' is not assignable to type 'string | ProjectionAlias'. @DefaultScope(() => ({ include: [ { @@ -102,21 +110,14 @@ type AdditionalFindOptions = { }, }, attributes: { - exclude: ["state"], + include: [stateIfContentEmpty], }, })) // @ts-expect-error Type 'Literal' is not assignable to type 'string | ProjectionAlias'. @Scopes(() => ({ withoutState: { attributes: { - include: [ - Sequelize.literal( - // If content (JSON) is null then we still need to return the state column (BINARY) - // as it's used as a fallback for content deserialization for older documents. - // This can be removed if content is 100% backfilled. - `CASE WHEN document.content IS NULL THEN document.state ELSE NULL END AS state` - ), - ], + include: [stateIfContentEmpty], }, }, withCollection: { @@ -130,7 +131,7 @@ type AdditionalFindOptions = { withState: { attributes: { // resets to include the state column - exclude: [], + include: [], }, }, withDrafts: { From c598c61afe2aee50b4789a54e949b7e03456d38e Mon Sep 17 00:00:00 2001 From: "codegen-sh[bot]" <131295404+codegen-sh[bot]@users.noreply.github.com> Date: Wed, 7 May 2025 19:11:47 -0400 Subject: [PATCH 57/64] Add PromQL as a code highlighting option in the editor (#9146) * Add PromQL as a code highlighting option in the editor * Update code.ts --------- Co-authored-by: codegen-sh[bot] <131295404+codegen-sh[bot]@users.noreply.github.com> Co-authored-by: Tom Moor <tom@getoutline.com> --- shared/editor/lib/code.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/shared/editor/lib/code.ts b/shared/editor/lib/code.ts index 9e9404d19b..98f6bcfd68 100644 --- a/shared/editor/lib/code.ts +++ b/shared/editor/lib/code.ts @@ -198,6 +198,12 @@ export const codeLanguages: Record<string, CodeLanguage> = { label: "Powershell", loader: () => import("refractor/lang/powershell").then((m) => m.default), }, + promql: { + lang: "promql", + label: "PromQL", + // @ts-expect-error PromQL is not in types but exists + loader: () => import("refractor/lang/promql").then((m) => m.default), + }, protobuf: { lang: "protobuf", label: "Protobuf", From 80bb1ce977e15d5156cbeb386ba8d86c3226dca6 Mon Sep 17 00:00:00 2001 From: Tom Moor <tom@getoutline.com> Date: Wed, 7 May 2025 19:42:59 -0400 Subject: [PATCH 58/64] fix: ExportDocumentTreeTask needs documentStructure (#9148) --- server/queues/tasks/ExportDocumentTreeTask.ts | 3 ++- server/queues/tasks/ExportTask.ts | 12 +++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/server/queues/tasks/ExportDocumentTreeTask.ts b/server/queues/tasks/ExportDocumentTreeTask.ts index 4b89c5c377..8ab9972269 100644 --- a/server/queues/tasks/ExportDocumentTreeTask.ts +++ b/server/queues/tasks/ExportDocumentTreeTask.ts @@ -171,7 +171,8 @@ export default abstract class ExportDocumentTreeTask extends ExportTask { /** * Generates a map of document urls to their path in the zip file. * - * @param collections + * @param collections The collections to generate the path map for. + * @param format The format of the exported documents. */ private createPathMap( collections: Collection[], diff --git a/server/queues/tasks/ExportTask.ts b/server/queues/tasks/ExportTask.ts index 7b71adb90b..f5c53bdc02 100644 --- a/server/queues/tasks/ExportTask.ts +++ b/server/queues/tasks/ExportTask.ts @@ -44,11 +44,13 @@ export default abstract class ExportTask extends BaseTask<Props> { ? [fileOperation.collectionId] : await user.collectionIds(); - const collections = await Collection.findAll({ - where: { - id: collectionIds, - }, - }); + const collections = await Collection.scope("withDocumentStructure").findAll( + { + where: { + id: collectionIds, + }, + } + ); let filePath: string | undefined; From 587ba85cc9152f5b5b9f332e27b3dc970526adba Mon Sep 17 00:00:00 2001 From: Tom Moor <tom@getoutline.com> Date: Wed, 7 May 2025 20:17:47 -0400 Subject: [PATCH 59/64] fix: LaTeX blocks show vertical scrollbar (#9149) --- shared/editor/components/Styles.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared/editor/components/Styles.ts b/shared/editor/components/Styles.ts index aee18e3e0e..6617dea527 100644 --- a/shared/editor/components/Styles.ts +++ b/shared/editor/components/Styles.ts @@ -55,7 +55,7 @@ const mathStyle = (props: Props) => css` cursor: auto; white-space: pre-wrap; overflow-x: auto; - overflow-y: none; + overflow-y: hidden; } .math-node.empty-math .math-render::before { From 8717d160ce4cc60eeeba33ccec61d57fd3b3dbf0 Mon Sep 17 00:00:00 2001 From: Tom Moor <tom@getoutline.com> Date: Wed, 7 May 2025 20:36:56 -0400 Subject: [PATCH 60/64] fix: Backlinks are limited at 25 (#9150) --- app/stores/DocumentsStore.ts | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/app/stores/DocumentsStore.ts b/app/stores/DocumentsStore.ts index 13d249ccc8..1e29924ed9 100644 --- a/app/stores/DocumentsStore.ts +++ b/app/stores/DocumentsStore.ts @@ -279,19 +279,14 @@ export default class DocumentsStore extends Store<Document> { @action fetchBacklinks = async (documentId: string): Promise<void> => { - const res = await client.post(`/documents.list`, { + const documents = await this.fetchAll({ backlinkDocumentId: documentId, }); - invariant(res?.data, "Document list not available"); - const { data } = res; runInAction("DocumentsStore#fetchBacklinks", () => { - data.forEach(this.add); - this.addPolicies(res.policies); - this.backlinks.set( documentId, - data.map((doc: Partial<Document>) => doc.id) + documents.map((doc) => doc.id) ); }); }; From 245d14f90537075e7b50503e8e3e681dceb7869a Mon Sep 17 00:00:00 2001 From: Tom Moor <tom@getoutline.com> Date: Wed, 7 May 2025 20:40:50 -0400 Subject: [PATCH 61/64] fix: Upgrade KaTeX (#9151) --- package.json | 2 +- yarn.lock | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index 9bb5bf2002..de76ebf72f 100644 --- a/package.json +++ b/package.json @@ -141,7 +141,7 @@ "jsdom": "^22.1.0", "jsonwebtoken": "^9.0.0", "jszip": "^3.10.1", - "katex": "^0.16.21", + "katex": "^0.16.22", "kbar": "0.1.0-beta.41", "koa": "^2.16.1", "koa-body": "^6.0.1", diff --git a/yarn.lock b/yarn.lock index 9e02603e83..97da60e3a1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -737,7 +737,7 @@ "@jridgewell/trace-mapping" "^0.3.25" jsesc "^3.0.2" -"@babel/helper-annotate-as-pure@^7.22.5", "@babel/helper-annotate-as-pure@^7.25.9", "@babel/helper-annotate-as-pure@^7.27.1": +"@babel/helper-annotate-as-pure@^7.22.5", "@babel/helper-annotate-as-pure@^7.27.1": version "7.27.1" resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.27.1.tgz#4345d81a9a46a6486e24d069469f13e60445c05d" integrity sha512-WnuuDILl9oOBbKnb4L+DyODx7iC47XfzmNCpTttFsSp6hTG7XZxu60+4IO+2/hPfcGOoKbFiwoI/+zwARbNQow== @@ -834,7 +834,7 @@ dependencies: "@babel/types" "^7.27.1" -"@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.10.4", "@babel/helper-plugin-utils@^7.12.13", "@babel/helper-plugin-utils@^7.13.0", "@babel/helper-plugin-utils@^7.14.5", "@babel/helper-plugin-utils@^7.18.6", "@babel/helper-plugin-utils@^7.19.0", "@babel/helper-plugin-utils@^7.22.5", "@babel/helper-plugin-utils@^7.25.9", "@babel/helper-plugin-utils@^7.27.1", "@babel/helper-plugin-utils@^7.8.0": +"@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.10.4", "@babel/helper-plugin-utils@^7.12.13", "@babel/helper-plugin-utils@^7.13.0", "@babel/helper-plugin-utils@^7.14.5", "@babel/helper-plugin-utils@^7.18.6", "@babel/helper-plugin-utils@^7.19.0", "@babel/helper-plugin-utils@^7.22.5", "@babel/helper-plugin-utils@^7.27.1", "@babel/helper-plugin-utils@^7.8.0": version "7.27.1" resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.27.1.tgz#ddb2f876534ff8013e6c2b299bf4d39b3c51d44c" integrity sha512-1gn1Up5YXka3YYAHGKpbideQ5Yjf1tDa9qYcgysz+cNCXukyLl6DjPXhD3VRwSb8c0J9tA4b2+rHEZtc6R0tlw== @@ -1663,7 +1663,7 @@ "@babel/parser" "^7.27.1" "@babel/types" "^7.27.1" -"@babel/traverse@^7.13.0", "@babel/traverse@^7.25.9", "@babel/traverse@^7.27.1", "@babel/traverse@^7.4.5", "@babel/traverse@^7.7.0": +"@babel/traverse@^7.13.0", "@babel/traverse@^7.27.1", "@babel/traverse@^7.4.5", "@babel/traverse@^7.7.0": version "7.27.1" resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.27.1.tgz#4db772902b133bbddd1c4f7a7ee47761c1b9f291" integrity sha512-ZCYtZciz1IWJB4U61UPu4KEaqyfj+r5T1Q5mqPo+IBpcG9kHv30Z0aD8LXPgC1trYa6rK0orRyAhqUgk4MjmEg== @@ -1676,7 +1676,7 @@ debug "^4.3.1" globals "^11.1.0" -"@babel/types@^7.0.0", "@babel/types@^7.25.9", "@babel/types@^7.27.1", "@babel/types@^7.3.0", "@babel/types@^7.3.3", "@babel/types@^7.4.4", "@babel/types@^7.7.0": +"@babel/types@^7.0.0", "@babel/types@^7.27.1", "@babel/types@^7.3.0", "@babel/types@^7.3.3", "@babel/types@^7.4.4", "@babel/types@^7.7.0": version "7.27.1" resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.27.1.tgz#9defc53c16fc899e46941fc6901a9eea1c9d8560" integrity sha512-+EzkxvLNfiUeKMgy/3luqfsCWFRXLb7U6wNQTk60tovuckwB15B191tJWvpp4HjiQWdJkCxO3Wbvc6jlk3Xb2Q== @@ -11162,10 +11162,10 @@ jws@^3.2.2: jwa "^1.4.1" safe-buffer "^5.0.1" -katex@^0.16.21, katex@^0.16.9: - version "0.16.21" - resolved "https://registry.yarnpkg.com/katex/-/katex-0.16.21.tgz#8f63c659e931b210139691f2cc7bb35166b792a3" - integrity sha512-XvqR7FgOHtWupfMiigNzmh+MgUVmDGU2kXZm899ZkPfcuoPuFxyHmXsgATDpFZDAXCI8tvinaVcDo8PIIJSo4A== +katex@^0.16.22, katex@^0.16.9: + version "0.16.22" + resolved "https://registry.yarnpkg.com/katex/-/katex-0.16.22.tgz#d2b3d66464b1e6d69e6463b28a86ced5a02c5ccd" + integrity sha512-XCHRdUw4lf3SKBaJe4EvgqIuWwkPSo9XoeO8GjQW94Bp7TWv9hNhzZjZ+OH9yf1UmLygb7DIT5GSFQiyt16zYg== dependencies: commander "^8.3.0" From 2e2a8bcc94d7c2cc61551957e099feacee4d8d20 Mon Sep 17 00:00:00 2001 From: Tom Moor <tom@getoutline.com> Date: Thu, 8 May 2025 18:15:16 -0400 Subject: [PATCH 62/64] fix: Allow searching for current user in collection permissions (#9154) --- app/components/Sharing/components/Suggestions.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/components/Sharing/components/Suggestions.tsx b/app/components/Sharing/components/Suggestions.tsx index 88ac6c6053..e9b67c6d9c 100644 --- a/app/components/Sharing/components/Suggestions.tsx +++ b/app/components/Sharing/components/Suggestions.tsx @@ -93,11 +93,13 @@ export const Suggestions = observer( const suggestions = React.useMemo(() => { const filtered: Suggestion[] = ( document - ? users.notInDocument(document.id, query) + ? users + .notInDocument(document.id, query) + .filter((u) => u.id !== user.id) : collection ? users.notInCollection(collection.id, query) : users.activeOrInvited - ).filter((u) => !u.isSuspended && u.id !== user.id); + ).filter((u) => !u.isSuspended); if (isEmail(query)) { filtered.push(getSuggestionForEmail(query)); From e216c68f6d1d8bac63898c2e59a662b67fc80cd8 Mon Sep 17 00:00:00 2001 From: Tom Moor <tom@getoutline.com> Date: Thu, 8 May 2025 21:40:01 -0400 Subject: [PATCH 63/64] fix: CMD+F with in-app find interface open should open native find interface (#9153) --- app/editor/components/FindAndReplace.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/app/editor/components/FindAndReplace.tsx b/app/editor/components/FindAndReplace.tsx index 09af0969d9..653fc8ca1e 100644 --- a/app/editor/components/FindAndReplace.tsx +++ b/app/editor/components/FindAndReplace.tsx @@ -41,6 +41,7 @@ function useKeyboardShortcuts({ useKeyDown( (ev) => isModKey(ev) && + !popover.visible && ev.code === "KeyF" && // Keyboard handler is through the AppMenu on Desktop v1.2.0+ !(Desktop.bridge && "onFindInPage" in Desktop.bridge), From fd984774d0c0392e56fec095d98d118aaacf67dd Mon Sep 17 00:00:00 2001 From: Tom Moor <tom@getoutline.com> Date: Sat, 10 May 2025 09:17:43 -0400 Subject: [PATCH 64/64] Add smart preloading of settings screens to reduce flicker (#9165) --- app/components/Collection/CollectionForm.tsx | 10 +++- app/components/LazyLoad.ts | 47 +++++++++++++++++ app/components/Reactions/ReactionPicker.tsx | 6 ++- app/components/Sidebar/Settings.tsx | 1 + app/hooks/useSettingsConfig.ts | 54 +++++++++++++------- app/utils/PluginManager.ts | 3 +- plugins/github/client/index.tsx | 4 +- plugins/googleanalytics/client/index.tsx | 4 +- plugins/linear/client/index.tsx | 4 +- plugins/matomo/client/index.tsx | 4 +- plugins/slack/client/index.tsx | 4 +- plugins/umami/client/index.tsx | 4 +- plugins/webhooks/client/index.tsx | 4 +- 13 files changed, 112 insertions(+), 37 deletions(-) create mode 100644 app/components/LazyLoad.ts diff --git a/app/components/Collection/CollectionForm.tsx b/app/components/Collection/CollectionForm.tsx index b1b5c3b159..776de17f03 100644 --- a/app/components/Collection/CollectionForm.tsx +++ b/app/components/Collection/CollectionForm.tsx @@ -15,6 +15,7 @@ import Button from "~/components/Button"; import Flex from "~/components/Flex"; import Input from "~/components/Input"; import InputSelectPermission from "~/components/InputSelectPermission"; +import { createLazyComponent } from "~/components/LazyLoad"; import Switch from "~/components/Switch"; import Text from "~/components/Text"; import useBoolean from "~/hooks/useBoolean"; @@ -22,7 +23,7 @@ import useCurrentTeam from "~/hooks/useCurrentTeam"; import useStores from "~/hooks/useStores"; import { EmptySelectValue } from "~/types"; -const IconPicker = React.lazy(() => import("~/components/IconPicker")); +const IconPicker = createLazyComponent(() => import("~/components/IconPicker")); export interface FormData { name: string; @@ -88,6 +89,11 @@ export const CollectionForm = observer(function CollectionForm_({ const values = watch(); + // Preload the IconPicker component on mount + React.useEffect(() => { + void IconPicker.preload(); + }, []); + React.useEffect(() => { // If the user hasn't picked an icon yet, go ahead and suggest one based on // the name of the collection. It's the little things sometimes. @@ -202,7 +208,7 @@ export const CollectionForm = observer(function CollectionForm_({ ); }); -const StyledIconPicker = styled(IconPicker)` +const StyledIconPicker = styled(IconPicker.Component)` margin-left: 4px; margin-right: 4px; `; diff --git a/app/components/LazyLoad.ts b/app/components/LazyLoad.ts new file mode 100644 index 0000000000..7634887530 --- /dev/null +++ b/app/components/LazyLoad.ts @@ -0,0 +1,47 @@ +import * as React from "react"; +import lazyWithRetry from "~/utils/lazyWithRetry"; + +export interface LazyComponent<T extends React.ComponentType<any>> { + Component: React.LazyExoticComponent<T>; + preload: () => Promise<{ default: T }>; +} + +interface LazyLoadOptions { + retries?: number; + interval?: number; +} + +/** + * Creates a lazy-loaded component with preloading capability and automatic retries on failure. + * + * @param factory A function that returns a promise of a component (eg: () => import('./MyComponent')) + * @param options Optional configuration for retry behavior + * @returns An object containing the lazy Component and a preload function + * + * @example + * ```typescript + * const MyComponent = createLazyComponent(() => import('./MyComponent')); + * + * function App() { + * return ( + * <Suspense fallback={<div>Loading...</div>}> + * <MyComponent.Component /> + * </Suspense> + * ); + * } + * + * // Preload when needed: + * MyComponent.preload(); + * ``` + */ +export function createLazyComponent<T extends React.ComponentType<any>>( + factory: () => Promise<{ default: T }>, + options: LazyLoadOptions = {} +): LazyComponent<T> { + const { retries, interval } = options; + + return { + Component: lazyWithRetry(factory, retries, interval), + preload: factory, + }; +} diff --git a/app/components/Reactions/ReactionPicker.tsx b/app/components/Reactions/ReactionPicker.tsx index 6aae9b446c..d5b765bb61 100644 --- a/app/components/Reactions/ReactionPicker.tsx +++ b/app/components/Reactions/ReactionPicker.tsx @@ -4,6 +4,7 @@ import { useTranslation } from "react-i18next"; import { PopoverDisclosure, usePopoverState } from "reakit"; import EventBoundary from "@shared/components/EventBoundary"; import Flex from "~/components/Flex"; +import { createLazyComponent } from "~/components/LazyLoad"; import NudeButton from "~/components/NudeButton"; import PlaceholderText from "~/components/PlaceholderText"; import Popover from "~/components/Popover"; @@ -12,7 +13,7 @@ import useOnClickOutside from "~/hooks/useOnClickOutside"; import useWindowSize from "~/hooks/useWindowSize"; import Tooltip from "../Tooltip"; -const EmojiPanel = React.lazy( +const EmojiPanel = createLazyComponent( () => import("~/components/IconPicker/components/EmojiPanel") ); @@ -104,6 +105,7 @@ const ReactionPicker: React.FC<Props> = ({ aria-label={t("Reaction picker")} className={className} onClick={handlePopoverButtonClick} + onMouseEnter={() => EmojiPanel.preload()} size={size} > <ReactionIcon size={22} /> @@ -123,7 +125,7 @@ const ReactionPicker: React.FC<Props> = ({ {popover.visible && ( <React.Suspense fallback={<Placeholder />}> <EventBoundary> - <EmojiPanel + <EmojiPanel.Component height={300} panelWidth={panelWidth} query={query} diff --git a/app/components/Sidebar/Settings.tsx b/app/components/Sidebar/Settings.tsx index 1161c54ed9..a156bbb3a8 100644 --- a/app/components/Sidebar/Settings.tsx +++ b/app/components/Sidebar/Settings.tsx @@ -63,6 +63,7 @@ function SettingsSidebar() { <SidebarLink key={item.path} to={item.path} + onClickIntent={item.preload} active={ item.path !== settingsPath() ? location.pathname.startsWith(item.path) diff --git a/app/hooks/useSettingsConfig.ts b/app/hooks/useSettingsConfig.ts index ece9989b0e..a212fb1ea8 100644 --- a/app/hooks/useSettingsConfig.ts +++ b/app/hooks/useSettingsConfig.ts @@ -19,9 +19,9 @@ import React, { ComponentProps } from "react"; import { useTranslation } from "react-i18next"; import { integrationSettingsPath } from "@shared/utils/routeHelpers"; import ZapierIcon from "~/components/Icons/ZapierIcon"; +import { createLazyComponent as lazy } from "~/components/LazyLoad"; import { Hook, PluginManager } from "~/utils/PluginManager"; import isCloudHosted from "~/utils/isCloudHosted"; -import lazy from "~/utils/lazyWithRetry"; import { settingsPath } from "~/utils/routeHelpers"; import { useComputed } from "./useComputed"; import useCurrentTeam from "./useCurrentTeam"; @@ -50,6 +50,7 @@ export type ConfigItem = { path: string; icon: React.FC<ComponentProps<typeof Icon>>; component: React.ComponentType; + preload?: () => void; enabled: boolean; group: string; }; @@ -66,7 +67,8 @@ const useSettingsConfig = () => { { name: t("Profile"), path: settingsPath(), - component: Profile, + component: Profile.Component, + preload: Profile.preload, enabled: true, group: t("Account"), icon: ProfileIcon, @@ -74,7 +76,8 @@ const useSettingsConfig = () => { { name: t("Preferences"), path: settingsPath("preferences"), - component: Preferences, + component: Preferences.Component, + preload: Preferences.preload, enabled: true, group: t("Account"), icon: SettingsIcon, @@ -82,7 +85,8 @@ const useSettingsConfig = () => { { name: t("Notifications"), path: settingsPath("notifications"), - component: Notifications, + component: Notifications.Component, + preload: Notifications.preload, enabled: true, group: t("Account"), icon: EmailIcon, @@ -90,7 +94,8 @@ const useSettingsConfig = () => { { name: t("API & Apps"), path: settingsPath("api-and-apps"), - component: APIAndApps, + component: APIAndApps.Component, + preload: APIAndApps.preload, enabled: true, group: t("Account"), icon: PadlockIcon, @@ -99,7 +104,8 @@ const useSettingsConfig = () => { { name: t("Details"), path: settingsPath("details"), - component: Details, + component: Details.Component, + preload: Details.preload, enabled: can.update, group: t("Workspace"), icon: TeamIcon, @@ -107,7 +113,8 @@ const useSettingsConfig = () => { { name: t("Security"), path: settingsPath("security"), - component: Security, + component: Security.Component, + preload: Security.preload, enabled: can.update, group: t("Workspace"), icon: PadlockIcon, @@ -115,7 +122,8 @@ const useSettingsConfig = () => { { name: t("Features"), path: settingsPath("features"), - component: Features, + component: Features.Component, + preload: Features.preload, enabled: can.update, group: t("Workspace"), icon: BeakerIcon, @@ -123,7 +131,8 @@ const useSettingsConfig = () => { { name: t("Members"), path: settingsPath("members"), - component: Members, + component: Members.Component, + preload: Members.preload, enabled: can.listUsers, group: t("Workspace"), icon: UserIcon, @@ -131,7 +140,8 @@ const useSettingsConfig = () => { { name: t("Groups"), path: settingsPath("groups"), - component: Groups, + component: Groups.Component, + preload: Groups.preload, enabled: can.listGroups, group: t("Workspace"), icon: GroupIcon, @@ -139,7 +149,8 @@ const useSettingsConfig = () => { { name: t("Templates"), path: settingsPath("templates"), - component: Templates, + component: Templates.Component, + preload: Templates.preload, enabled: can.readTemplate, group: t("Workspace"), icon: ShapesIcon, @@ -147,7 +158,8 @@ const useSettingsConfig = () => { { name: t("API Keys"), path: settingsPath("api-keys"), - component: ApiKeys, + component: ApiKeys.Component, + preload: ApiKeys.preload, enabled: can.listApiKeys, group: t("Workspace"), icon: CodeIcon, @@ -155,7 +167,8 @@ const useSettingsConfig = () => { { name: t("Applications"), path: settingsPath("applications"), - component: Applications, + component: Applications.Component, + preload: Applications.preload, enabled: can.listOAuthClients, group: t("Workspace"), icon: InternetIcon, @@ -163,7 +176,8 @@ const useSettingsConfig = () => { { name: t("Shared Links"), path: settingsPath("shares"), - component: Shares, + component: Shares.Component, + preload: Shares.preload, enabled: can.listShares, group: t("Workspace"), icon: GlobeIcon, @@ -171,7 +185,8 @@ const useSettingsConfig = () => { { name: t("Import"), path: settingsPath("import"), - component: Import, + component: Import.Component, + preload: Import.preload, enabled: can.createImport, group: t("Workspace"), icon: ImportIcon, @@ -179,7 +194,8 @@ const useSettingsConfig = () => { { name: t("Export"), path: settingsPath("export"), - component: Export, + component: Export.Component, + preload: Export.preload, enabled: can.createExport, group: t("Workspace"), icon: ExportIcon, @@ -188,7 +204,8 @@ const useSettingsConfig = () => { { name: "Zapier", path: integrationSettingsPath("zapier"), - component: Zapier, + component: Zapier.Component, + preload: Zapier.preload, enabled: can.update && isCloudHosted, group: t("Integrations"), icon: ZapierIcon, @@ -208,7 +225,8 @@ const useSettingsConfig = () => { ? integrationSettingsPath(plugin.id) : settingsPath(plugin.id), group: t(group), - component: plugin.value.component, + component: plugin.value.component.Component, + preload: plugin.value.component.preload, enabled: plugin.value.enabled ? plugin.value.enabled(team, user) : can.update, diff --git a/app/utils/PluginManager.ts b/app/utils/PluginManager.ts index a3f3a820b6..27d80ca7d5 100644 --- a/app/utils/PluginManager.ts +++ b/app/utils/PluginManager.ts @@ -3,6 +3,7 @@ import sortBy from "lodash/sortBy"; import { action, observable } from "mobx"; import Team from "~/models/Team"; import User from "~/models/User"; +import { LazyComponent } from "~/components/LazyLoad"; import { useComputed } from "~/hooks/useComputed"; import Logger from "./Logger"; import isCloudHosted from "./isCloudHosted"; @@ -28,7 +29,7 @@ type PluginValueMap = { /** The displayed icon of the plugin. */ icon: React.ElementType; /** The settings screen somponent, should be lazy loaded. */ - component: React.LazyExoticComponent<React.ComponentType>; + component: LazyComponent<React.ComponentType>; /** Whether the plugin is enabled in the current context. */ enabled?: (team: Team, user: User) => boolean; }; diff --git a/plugins/github/client/index.tsx b/plugins/github/client/index.tsx index fbdc2d7824..2506721686 100644 --- a/plugins/github/client/index.tsx +++ b/plugins/github/client/index.tsx @@ -1,4 +1,4 @@ -import * as React from "react"; +import { createLazyComponent } from "~/components/LazyLoad"; import { Hook, PluginManager } from "~/utils/PluginManager"; import config from "../plugin.json"; import Icon from "./Icon"; @@ -10,7 +10,7 @@ PluginManager.add([ value: { group: "Integrations", icon: Icon, - component: React.lazy(() => import("./Settings")), + component: createLazyComponent(() => import("./Settings")), }, }, ]); diff --git a/plugins/googleanalytics/client/index.tsx b/plugins/googleanalytics/client/index.tsx index fbdc2d7824..2506721686 100644 --- a/plugins/googleanalytics/client/index.tsx +++ b/plugins/googleanalytics/client/index.tsx @@ -1,4 +1,4 @@ -import * as React from "react"; +import { createLazyComponent } from "~/components/LazyLoad"; import { Hook, PluginManager } from "~/utils/PluginManager"; import config from "../plugin.json"; import Icon from "./Icon"; @@ -10,7 +10,7 @@ PluginManager.add([ value: { group: "Integrations", icon: Icon, - component: React.lazy(() => import("./Settings")), + component: createLazyComponent(() => import("./Settings")), }, }, ]); diff --git a/plugins/linear/client/index.tsx b/plugins/linear/client/index.tsx index fbdc2d7824..2506721686 100644 --- a/plugins/linear/client/index.tsx +++ b/plugins/linear/client/index.tsx @@ -1,4 +1,4 @@ -import * as React from "react"; +import { createLazyComponent } from "~/components/LazyLoad"; import { Hook, PluginManager } from "~/utils/PluginManager"; import config from "../plugin.json"; import Icon from "./Icon"; @@ -10,7 +10,7 @@ PluginManager.add([ value: { group: "Integrations", icon: Icon, - component: React.lazy(() => import("./Settings")), + component: createLazyComponent(() => import("./Settings")), }, }, ]); diff --git a/plugins/matomo/client/index.tsx b/plugins/matomo/client/index.tsx index b32c436cf4..1d2aeaf097 100644 --- a/plugins/matomo/client/index.tsx +++ b/plugins/matomo/client/index.tsx @@ -1,5 +1,5 @@ -import * as React from "react"; import { UserRole } from "@shared/types"; +import { createLazyComponent } from "~/components/LazyLoad"; import { Hook, PluginManager } from "~/utils/PluginManager"; import config from "../plugin.json"; import Icon from "./Icon"; @@ -11,7 +11,7 @@ PluginManager.add([ value: { group: "Integrations", icon: Icon, - component: React.lazy(() => import("./Settings")), + component: createLazyComponent(() => import("./Settings")), enabled: (_, user) => user.role === UserRole.Admin, }, }, diff --git a/plugins/slack/client/index.tsx b/plugins/slack/client/index.tsx index 27c1478fa1..0ac987c26d 100644 --- a/plugins/slack/client/index.tsx +++ b/plugins/slack/client/index.tsx @@ -1,5 +1,5 @@ -import * as React from "react"; import { UserRole } from "@shared/types"; +import { createLazyComponent } from "~/components/LazyLoad"; import { Hook, PluginManager } from "~/utils/PluginManager"; import config from "../plugin.json"; import Icon from "./Icon"; @@ -11,7 +11,7 @@ PluginManager.add([ value: { group: "Integrations", icon: Icon, - component: React.lazy(() => import("./Settings")), + component: createLazyComponent(() => import("./Settings")), enabled: (_, user) => [UserRole.Member, UserRole.Admin].includes(user.role), }, diff --git a/plugins/umami/client/index.tsx b/plugins/umami/client/index.tsx index b32c436cf4..1d2aeaf097 100644 --- a/plugins/umami/client/index.tsx +++ b/plugins/umami/client/index.tsx @@ -1,5 +1,5 @@ -import * as React from "react"; import { UserRole } from "@shared/types"; +import { createLazyComponent } from "~/components/LazyLoad"; import { Hook, PluginManager } from "~/utils/PluginManager"; import config from "../plugin.json"; import Icon from "./Icon"; @@ -11,7 +11,7 @@ PluginManager.add([ value: { group: "Integrations", icon: Icon, - component: React.lazy(() => import("./Settings")), + component: createLazyComponent(() => import("./Settings")), enabled: (_, user) => user.role === UserRole.Admin, }, }, diff --git a/plugins/webhooks/client/index.tsx b/plugins/webhooks/client/index.tsx index fbdc2d7824..2506721686 100644 --- a/plugins/webhooks/client/index.tsx +++ b/plugins/webhooks/client/index.tsx @@ -1,4 +1,4 @@ -import * as React from "react"; +import { createLazyComponent } from "~/components/LazyLoad"; import { Hook, PluginManager } from "~/utils/PluginManager"; import config from "../plugin.json"; import Icon from "./Icon"; @@ -10,7 +10,7 @@ PluginManager.add([ value: { group: "Integrations", icon: Icon, - component: React.lazy(() => import("./Settings")), + component: createLazyComponent(() => import("./Settings")), }, }, ]);