From 84c40c8392b2998c2acb5bfc9bc1db27462200b7 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Sun, 23 Aug 2026 16:29:21 -0400 Subject: [PATCH 001/181] fix: Revision diff mismatching node closing tokens (#13537) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The changeset token encoder cached node type ids in an object created with a null prototype, but tested for a cache miss with `=== null`. The miss reads as undefined, so the cache was never filled and every node end encoded to undefined — making the closing token of any node compare equal to that of any other. As a result revision diffs could omit a node's closing token when its type changed, and attribute an inserted wrapper's closing token to the node it wraps. Co-authored-by: Claude Opus 5 (1M context) --- shared/editor/lib/ChangesetHelper.test.ts | 57 +++++++++++++++++++++++ shared/editor/lib/ChangesetHelper.ts | 5 +- 2 files changed, 60 insertions(+), 2 deletions(-) diff --git a/shared/editor/lib/ChangesetHelper.test.ts b/shared/editor/lib/ChangesetHelper.test.ts index d9159aff91..7df65fdcdc 100644 --- a/shared/editor/lib/ChangesetHelper.test.ts +++ b/shared/editor/lib/ChangesetHelper.test.ts @@ -235,6 +235,63 @@ describe("ChangesetHelper.getChangeset", () => { expect(changes[0].inserted).toHaveLength(1); }); + describe("node boundary tokens", () => { + it("reports the change to a node's closing token when its type changes", () => { + // Converting a paragraph to a heading rewrites both of the node's + // boundary tokens. The closing tokens of the two node types must not + // compare as equal, or only the opening one is reported. + const changes = changesFor( + { + type: "doc", + content: [ + { + type: "heading", + attrs: { level: 1 }, + content: [{ type: "text", text: "Alpha" }], + }, + ], + }, + para("Alpha") + ); + + expect(changes).toHaveLength(2); + // The paragraph opens at 0 and closes at 6, either side of "Alpha". + expect([changes[0].fromA, changes[0].toA]).toEqual([0, 1]); + expect([changes[1].fromA, changes[1].toA]).toEqual([6, 7]); + }); + + it("places an inserted wrapper's closing token outside the node it wraps", () => { + // Wrapping the paragraph in a blockquote inserts the quote's closing + // token after the paragraph, at the end of the old document. Matching it + // to the paragraph's own closing token instead would report the + // insertion at 6, inside the paragraph. + const changes = changesFor( + { + type: "doc", + content: [ + { + type: "blockquote", + content: [ + { + type: "paragraph", + content: [{ type: "text", text: "Alpha" }], + }, + ], + }, + ], + }, + para("Alpha") + ); + + expect(changes).toHaveLength(2); + expect([changes[0].fromA, changes[0].toA]).toEqual([0, 0]); + expect([changes[1].fromA, changes[1].toA]).toEqual([7, 7]); + // In the new document the change is the blockquote's closing token at + // 8, not the paragraph's at 7. + expect([changes[1].fromB, changes[1].toB]).toEqual([8, 9]); + }); + }); + describe("complexity guard", () => { const texts = Array.from( { length: 500 }, diff --git a/shared/editor/lib/ChangesetHelper.ts b/shared/editor/lib/ChangesetHelper.ts index 4973d13152..6f85306b66 100644 --- a/shared/editor/lib/ChangesetHelper.ts +++ b/shared/editor/lib/ChangesetHelper.ts @@ -246,11 +246,12 @@ class AttributeEncoder implements TokenEncoder { // See: https://github.com/ProseMirror/prosemirror-changeset/blob/23f67c002e5489e454a0473479e407decb238afe/src/diff.ts#L26 public encodeNodeEnd({ type }: Node): number { - let cache: Record = + const cache: Record = type.schema.cached.changeSetIDs || (type.schema.cached.changeSetIDs = Object.create(null)); + // The cache has a null prototype, so a miss reads as undefined. let id = cache[type.name]; - if (id === null) { + if (id === undefined) { cache[type.name] = id = Object.keys(type.schema.nodes).indexOf(type.name) + 1; } From c34540e04714b2f9a65d9677bb4bb9ae4854c2b5 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Sun, 23 Aug 2026 17:08:54 -0400 Subject: [PATCH 002/181] Add collection metadata line (#13538) * feat: Metadata below collection title Extracts the shared meta line styles from DocumentMeta into a reusable HeaderMeta component, and adds an equivalent meta line beneath collection titles showing visibility, public sharing, and document count. Co-Authored-By: Claude Opus 5 (1M context) * i18n * fix: Show document count for empty collections Co-Authored-By: Claude Opus 5 (1M context) --------- Co-authored-by: Claude Opus 5 (1M context) --- app/components/DocumentMeta.tsx | 36 +------ app/components/HeaderMeta.tsx | 86 +++++++++++++++ .../Collection/components/CollectionMeta.tsx | 102 ++++++++++++++++++ app/scenes/Collection/index.tsx | 2 + .../Document/components/DocumentMeta.tsx | 38 ++----- shared/i18n/locales/en_US/translation.json | 8 +- 6 files changed, 207 insertions(+), 65 deletions(-) create mode 100644 app/components/HeaderMeta.tsx create mode 100644 app/scenes/Collection/components/CollectionMeta.tsx diff --git a/app/components/DocumentMeta.tsx b/app/components/DocumentMeta.tsx index 32a04a0bfc..f9e5413f2c 100644 --- a/app/components/DocumentMeta.tsx +++ b/app/components/DocumentMeta.tsx @@ -5,13 +5,13 @@ import * as React from "react"; import { useTranslation } from "react-i18next"; import { Link } from "react-router-dom"; import styled from "styled-components"; -import { s, ellipsis } from "@shared/styles"; +import { ellipsis } from "@shared/styles"; import type Document from "~/models/Document"; import type Revision from "~/models/Revision"; import DocumentBreadcrumb from "~/components/DocumentBreadcrumb"; import DocumentTasks from "~/components/DocumentTasks"; import Flex from "~/components/Flex"; -import NudeButton from "~/components/NudeButton"; +import { MetaButton, Separator, metaStyles } from "~/components/HeaderMeta"; import Time from "~/components/Time"; import useCurrentUser from "~/hooks/useCurrentUser"; import useStores from "~/hooks/useStores"; @@ -229,42 +229,12 @@ const DocumentMeta: React.FC = ({ ); }; -/** A button that visually matches the surrounding meta text. */ -export const MetaButton = styled(NudeButton)` - display: inline-flex; - align-items: center; - gap: 2px; - width: auto; - height: auto; - border-radius: 0; - color: inherit; - font: inherit; - text-align: inherit; - - &:hover { - text-decoration: underline; - } -`; - -export const Separator = styled.span` - padding: 0 0.4em; - - &::after { - content: "•"; - } -`; - const Strong = styled.strong` font-weight: 550; `; const Container = styled(Flex)<{ $rtl?: boolean }>` - justify-content: ${(props) => (props.$rtl ? "flex-end" : "flex-start")}; - color: ${s("textTertiary")}; - font-size: 13px; - white-space: nowrap; - overflow: hidden; - min-width: 0; + ${metaStyles} `; const Viewed = styled.span` diff --git a/app/components/HeaderMeta.tsx b/app/components/HeaderMeta.tsx new file mode 100644 index 0000000000..68cd6c6484 --- /dev/null +++ b/app/components/HeaderMeta.tsx @@ -0,0 +1,86 @@ +import styled, { css } from "styled-components"; +import breakpoint from "styled-components-breakpoint"; +import { s } from "@shared/styles"; +import Flex from "~/components/Flex"; +import NudeButton from "~/components/NudeButton"; + +/** A dot separating two pieces of meta information. */ +export const Separator = styled.span` + padding: 0 0.4em; + + &::after { + content: "•"; + } +`; + +/** A button that visually matches the surrounding meta text. */ +export const MetaButton = styled(NudeButton)` + display: inline-flex; + align-items: center; + gap: 2px; + width: auto; + height: auto; + border-radius: 0; + color: inherit; + font: inherit; + text-align: inherit; + + &:hover { + text-decoration: underline; + } +`; + +/** Lays out a line of meta information about a document or collection. */ +export const metaStyles = css<{ $rtl?: boolean }>` + justify-content: ${(props) => (props.$rtl ? "flex-end" : "flex-start")}; + color: ${s("textTertiary")}; + font-size: 13px; + white-space: nowrap; + overflow: hidden; + min-width: 0; +`; + +/** + * Additional styles for a line of meta information rendered directly beneath a + * page title. Composed by `HeaderMeta`, and applied directly by consumers that + * style an existing meta component rather than rendering their own. + */ +export const headerMetaStyles = css` + margin: -12px 0 2em 0; + font-size: 14px; + position: relative; + user-select: none; + z-index: 1; + + ${breakpoint("mobile", "tablet")` + flex-direction: column; + align-items: flex-start; + line-height: 1.6; + + ${Separator} { + display: none; + } + `} + + a { + color: inherit; + cursor: var(--pointer); + + &:hover { + text-decoration: underline; + } + } + + @media print { + display: none; + } +`; + +/** + * A line of meta information rendered directly beneath a page title, stacking + * into a list on mobile and hidden when printing. + */ +export const HeaderMeta = styled(Flex)<{ $rtl?: boolean }>` + ${metaStyles} + ${headerMetaStyles} +`; diff --git a/app/scenes/Collection/components/CollectionMeta.tsx b/app/scenes/Collection/components/CollectionMeta.tsx new file mode 100644 index 0000000000..3b89148ee2 --- /dev/null +++ b/app/scenes/Collection/components/CollectionMeta.tsx @@ -0,0 +1,102 @@ +import { observer } from "mobx-react"; +import { GlobeIcon, PadlockIcon, TeamIcon } from "outline-icons"; +import { useEffect } from "react"; +import { useTranslation } from "react-i18next"; +import styled from "styled-components"; +import breakpoint from "styled-components-breakpoint"; +import { flattenTree } from "@shared/utils/tree"; +import type Collection from "~/models/Collection"; +import Flex from "~/components/Flex"; +import { HeaderMeta, Separator } from "~/components/HeaderMeta"; +import Tooltip from "~/components/Tooltip"; +import useCurrentTeam from "~/hooks/useCurrentTeam"; +import useStores from "~/hooks/useStores"; + +type Props = { + /** The collection to display meta information for */ + collection: Collection; +}; + +/** + * A line of meta information about a collection, rendered directly beneath its + * title to match the equivalent display for documents. + */ +export const CollectionMeta = observer(function CollectionMeta_({ + collection, +}: Props) { + const { t } = useTranslation(); + const { shares } = useStores(); + const team = useCurrentTeam(); + + const share = shares.getByCollectionId(collection.id); + const isPubliclyShared = + team.sharing !== false && + collection.sharing !== false && + !!share?.published; + + // The document structure is cached on the collection once loaded, so this is + // a no-op when the sidebar or another tab has already requested it. + useEffect(() => { + void collection.fetchDocuments(); + }, [collection]); + + const documentCount = collection.documents + ? flattenTree(collection.asNavigationNode).length - 1 + : undefined; + + return ( + + + + {collection.isPrivate ? ( + + ) : ( + + )} + {collection.isPrivate ? t("Private") : t("Workspace")} + + + {isPubliclyShared && ( + <> + + + + + {t("Publicly shared")} + + + + )} + {documentCount !== undefined && ( + + + {t("{{ count }} document", { count: documentCount })} + + )} + + ); +}); + +const IconLabel = styled(Flex)` + gap: 2px; + cursor: default; +`; + +const Meta = styled(HeaderMeta)` + // Aligns with the collection title, which is indented on mobile. + margin-inline-start: 16px; + + ${breakpoint("tablet")` + margin-inline-start: 0; + `} +`; diff --git a/app/scenes/Collection/index.tsx b/app/scenes/Collection/index.tsx index 72d01d7980..6370b3681b 100644 --- a/app/scenes/Collection/index.tsx +++ b/app/scenes/Collection/index.tsx @@ -48,6 +48,7 @@ import MembershipPreview from "./components/MembershipPreview"; import Navigation, { CollectionTab } from "./components/Navigation"; import Notices from "./components/Notices"; import Overview from "./components/Overview"; +import { CollectionMeta } from "./components/CollectionMeta"; import { Header } from "./components/Header"; import usePersistedState from "~/hooks/usePersistedState"; import useCurrentUser from "~/hooks/useCurrentUser"; @@ -185,6 +186,7 @@ const CollectionScene = observer(function CollectionScene_() { collection={collection} isEditing={isEditRoute || !user?.separateEditMode} /> + ` - justify-content: ${(props) => (props.$rtl ? "flex-end" : "flex-start")}; - margin: -12px 0 2em 0; - font-size: 14px; - position: relative; - user-select: none; - z-index: 1; - - ${breakpoint("mobile", "tablet")` - flex-direction: column; - align-items: flex-start; - line-height: 1.6; - - ${Separator} { - display: none; - } - `} - - a { - color: inherit; - cursor: var(--pointer); - - &:hover { - text-decoration: underline; - } - } - - @media print { - display: none; - } + ${headerMetaStyles} `; export default observer(TitleDocumentMeta); diff --git a/shared/i18n/locales/en_US/translation.json b/shared/i18n/locales/en_US/translation.json index b443ee72a6..698f972104 100644 --- a/shared/i18n/locales/en_US/translation.json +++ b/shared/i18n/locales/en_US/translation.json @@ -855,6 +855,13 @@ "No expiration": "No expiration", "The document archive is empty at the moment.": "The document archive is empty at the moment.", "Done editing": "Done editing", + "Only members with access can view": "Only members with access can view", + "All members in the workspace can view": "All members in the workspace can view", + "Private": "Private", + "Anyone with the link can view": "Anyone with the link can view", + "Publicly shared": "Publicly shared", + "{{ count }} document": "{{ count }} document", + "{{ count }} document_plural": "{{ count }} documents", "Drop documents to import": "Drop documents to import", "{{ collectionName }} doesn’t contain any\n documents yet.": "{{ collectionName }} doesn’t contain any\n documents yet.", "{{ usersCount }} users and {{ groupsCount }} groups with access": "{{ usersCount }} user and {{ groupsCount }} groups with access", @@ -1592,7 +1599,6 @@ "IP": "IP", "a group": "a group", "All users": "All users", - "Private": "Private", "View and edit": "View and edit", "Sharing enabled": "Sharing enabled", "Date archived": "Date archived", From 72aa0f0063b83d236ba629d78976cf4190270f1b Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Sun, 23 Aug 2026 21:10:44 -0400 Subject: [PATCH 003/181] fix: Remove associated notifications when access is lost (#13208) * review * Revoke notifications when a document is moved Moving a document into a collection the recipient cannot read leaves a notification holding the title and text, so schedule a revocation check for each recipient of the moved document and its descendants. Also adds coverage proving drafts are revoked through the document path, and notes why the scoped query includes them. Co-Authored-By: Claude Opus 5 (1M context) --------- Co-authored-by: Claude Opus 5 (1M context) --- app/components/WebsocketProvider.tsx | 4 + .../server/tasks/DeliverWebhookTask.ts | 1 + .../NotificationsRevokeProcessor.test.ts | 229 +++++++++++++++ .../NotificationsRevokeProcessor.ts | 155 ++++++++++ .../queues/processors/WebsocketsProcessor.ts | 6 + .../tasks/RevokeUserNotificationsTask.test.ts | 272 ++++++++++++++++++ .../tasks/RevokeUserNotificationsTask.ts | 194 +++++++++++++ server/types.ts | 5 +- 8 files changed, 865 insertions(+), 1 deletion(-) create mode 100644 server/queues/processors/NotificationsRevokeProcessor.test.ts create mode 100644 server/queues/processors/NotificationsRevokeProcessor.ts create mode 100644 server/queues/tasks/RevokeUserNotificationsTask.test.ts create mode 100644 server/queues/tasks/RevokeUserNotificationsTask.ts diff --git a/app/components/WebsocketProvider.tsx b/app/components/WebsocketProvider.tsx index bf56929990..8aacc678b8 100644 --- a/app/components/WebsocketProvider.tsx +++ b/app/components/WebsocketProvider.tsx @@ -792,6 +792,10 @@ function useNotificationHandlers() { } ); + socket.on("notifications.delete", (event: WebsocketEntityDeletedEvent) => { + notifications.remove(event.modelId); + }); + socket.on( "subscriptions.create", (event: PartialExcept) => { diff --git a/plugins/webhooks/server/tasks/DeliverWebhookTask.ts b/plugins/webhooks/server/tasks/DeliverWebhookTask.ts index bb4962945b..c9db826617 100644 --- a/plugins/webhooks/server/tasks/DeliverWebhookTask.ts +++ b/plugins/webhooks/server/tasks/DeliverWebhookTask.ts @@ -169,6 +169,7 @@ export default class DeliverWebhookTask extends BaseTask { case "authenticationProviders.update": case "notifications.create": case "notifications.update": + case "notifications.delete": case "access_requests.create": // Ignored return; diff --git a/server/queues/processors/NotificationsRevokeProcessor.test.ts b/server/queues/processors/NotificationsRevokeProcessor.test.ts new file mode 100644 index 0000000000..0eaf959da8 --- /dev/null +++ b/server/queues/processors/NotificationsRevokeProcessor.test.ts @@ -0,0 +1,229 @@ +import { CollectionPermission } from "@shared/types"; +import { AuthenticationType } from "@server/types"; +import { + buildCollection, + buildDocument, + buildGroup, + buildGroupUser, + buildNotification, + buildTeam, + buildUser, +} from "@server/test/factories"; +import RevokeUserNotificationsTask from "../tasks/RevokeUserNotificationsTask"; +import NotificationsRevokeProcessor from "./NotificationsRevokeProcessor"; + +describe("NotificationsRevokeProcessor", () => { + const schedule = vi + .spyOn(RevokeUserNotificationsTask.prototype, "schedule") + .mockResolvedValue(undefined as never); + + beforeEach(() => { + schedule.mockClear(); + }); + + it("should schedule a check for the removed user", async () => { + const team = await buildTeam(); + const user = await buildUser({ teamId: team.id }); + const collection = await buildCollection({ teamId: team.id }); + + await new NotificationsRevokeProcessor().perform({ + name: "collections.remove_user", + userId: user.id, + modelId: collection.id, + collectionId: collection.id, + teamId: team.id, + actorId: user.id, + ip: "127.0.0.1", + authType: AuthenticationType.APP, + data: {}, + }); + + expect(schedule).toHaveBeenCalledWith( + expect.objectContaining({ + userId: user.id, + collectionId: collection.id, + }) + ); + }); + + it("should schedule a check for every member of a removed group", async () => { + const team = await buildTeam(); + const group = await buildGroup({ teamId: team.id }); + const document = await buildDocument({ teamId: team.id }); + const [first, second] = await Promise.all([ + buildUser({ teamId: team.id }), + buildUser({ teamId: team.id }), + ]); + await buildGroupUser({ + teamId: team.id, + groupId: group.id, + userId: first.id, + }); + await buildGroupUser({ + teamId: team.id, + groupId: group.id, + userId: second.id, + }); + + await new NotificationsRevokeProcessor().perform({ + name: "documents.remove_group", + modelId: group.id, + documentId: document.id, + teamId: team.id, + actorId: first.id, + ip: "127.0.0.1", + data: { membershipId: "membership" }, + }); + + expect(schedule).toHaveBeenCalledTimes(2); + expect(schedule).toHaveBeenCalledWith( + expect.objectContaining({ userId: first.id, documentId: document.id }) + ); + expect(schedule).toHaveBeenCalledWith( + expect.objectContaining({ userId: second.id, documentId: document.id }) + ); + }); + + it("should schedule a scope-less check for a user removed from a group", async () => { + const team = await buildTeam(); + const group = await buildGroup({ teamId: team.id }); + const user = await buildUser({ teamId: team.id }); + + await new NotificationsRevokeProcessor().perform({ + name: "groups.remove_user", + userId: user.id, + modelId: group.id, + teamId: team.id, + actorId: user.id, + ip: "127.0.0.1", + }); + + expect(schedule).toHaveBeenCalledWith({ userId: user.id }); + }); + + it("should schedule a scope-less check for every member of a deleted group", async () => { + const team = await buildTeam(); + const group = await buildGroup({ teamId: team.id }); + const [first, second] = await Promise.all([ + buildUser({ teamId: team.id }), + buildUser({ teamId: team.id }), + ]); + await buildGroupUser({ + teamId: team.id, + groupId: group.id, + userId: first.id, + }); + await buildGroupUser({ + teamId: team.id, + groupId: group.id, + userId: second.id, + }); + await group.destroy(); + + await new NotificationsRevokeProcessor().perform({ + name: "groups.delete", + modelId: group.id, + teamId: team.id, + actorId: first.id, + ip: "127.0.0.1", + }); + + expect(schedule).toHaveBeenCalledTimes(2); + expect(schedule).toHaveBeenCalledWith({ userId: first.id }); + expect(schedule).toHaveBeenCalledWith({ userId: second.id }); + }); + + it("should schedule a check for every notified user when a collection becomes private", async () => { + const team = await buildTeam(); + const user = await buildUser({ teamId: team.id }); + const other = await buildUser({ teamId: team.id }); + const collection = await buildCollection({ + teamId: team.id, + permission: CollectionPermission.Read, + }); + const document = await buildDocument({ + teamId: team.id, + collectionId: collection.id, + }); + await buildNotification({ + teamId: team.id, + userId: user.id, + documentId: document.id, + }); + await buildNotification({ + teamId: team.id, + userId: other.id, + collectionId: collection.id, + }); + + await new NotificationsRevokeProcessor().perform({ + name: "collections.permission_changed", + collectionId: collection.id, + teamId: team.id, + actorId: user.id, + ip: "127.0.0.1", + }); + + expect(schedule).toHaveBeenCalledTimes(2); + expect(schedule).toHaveBeenCalledWith( + expect.objectContaining({ userId: user.id, collectionId: collection.id }) + ); + expect(schedule).toHaveBeenCalledWith( + expect.objectContaining({ userId: other.id, collectionId: collection.id }) + ); + }); + + it("should schedule a check for every recipient when a document is moved", async () => { + const team = await buildTeam(); + const actor = await buildUser({ teamId: team.id }); + const collection = await buildCollection({ teamId: team.id }); + const document = await buildDocument({ + teamId: team.id, + collectionId: collection.id, + }); + const [first, second] = await Promise.all([ + buildUser({ teamId: team.id }), + buildUser({ teamId: team.id }), + ]); + await Promise.all([ + buildNotification({ + teamId: team.id, + userId: first.id, + documentId: document.id, + }), + buildNotification({ + teamId: team.id, + userId: second.id, + documentId: document.id, + }), + ]); + + await new NotificationsRevokeProcessor().perform({ + name: "documents.move", + documentId: document.id, + collectionId: collection.id, + teamId: team.id, + actorId: actor.id, + ip: "127.0.0.1", + authType: AuthenticationType.APP, + data: { + collectionIds: [collection.id], + documentIds: [document.id], + }, + }); + + expect(schedule).toHaveBeenCalledTimes(2); + expect(schedule).toHaveBeenCalledWith( + expect.objectContaining({ + userId: first.id, + documentId: document.id, + }) + ); + expect(schedule).toHaveBeenCalledWith( + expect.objectContaining({ + userId: second.id, + documentId: document.id, + }) + ); + }); +}); diff --git a/server/queues/processors/NotificationsRevokeProcessor.ts b/server/queues/processors/NotificationsRevokeProcessor.ts new file mode 100644 index 0000000000..6f0b964896 --- /dev/null +++ b/server/queues/processors/NotificationsRevokeProcessor.ts @@ -0,0 +1,155 @@ +import { Op } from "sequelize"; +import { Document, GroupUser, Notification } from "@server/models"; +import type { + CollectionEvent, + CollectionGroupEvent, + CollectionUserEvent, + DocumentGroupEvent, + DocumentMovedEvent, + DocumentUserEvent, + Event, + GroupEvent, +} from "@server/types"; +import type { RevokeScope } from "../tasks/RevokeUserNotificationsTask"; +import RevokeUserNotificationsTask from "../tasks/RevokeUserNotificationsTask"; +import BaseProcessor from "./BaseProcessor"; + +type ReceivedEvent = + | CollectionEvent + | CollectionUserEvent + | CollectionGroupEvent + | DocumentUserEvent + | DocumentGroupEvent + | DocumentMovedEvent + | GroupEvent; + +/** + * Revokes notifications that reference a document or collection once the recipient loses access to it. + */ +export default class NotificationsRevokeProcessor extends BaseProcessor { + static applicableEvents: Event["name"][] = [ + "collections.remove_user", + "collections.remove_group", + "collections.permission_changed", + "documents.remove_user", + "documents.remove_group", + "documents.move", + "groups.remove_user", + "groups.delete", + ]; + + async perform(event: ReceivedEvent) { + switch (event.name) { + case "collections.remove_user": + await new RevokeUserNotificationsTask().schedule({ + userId: event.userId, + collectionId: event.collectionId, + }); + return; + + case "documents.remove_user": + await new RevokeUserNotificationsTask().schedule({ + userId: event.userId, + documentId: event.documentId, + }); + return; + + case "collections.remove_group": + return this.handleRemoveGroup(event.modelId, { + collectionId: event.collectionId, + }); + + case "documents.remove_group": + return this.handleRemoveGroup(event.modelId, { + documentId: event.documentId, + }); + + // Access lost through a group cannot be scoped to a single collection or document, so all + // of the user's notifications are re-checked. + case "groups.remove_user": + await new RevokeUserNotificationsTask().schedule({ + userId: event.userId, + }); + return; + + case "groups.delete": + return this.handleRemoveGroup(event.modelId, {}); + + case "collections.permission_changed": + return this.handlePermissionChanged(event); + + case "documents.move": + return this.handleDocumentMoved(event); + } + } + + // A move carries the document into a different collection, which the recipient of a notification + // about it may not be able to read. + private async handleDocumentMoved(event: DocumentMovedEvent) { + const notifications = await Notification.unscoped().findAll({ + attributes: ["userId"], + where: { documentId: event.data.documentIds }, + group: ["notification.userId"], + }); + + await Promise.all( + notifications.map((notification) => + new RevokeUserNotificationsTask().schedule({ + userId: notification.userId, + documentId: event.documentId, + }) + ) + ); + } + + private async handleRemoveGroup(groupId: string, scope: RevokeScope) { + await GroupUser.findAllInBatches( + { + attributes: ["userId"], + where: { groupId }, + batchLimit: 1000, + }, + async (groupUsers) => { + await Promise.all( + groupUsers.map((groupUser) => + new RevokeUserNotificationsTask().schedule({ + ...scope, + userId: groupUser.userId, + }) + ) + ); + } + ); + } + + private async handlePermissionChanged(event: CollectionEvent) { + const notifications = await Notification.unscoped().findAll({ + attributes: ["userId"], + where: { + [Op.or]: [ + { collectionId: event.collectionId }, + { "$document.collectionId$": event.collectionId }, + ], + }, + include: [ + { + model: Document.unscoped(), + as: "document", + attributes: [], + required: false, + paranoid: false, + }, + ], + group: ["notification.userId"], + }); + + await Promise.all( + notifications.map((notification) => + new RevokeUserNotificationsTask().schedule({ + userId: notification.userId, + collectionId: event.collectionId, + }) + ) + ); + } +} diff --git a/server/queues/processors/WebsocketsProcessor.ts b/server/queues/processors/WebsocketsProcessor.ts index ae6a8025b4..790317bfb6 100644 --- a/server/queues/processors/WebsocketsProcessor.ts +++ b/server/queues/processors/WebsocketsProcessor.ts @@ -702,6 +702,12 @@ export default class WebsocketsProcessor { return socketio.to(`user-${event.userId}`).emit(event.name, data); } + case "notifications.delete": { + return socketio.to(`user-${event.userId}`).emit(event.name, { + modelId: event.modelId, + }); + } + case "stars.create": case "stars.update": { const star = await Star.findByPk(event.modelId); diff --git a/server/queues/tasks/RevokeUserNotificationsTask.test.ts b/server/queues/tasks/RevokeUserNotificationsTask.test.ts new file mode 100644 index 0000000000..2ab1ce95d5 --- /dev/null +++ b/server/queues/tasks/RevokeUserNotificationsTask.test.ts @@ -0,0 +1,272 @@ +import { + CollectionPermission, + DocumentPermission, + NotificationEventType, +} from "@shared/types"; +import { Notification, UserMembership } from "@server/models"; +import { + buildCollection, + buildDocument, + buildDraftDocument, + buildNotification, + buildTeam, + buildUser, +} from "@server/test/factories"; +import RevokeUserNotificationsTask from "./RevokeUserNotificationsTask"; + +describe("RevokeUserNotificationsTask", () => { + it("should revoke notifications for a collection the user can no longer read", async () => { + const team = await buildTeam(); + const user = await buildUser({ teamId: team.id }); + const collection = await buildCollection({ + teamId: team.id, + permission: null, + }); + const document = await buildDocument({ + teamId: team.id, + collectionId: collection.id, + }); + const notification = await buildNotification({ + teamId: team.id, + userId: user.id, + documentId: document.id, + }); + + await new RevokeUserNotificationsTask().perform({ + userId: user.id, + collectionId: collection.id, + }); + + expect(await Notification.findByPk(notification.id)).toBeNull(); + }); + + it("should retain notifications when the user can still read the document", async () => { + const team = await buildTeam(); + const user = await buildUser({ teamId: team.id }); + const collection = await buildCollection({ + teamId: team.id, + permission: CollectionPermission.Read, + }); + const document = await buildDocument({ + teamId: team.id, + collectionId: collection.id, + }); + const notification = await buildNotification({ + teamId: team.id, + userId: user.id, + documentId: document.id, + }); + + await new RevokeUserNotificationsTask().perform({ + userId: user.id, + collectionId: collection.id, + }); + + expect(await Notification.findByPk(notification.id)).not.toBeNull(); + }); + + it("should retain notifications when the user still has a document membership", async () => { + const team = await buildTeam(); + const user = await buildUser({ teamId: team.id }); + const collection = await buildCollection({ + teamId: team.id, + permission: null, + }); + const document = await buildDocument({ + teamId: team.id, + collectionId: collection.id, + }); + await UserMembership.create({ + userId: user.id, + documentId: document.id, + createdById: user.id, + permission: DocumentPermission.Read, + }); + const notification = await buildNotification({ + teamId: team.id, + userId: user.id, + documentId: document.id, + }); + + await new RevokeUserNotificationsTask().perform({ + userId: user.id, + collectionId: collection.id, + }); + + expect(await Notification.findByPk(notification.id)).not.toBeNull(); + }); + + it("should revoke notifications for nested documents when scoped to a document", async () => { + const team = await buildTeam(); + const user = await buildUser({ teamId: team.id }); + const collection = await buildCollection({ + teamId: team.id, + permission: null, + }); + const parent = await buildDocument({ + teamId: team.id, + collectionId: collection.id, + }); + const child = await buildDocument({ + teamId: team.id, + collectionId: collection.id, + parentDocumentId: parent.id, + }); + const notification = await buildNotification({ + teamId: team.id, + userId: user.id, + documentId: child.id, + }); + + await new RevokeUserNotificationsTask().perform({ + userId: user.id, + documentId: parent.id, + }); + + expect(await Notification.findByPk(notification.id)).toBeNull(); + }); + + it("should revoke notifications for a draft the user can no longer read", async () => { + const team = await buildTeam(); + const user = await buildUser({ teamId: team.id }); + const collection = await buildCollection({ + teamId: team.id, + permission: null, + }); + const document = await buildDraftDocument({ + teamId: team.id, + collectionId: collection.id, + }); + const notification = await buildNotification({ + teamId: team.id, + userId: user.id, + documentId: document.id, + }); + + await new RevokeUserNotificationsTask().perform({ + userId: user.id, + collectionId: collection.id, + }); + + expect(await Notification.findByPk(notification.id)).toBeNull(); + }); + + it("should revoke notifications about the collection itself", async () => { + const team = await buildTeam(); + const user = await buildUser({ teamId: team.id }); + const collection = await buildCollection({ + teamId: team.id, + permission: null, + }); + const notification = await buildNotification({ + teamId: team.id, + userId: user.id, + collectionId: collection.id, + event: NotificationEventType.AddUserToCollection, + }); + + await new RevokeUserNotificationsTask().perform({ + userId: user.id, + collectionId: collection.id, + }); + + expect(await Notification.findByPk(notification.id)).toBeNull(); + }); + + it("should re-check all notifications when no scope is given", async () => { + const team = await buildTeam(); + const user = await buildUser({ teamId: team.id }); + const privateCollection = await buildCollection({ + teamId: team.id, + permission: null, + }); + const openCollection = await buildCollection({ + teamId: team.id, + permission: CollectionPermission.Read, + }); + const unreadable = await buildDocument({ + teamId: team.id, + collectionId: privateCollection.id, + }); + const readable = await buildDocument({ + teamId: team.id, + collectionId: openCollection.id, + }); + const revoked = await buildNotification({ + teamId: team.id, + userId: user.id, + documentId: unreadable.id, + }); + const retained = await buildNotification({ + teamId: team.id, + userId: user.id, + documentId: readable.id, + }); + const collectionNotification = await buildNotification({ + teamId: team.id, + userId: user.id, + collectionId: privateCollection.id, + event: NotificationEventType.AddUserToCollection, + }); + + await new RevokeUserNotificationsTask().perform({ userId: user.id }); + + expect(await Notification.findByPk(revoked.id)).toBeNull(); + expect(await Notification.findByPk(retained.id)).not.toBeNull(); + expect(await Notification.findByPk(collectionNotification.id)).toBeNull(); + }); + + it("should not revoke notifications outside of the given collection", async () => { + const team = await buildTeam(); + const user = await buildUser({ teamId: team.id }); + const collection = await buildCollection({ + teamId: team.id, + permission: null, + }); + const other = await buildCollection({ + teamId: team.id, + permission: null, + }); + const document = await buildDocument({ + teamId: team.id, + collectionId: other.id, + }); + const notification = await buildNotification({ + teamId: team.id, + userId: user.id, + documentId: document.id, + }); + + await new RevokeUserNotificationsTask().perform({ + userId: user.id, + collectionId: collection.id, + }); + + expect(await Notification.findByPk(notification.id)).not.toBeNull(); + }); + + it("should revoke notifications for a draft when scoped to the document", async () => { + const team = await buildTeam(); + const user = await buildUser({ teamId: team.id }); + const collection = await buildCollection({ + teamId: team.id, + permission: null, + }); + const document = await buildDraftDocument({ + teamId: team.id, + collectionId: collection.id, + }); + const notification = await buildNotification({ + teamId: team.id, + userId: user.id, + documentId: document.id, + }); + + await new RevokeUserNotificationsTask().perform({ + userId: user.id, + documentId: document.id, + }); + + expect(await Notification.findByPk(notification.id)).toBeNull(); + }); +}); diff --git a/server/queues/tasks/RevokeUserNotificationsTask.ts b/server/queues/tasks/RevokeUserNotificationsTask.ts new file mode 100644 index 0000000000..a56d8e1b94 --- /dev/null +++ b/server/queues/tasks/RevokeUserNotificationsTask.ts @@ -0,0 +1,194 @@ +import { Op } from "sequelize"; +import { compact, uniq } from "es-toolkit/compat"; +import Logger from "@server/logging/Logger"; +import { + Collection, + Document, + Event, + Notification, + User, +} from "@server/models"; +import { can } from "@server/policies"; +import { BaseTask, TaskPriority } from "./base/BaseTask"; + +export type RevokeScope = { + /** When provided, only notifications for this document, and its nested documents, are considered. */ + documentId?: string; + /** When provided, only notifications for this collection, and the documents within it, are considered. */ + collectionId?: string; +}; + +type Props = RevokeScope & { + /** The user whose notifications should be re-checked. */ + userId: string; +}; + +/** + * Destroys the notifications of a user that reference a document or collection they can no longer + * read, so that the record – which embeds the document title and text – does not outlive access. + */ +export default class RevokeUserNotificationsTask extends BaseTask { + public async perform({ userId, documentId, collectionId }: Props) { + const user = await User.findByPk(userId); + + if (!user) { + return; + } + + const notifications = await this.findInScope(userId, { + documentId, + collectionId, + }); + + const candidateIds = uniq( + compact(notifications.map((notification) => notification.documentId)) + ); + + // Documents that are no longer visible to the user are not returned by this query at all, in + // which case the notification is left alone – only a document that exists and is unreadable is + // grounds for revoking. Naming a scope replaces the default scope, so drafts are included. + const documents = candidateIds.length + ? await Document.scope({ + method: ["withMembership", user.id], + }).findAll({ + // The minimum needed to evaluate the read policy, alongside the memberships and + // collection loaded by the scope. + attributes: [ + "id", + "teamId", + "collectionId", + "createdById", + "publishedAt", + ], + where: { id: candidateIds }, + }) + : []; + + const unreadableDocumentIds = new Set( + documents + .filter((document) => !can(user, "read", document)) + .map((document) => document.id) + ); + + const revokeIds = notifications + .filter( + (notification) => + notification.documentId && + unreadableDocumentIds.has(notification.documentId) + ) + .map((notification) => notification.id); + + // Notifications about a collection itself carry no document, so are checked separately. + const collectionIds = uniq( + compact( + notifications + .filter((notification) => !notification.documentId) + .map((notification) => notification.collectionId) + ) + ); + + for (const id of collectionIds) { + const collection = await Collection.findByPk(id, { userId: user.id }); + if (collection && !can(user, "read", collection)) { + revokeIds.push( + ...notifications + .filter( + (notification) => + !notification.documentId && notification.collectionId === id + ) + .map((notification) => notification.id) + ); + } + } + + if (!revokeIds.length) { + return; + } + + Logger.debug( + "task", + `Revoking ${revokeIds.length} notifications for user ${user.id}` + ); + + await Notification.destroy({ where: { id: revokeIds } }); + + // Notify the client so the notification does not linger in the UI until the next reload. + await Promise.all( + revokeIds.map((id) => + Event.schedule({ + name: "notifications.delete", + modelId: id, + userId: user.id, + teamId: user.teamId, + }) + ) + ); + } + + public get options() { + return { + ...super.options, + priority: TaskPriority.Background, + }; + } + + /** + * Loads the user's notifications that fall within the given scope, joining through the document + * association so that the collection filter is applied in the database rather than in memory. + */ + private async findInScope(userId: string, scope: RevokeScope) { + const attributes = ["id", "documentId", "collectionId"]; + + if (scope.documentId) { + return Notification.unscoped().findAll({ + attributes, + where: { + userId, + documentId: await this.documentAndChildIds(scope.documentId), + }, + }); + } + + if (scope.collectionId) { + return Notification.unscoped().findAll({ + attributes, + where: { + userId, + [Op.or]: [ + { collectionId: scope.collectionId }, + { "$document.collectionId$": scope.collectionId }, + ], + }, + include: [ + { + model: Document.unscoped(), + as: "document", + attributes: [], + required: false, + paranoid: false, + }, + ], + }); + } + + return Notification.unscoped().findAll({ + attributes, + where: { userId }, + }); + } + + /** + * Returns the given document id along with the ids of all documents nested beneath it, as + * memberships – and therefore access – cascade to nested documents. + */ + private async documentAndChildIds(documentId: string) { + const document = Document.build({ id: documentId }); + + return [ + documentId, + ...(await document.findAllChildDocumentIds(undefined, { + paranoid: false, + })), + ]; + } +} diff --git a/server/types.ts b/server/types.ts index 119613ecbb..49037c1435 100644 --- a/server/types.ts +++ b/server/types.ts @@ -456,7 +456,10 @@ export type WebhookSubscriptionEvent = BaseEvent & { }; export type NotificationEvent = BaseEvent & { - name: "notifications.create" | "notifications.update"; + name: + | "notifications.create" + | "notifications.update" + | "notifications.delete"; modelId: string; teamId: string; userId: string; From 5956f2071398f312174bb28822d08e78096218d7 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Sun, 23 Aug 2026 21:20:52 -0400 Subject: [PATCH 004/181] fix: Return 404 for unhandled paths under the MCP endpoint (#13541) Unknown paths below /mcp, and the origin-level /sse probe, fell through to the catch-all and rendered the application shell with a 200. Remote MCP clients that probe for the legacy HTTP+SSE transport before falling back to streamable HTTP read that as a successful handshake, then fail to connect. --- server/routes/index.test.ts | 7 +++++++ server/routes/index.ts | 6 ++++++ server/routes/mcp/index.test.ts | 20 ++++++++++++++++++++ server/routes/mcp/index.ts | 7 +++++++ 4 files changed, 40 insertions(+) diff --git a/server/routes/index.test.ts b/server/routes/index.test.ts index 904d47e0fb..6e02ba44bf 100644 --- a/server/routes/index.test.ts +++ b/server/routes/index.test.ts @@ -341,6 +341,13 @@ describe("scanner path 404s", () => { expect(res.status).toEqual(200); }); + it("returns 404 for the legacy SSE transport probe", async () => { + const res = await server.get("/sse"); + const body = await res.text(); + expect(res.status).toEqual(404); + expect(body).not.toContain(""); + }); + it("still serves the OAuth well-known endpoint", async () => { const res = await server.get("/.well-known/oauth-authorization-server"); expect(res.status).toEqual(200); diff --git a/server/routes/index.ts b/server/routes/index.ts index 6151679a25..2785f12107 100644 --- a/server/routes/index.ts +++ b/server/routes/index.ts @@ -174,6 +174,12 @@ router.get( } ); +// MCP clients sometimes probe the origin for a legacy HTTP+SSE endpoint. The +// application shell is not a valid response to that probe, so answer with a 404. +router.get("/sse", (ctx) => { + ctx.status = 404; +}); + router.get("/robots.txt", (ctx) => { ctx.body = robotsResponse(); }); diff --git a/server/routes/mcp/index.test.ts b/server/routes/mcp/index.test.ts index 048c8f3d39..af3352b09a 100644 --- a/server/routes/mcp/index.test.ts +++ b/server/routes/mcp/index.test.ts @@ -81,6 +81,26 @@ describe("POST /mcp/", () => { expect(res.status).toEqual(405); }); + it.each(["/mcp/sse", "/mcp/message", "/mcp/manifest.json"])( + "should return 404 for %s without rendering the app shell", + async (path) => { + const res = await server.get(path); + const body = await res.text(); + expect(res.status).toEqual(404); + expect(body).not.toContain("<title>"); + } + ); + + it("should return 404 for POST to a path below the endpoint", async () => { + const { accessToken } = await buildOAuthUser(); + const { body } = mcpRequest("tools/list"); + const res = await server.post("/mcp/sse", { + headers: mcpHeaders(accessToken), + body, + }); + expect(res.status).toEqual(404); + }); + it("should handle initialize and return capabilities", async () => { const { accessToken } = await buildOAuthUser(); const { body } = mcpRequest("initialize", { diff --git a/server/routes/mcp/index.ts b/server/routes/mcp/index.ts index 0fe219bb96..55d248ec64 100644 --- a/server/routes/mcp/index.ts +++ b/server/routes/mcp/index.ts @@ -222,6 +222,13 @@ router.delete("/", async (ctx) => { ctx.body = { error: "Method not allowed. Use POST for MCP requests." }; }); +// Clients probing for a transport we do not implement, such as the legacy +// HTTP+SSE endpoints, must not fall through to the application shell +router.all("*", async (ctx) => { + ctx.status = 404; + ctx.body = { error: "Not found. MCP requests must be sent to /mcp." }; +}); + app.use(requestTracer()); app.use(bodyParser()); app.use(router.routes()); From 83dfea19538849029b9ce6c8875c8e37427b0243 Mon Sep 17 00:00:00 2001 From: Tom Moor <tom@getoutline.com> Date: Mon, 24 Aug 2026 16:59:36 -0400 Subject: [PATCH 005/181] fix: Round reading time up to the next minute (#13548) Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> --- app/hooks/useTextStats.test.ts | 5 +++++ app/hooks/useTextStats.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/hooks/useTextStats.test.ts b/app/hooks/useTextStats.test.ts index 63ea82146c..eeb56e1f67 100644 --- a/app/hooks/useTextStats.test.ts +++ b/app/hooks/useTextStats.test.ts @@ -27,4 +27,9 @@ describe("getTextStats", () => { it("rounds reading time up to a minute for short text", () => { expect(getTextStats("Hello world").readingTime).toBe(1); }); + + it("rounds reading time up to the next minute for long text", () => { + expect(getTextStats("word ".repeat(500)).readingTime).toBe(3); + expect(getTextStats("word ".repeat(400)).readingTime).toBe(2); + }); }); diff --git a/app/hooks/useTextStats.ts b/app/hooks/useTextStats.ts index 34d9ecdc23..4897d35b41 100644 --- a/app/hooks/useTextStats.ts +++ b/app/hooks/useTextStats.ts @@ -13,7 +13,7 @@ export function getTextStats(text: string) { words, characters: text.length, paragraphs: countParagraphs(text), - readingTime: words ? Math.max(1, Math.floor(words / 200)) : 0, + readingTime: Math.ceil(words / 200), }; } From 237c3c2e2d93eba30aee4576b939468cb386c8f5 Mon Sep 17 00:00:00 2001 From: Tom Moor <tom@getoutline.com> Date: Mon, 24 Aug 2026 16:59:50 -0400 Subject: [PATCH 006/181] fix: Ignore small movements on useSwipe hook (#13549) --- app/hooks/useSwipe.tsx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/hooks/useSwipe.tsx b/app/hooks/useSwipe.tsx index c95d5d6af9..5c2b5b089a 100644 --- a/app/hooks/useSwipe.tsx +++ b/app/hooks/useSwipe.tsx @@ -1,6 +1,9 @@ import { isNumber } from "es-toolkit/compat"; import { useRef } from "react"; +/** Minimum distance in pixels that a touch must travel to count as a swipe. */ +const MinSwipeDistance = 40; + type Props = { onSwipeRight: () => void; onSwipeLeft: () => void; @@ -47,6 +50,12 @@ export default function useSwipe({ const dx = touchXEnd.current - touchXStart.current; const dy = touchYEnd.current - touchYStart.current; + // Ignore small movements so that a tap, or the start of a gesture, is not + // mistaken for a swipe. + if (Math.max(Math.abs(dx), Math.abs(dy)) < MinSwipeDistance) { + return; + } + const swipeRight = dx > 0 && Math.abs(dy) < Math.abs(dx); if (swipeRight) { resetTouchPoints(); From 5118b67b98233943cec50032139182fcd92deccf Mon Sep 17 00:00:00 2001 From: Tom Moor <tom@getoutline.com> Date: Mon, 24 Aug 2026 16:59:54 -0400 Subject: [PATCH 007/181] fix: Properly bind and unbind listeners in useHover (#13550) --- app/hooks/useHover.ts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/app/hooks/useHover.ts b/app/hooks/useHover.ts index eb52d30781..843d0a1510 100644 --- a/app/hooks/useHover.ts +++ b/app/hooks/useHover.ts @@ -38,10 +38,18 @@ const useHover = ({ ref, duration }: Props): boolean => { }); React.useEffect(() => { - if (ref.current) { - ref.current.onmouseenter = onMouseEnter; - ref.current.onmouseleave = onMouseLeave; + const element = ref.current; + if (!element) { + return; } + + element.addEventListener("mouseenter", onMouseEnter); + element.addEventListener("mouseleave", onMouseLeave); + + return () => { + element.removeEventListener("mouseenter", onMouseEnter); + element.removeEventListener("mouseleave", onMouseLeave); + }; }, [ref, onMouseEnter, onMouseLeave]); return hovered; From c807ae825bff81e55d50e5f6cf84b60885332341 Mon Sep 17 00:00:00 2001 From: Tom Moor <tom@getoutline.com> Date: Mon, 24 Aug 2026 16:59:59 -0400 Subject: [PATCH 008/181] fix: Hash and location state lost by useConsumeQueryParam (#13551) --- app/hooks/useConsumeQueryParam.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app/hooks/useConsumeQueryParam.ts b/app/hooks/useConsumeQueryParam.ts index 21397dffda..2564df9748 100644 --- a/app/hooks/useConsumeQueryParam.ts +++ b/app/hooks/useConsumeQueryParam.ts @@ -1,5 +1,6 @@ import { useEffect, useRef } from "react"; import { useHistory } from "react-router-dom"; +import { patchLocation } from "~/utils/history"; import useQuery from "./useQuery"; /** @@ -20,13 +21,13 @@ export default function useConsumeQueryParam(name: string): string | null { if (value && !consumedRef.current) { consumedRef.current = true; - const params = new URLSearchParams(window.location.search); + const location = history.location; + const params = new URLSearchParams(location.search); params.delete(name); const search = params.toString(); - history.replace({ - pathname: window.location.pathname, - search: search ? `?${search}` : "", - }); + history.replace( + patchLocation(location, { search: search ? `?${search}` : "" }) + ); } }, [value, name, history]); From 09b043c6561dbf5c59641581e8af292ec5bd815f Mon Sep 17 00:00:00 2001 From: Tom Moor <tom@getoutline.com> Date: Mon, 24 Aug 2026 17:09:25 -0400 Subject: [PATCH 009/181] chore: Upgrade mermaid to 11.17.1 (#13553) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: Upgrade mermaid to 11.17.1 Also bumps @mermaid-js/layout-elk to 0.2.3, which is the matching release, and dedupes katex — mermaid now requires ^0.16.47 where the project pinned ^0.16.45, which would otherwise ship two copies. Note that classDiagram now uses the unified (v2) renderer by default. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * fix: Hold @mermaid-js/layout-elk at 0.2.2 0.2.3 inlines its own copy of mermaid instead of importing the peer, which duplicates every diagram chunk and adds 3.4MB to the built bundle. Pinned exactly so the range cannot drift back onto it. --- package.json | 4 +-- yarn.lock | 71 ++++++++++++++++++++++++++++++++-------------------- 2 files changed, 46 insertions(+), 29 deletions(-) diff --git a/package.json b/package.json index 1fe812d755..4fada4b313 100644 --- a/package.json +++ b/package.json @@ -82,7 +82,7 @@ "@hocuspocus/server": "1.1.3", "@juggle/resize-observer": "^3.4.0", "@linear/sdk": "^58.1.0", - "@mermaid-js/layout-elk": "^0.2.2", + "@mermaid-js/layout-elk": "0.2.2", "@modelcontextprotocol/sdk": "^1.25.3", "@node-oauth/oauth2-server": "^5.3.0", "@notionhq/client": "^2.3.0", @@ -177,7 +177,7 @@ "markdown-it": "^14.3.0", "markdown-it-container": "^3.0.0", "markdown-it-emoji": "^3.0.0", - "mermaid": "11.16.1", + "mermaid": "11.17.1", "mime-types": "^3.0.2", "mobx": "^4.15.7", "mobx-react": "^6.3.1", diff --git a/yarn.lock b/yarn.lock index f834e7e99f..5291ce2b60 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2875,7 +2875,7 @@ __metadata: languageName: node linkType: hard -"@mermaid-js/layout-elk@npm:^0.2.2": +"@mermaid-js/layout-elk@npm:0.2.2": version: 0.2.2 resolution: "@mermaid-js/layout-elk@npm:0.2.2" dependencies: @@ -2887,12 +2887,12 @@ __metadata: languageName: node linkType: hard -"@mermaid-js/parser@npm:^1.2.0": - version: 1.2.0 - resolution: "@mermaid-js/parser@npm:1.2.0" +"@mermaid-js/parser@npm:^1.2.1": + version: 1.2.1 + resolution: "@mermaid-js/parser@npm:1.2.1" dependencies: "@chevrotain/types": "npm:~11.1.2" - checksum: 10c0/907d41167b23160c88f292b0dd79162d2543445ecf1d784ed09747467705666669f818e3ab91e1182da2127720fb40cb707e6fd56e8a445020fd3e7b8b16f013 + checksum: 10c0/a28e72f874670accb15e057b1802ac917f5d80d3e9b4be9a5094833ee0239d1290ff31c2d50236e909cbd42bea4550c7872d2bfcec0bc0588df6e34ba5dc0498 languageName: node linkType: hard @@ -9600,10 +9600,10 @@ __metadata: languageName: node linkType: hard -"cytoscape@npm:^3.33.3": - version: 3.34.0 - resolution: "cytoscape@npm:3.34.0" - checksum: 10c0/cb17b3dcacb9492f058cff653debf7b5a713e7532a9866cc72ae79d207757e8a9b68430874fe986f2a6404a8161b4fb5c1a2f1ca9ac5b1a21e316f57ed9d1243 +"cytoscape@npm:^3.34.0": + version: 3.34.1 + resolution: "cytoscape@npm:3.34.1" + checksum: 10c0/1fefc274d8fbbb59273606d71e7875bfe6d7b7f3cafbd5af0083b1b19a431af93440c7273c0896ce5002ccdd54e28cfa4b0d54638017c69ebba0c1860a1c282b languageName: node linkType: hard @@ -10030,10 +10030,10 @@ __metadata: languageName: node linkType: hard -"dayjs@npm:^1.11.20": - version: 1.11.21 - resolution: "dayjs@npm:1.11.21" - checksum: 10c0/bd97dfdc4bfea3c66268635690313828b386faa040fbc1f829ff42a2bd748b72c9d9b3c8f9616ce9e61fcb78923f1461a462c969c54b1084458ae1b715898fb0 +"dayjs@npm:^1.11.21": + version: 1.11.23 + resolution: "dayjs@npm:1.11.23" + checksum: 10c0/69ab04bf19c676e44ab50cc2fca223d265f3dafd107151ef3b0f3ad74d360c37caa602abe62f87cb25d90bd9f6bee003698af47df5b0dbf10a998b7b5f3bb3f1 languageName: node linkType: hard @@ -11317,6 +11317,15 @@ __metadata: languageName: node linkType: hard +"fastdom@npm:1.0.12": + version: 1.0.12 + resolution: "fastdom@npm:1.0.12" + dependencies: + strictdom: "npm:^1.0.1" + checksum: 10c0/d1727eb5d803aa0e1dc9a98b2eef1f138bad3776fa7471145216dba34f435f86e8e514658d0b1717fa83a987f44a8d26f2353a515f2bf782f32d3c9ead6d1994 + languageName: node + linkType: hard + "fastq@npm:^1.13.0": version: 1.19.1 resolution: "fastq@npm:1.19.1" @@ -13669,14 +13678,14 @@ __metadata: languageName: node linkType: hard -"katex@npm:^0.16.45": - version: 0.16.45 - resolution: "katex@npm:0.16.45" +"katex@npm:^0.16.45, katex@npm:^0.16.47": + version: 0.16.47 + resolution: "katex@npm:0.16.47" dependencies: commander: "npm:^8.3.0" bin: katex: cli.js - checksum: 10c0/f715eb9a73daff68ac14dcc8c2f47f02f5fc756a74077d22479e64e06872b2b44f0d81f1c91a98a9873722a08841388a869a0b9ddb96b224362eb8054ddf533a + checksum: 10c0/b10f4d0651c60771a48444879e4227255e26e2b2ec061b1ee4b08934863ad2324ba8dbb772455f7768aeb14dfcc13bcd309174a0ddd5ef954a607f644a197710 languageName: node linkType: hard @@ -14622,32 +14631,33 @@ __metadata: languageName: node linkType: hard -"mermaid@npm:11.16.1": - version: 11.16.1 - resolution: "mermaid@npm:11.16.1" +"mermaid@npm:11.17.1": + version: 11.17.1 + resolution: "mermaid@npm:11.17.1" dependencies: "@braintree/sanitize-url": "npm:^7.1.2" "@iconify/utils": "npm:^3.0.2" - "@mermaid-js/parser": "npm:^1.2.0" + "@mermaid-js/parser": "npm:^1.2.1" "@types/d3": "npm:^7.4.3" "@upsetjs/venn.js": "npm:^2.0.0" - cytoscape: "npm:^3.33.3" + cytoscape: "npm:^3.34.0" cytoscape-cose-bilkent: "npm:^4.1.0" cytoscape-fcose: "npm:^2.2.0" d3: "npm:^7.9.0" d3-sankey: "npm:^0.12.3" dagre-d3-es: "npm:7.0.14" - dayjs: "npm:^1.11.20" + dayjs: "npm:^1.11.21" dompurify: "npm:^3.3.3" es-toolkit: "npm:^1.45.1" - katex: "npm:^0.16.45" + fastdom: "npm:1.0.12" + katex: "npm:^0.16.47" khroma: "npm:^2.1.0" marked: "npm:^16.3.0" roughjs: "npm:^4.6.6" stylis: "npm:^4.3.6" ts-dedent: "npm:^2.2.0" uuid: "npm:^11.1.0 || ^12 || ^13 || ^14.0.0" - checksum: 10c0/a905627d5ad372914bf7c67cb9e491d50f248d3a8458e4ec920033f5ce7387bf419423909ed71d88f54a035ec42987746d64a46055bd2b2a4dc1bc4ceed38c44 + checksum: 10c0/7e09c9981f31ee74a76dc6fde5bd50b2f2b417345342753aad834d119190daf3e3ea648f9fec6f404c1e56e384cf90dc05fc55792a46fe8f3350acef57befd8a languageName: node linkType: hard @@ -15587,7 +15597,7 @@ __metadata: "@hocuspocus/server": "npm:1.1.3" "@juggle/resize-observer": "npm:^3.4.0" "@linear/sdk": "npm:^58.1.0" - "@mermaid-js/layout-elk": "npm:^0.2.2" + "@mermaid-js/layout-elk": "npm:0.2.2" "@modelcontextprotocol/sdk": "npm:^1.25.3" "@node-oauth/oauth2-server": "npm:^5.3.0" "@notionhq/client": "npm:^2.3.0" @@ -15757,7 +15767,7 @@ __metadata: markdown-it: "npm:^14.3.0" markdown-it-container: "npm:^3.0.0" markdown-it-emoji: "npm:^3.0.0" - mermaid: "npm:11.16.1" + mermaid: "npm:11.17.1" mime-types: "npm:^3.0.2" mobx: "npm:^4.15.7" mobx-react: "npm:^6.3.1" @@ -19225,6 +19235,13 @@ __metadata: languageName: node linkType: hard +"strictdom@npm:^1.0.1": + version: 1.0.1 + resolution: "strictdom@npm:1.0.1" + checksum: 10c0/3006ffccaa89ecc0ce2679d2726b7ea4901faa91152bf0211d11685de1c710f09a178c9dbc5ab1496e6101b686192595ff2aa78f128a814fd838793e4f29edc5 + languageName: node + linkType: hard + "string-argv@npm:^0.3.2, string-argv@npm:~0.3.1": version: 0.3.2 resolution: "string-argv@npm:0.3.2" From e141280d41b5c2f9b8e1b5f382c7aef5c430ad67 Mon Sep 17 00:00:00 2001 From: Tom Moor <tom@getoutline.com> Date: Mon, 24 Aug 2026 17:11:13 -0400 Subject: [PATCH 010/181] fix: Stop reporting expected IndexedDB connection closures (#13552) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The browser closes IndexedDB connections at times the page does not control – a frozen or discarded tab, a navigation away, or another tab deleting the database at logout. Persisted store data is a cache that API traffic always overrides, so these failures have no effect for the user, but each one was reported to Sentry as a warning. - Log connection closed failures at debug level instead of reporting them - Delete the database in clear() rather than emptying it through a transaction, which cannot fail against a closed connection - Keep persistence enabled when hydration fails on a closed connection, rather than disabling it for the rest of the session Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> --- app/stores/base/StorePersistence.test.ts | 21 +++++++++ app/stores/base/StorePersistence.ts | 54 +++++++++++++++++------- 2 files changed, 59 insertions(+), 16 deletions(-) diff --git a/app/stores/base/StorePersistence.test.ts b/app/stores/base/StorePersistence.test.ts index df95a9fe3e..4201972214 100644 --- a/app/stores/base/StorePersistence.test.ts +++ b/app/stores/base/StorePersistence.test.ts @@ -243,6 +243,27 @@ describe("StorePersistence", () => { expect(target.policies.orderedData).toHaveLength(0); }); + + it("clear leaves no database behind for a closed connection to fail against", async () => { + const teamId = "team-11"; + const source = new RootStore(); + const persistence = new StorePersistence(source.policies, teamId); + const databaseName = StorePersistence.databaseName( + source.policies.apiEndpoint, + teamId + ); + + source.policies.add({ id: "doc-1", abilities: { read: true } }); + persistence.persist("doc-1"); + await persistence.flush(); + + await persistence.clear(); + + const databases = await indexedDB.databases(); + expect(databases.map((database) => database.name)).not.toContain( + databaseName + ); + }); }); /** Writes raw records into a database, bypassing the store. */ diff --git a/app/stores/base/StorePersistence.ts b/app/stores/base/StorePersistence.ts index bc66c9b5bf..f51016509c 100644 --- a/app/stores/base/StorePersistence.ts +++ b/app/stores/base/StorePersistence.ts @@ -62,11 +62,11 @@ export default class StorePersistence<T extends Model> { this.store.add(this.store.model.fromPersisted<T>(record)); } } catch (err) { - this.disabled = true; - Logger.warn("Failed to hydrate store from IndexedDB", { - database: this.name, - error: err, - }); + // A closed connection is transient, a later write reopens the database. + if (!isConnectionClosedError(err)) { + this.disabled = true; + } + this.report("Failed to hydrate store from IndexedDB", err); } finally { this.hydrating = false; } @@ -115,10 +115,7 @@ export default class StorePersistence<T extends Model> { return promisifyTransaction(objectStore.transaction); }); } catch (err) { - Logger.warn("Failed to write store to IndexedDB", { - database: this.name, - error: err, - }); + this.report("Failed to write store to IndexedDB", err); } }; @@ -129,21 +126,27 @@ export default class StorePersistence<T extends Model> { */ public clear = async (): Promise<void> => { this.dirty.clear(); + this.scheduleFlush.cancel(); if (this.disabled) { return; } + // The database is deleted rather than emptied through a transaction, as a + // deletion cannot fail against a connection the browser has closed. + this.close(); + try { - await this.transaction("readwrite", (objectStore) => { - objectStore.clear(); - return promisifyTransaction(objectStore.transaction); + await new Promise<void>((resolve, reject) => { + const request = window.indexedDB.deleteDatabase(this.name); + request.onsuccess = () => resolve(); + request.onerror = () => reject(request.error); + // Another tab holds a connection, which it closes in response to the + // versionchange event, and the deletion completes without us. + request.onblocked = () => resolve(); }); } catch (err) { - Logger.warn("Failed to clear persisted store in IndexedDB", { - database: this.name, - error: err, - }); + this.report("Failed to clear persisted store in IndexedDB", err); } }; @@ -258,6 +261,25 @@ export default class StorePersistence<T extends Model> { this.database = undefined; }; + /** + * Logs an operation that failed against the database. The browser closes + * connections at times the page does not control, such as when the tab is + * frozen or discarded, so those failures are expected and are not reported. + * + * @param message a description of the operation that failed. + * @param err the error that was thrown. + */ + private report = (message: string, err: unknown) => { + const extra = { database: this.name, error: err }; + + if (isConnectionClosedError(err)) { + Logger.debug("store", message, extra); + return; + } + + Logger.warn(message, extra); + }; + private scheduleFlush = debounce(() => void this.flush(), FLUSH_DELAY_MS); private store: Store<T>; From 0132f0dcb8d12e3f9f5692a1ecafe33a457671c9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 24 Aug 2026 17:23:20 -0400 Subject: [PATCH 011/181] chore(deps): bump @octokit/auth-app from 8.2.0 to 8.3.0 (#13547) Bumps [@octokit/auth-app](https://github.com/octokit/auth-app.js) from 8.2.0 to 8.3.0. - [Release notes](https://github.com/octokit/auth-app.js/releases) - [Commits](https://github.com/octokit/auth-app.js/compare/v8.2.0...v8.3.0) --- updated-dependencies: - dependency-name: "@octokit/auth-app" dependency-version: 8.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 | 123 ++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 122 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 4fada4b313..ceba5ece18 100644 --- a/package.json +++ b/package.json @@ -86,7 +86,7 @@ "@modelcontextprotocol/sdk": "^1.25.3", "@node-oauth/oauth2-server": "^5.3.0", "@notionhq/client": "^2.3.0", - "@octokit/auth-app": "^8.2.0", + "@octokit/auth-app": "^8.3.0", "@octokit/webhooks-types": "^7.6.1", "@outlinewiki/koa-passport": "^4.2.1", "@outlinewiki/passport-azure-ad-oauth2": "^0.1.0", diff --git a/yarn.lock b/yarn.lock index 5291ce2b60..e488085f65 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3313,7 +3313,7 @@ __metadata: languageName: node linkType: hard -"@octokit/auth-app@npm:^8.1.2, @octokit/auth-app@npm:^8.2.0": +"@octokit/auth-app@npm:^8.1.2": version: 8.2.0 resolution: "@octokit/auth-app@npm:8.2.0" dependencies: @@ -3329,6 +3329,22 @@ __metadata: languageName: node linkType: hard +"@octokit/auth-app@npm:^8.3.0": + version: 8.3.0 + resolution: "@octokit/auth-app@npm:8.3.0" + dependencies: + "@octokit/auth-oauth-app": "npm:^9.0.4" + "@octokit/auth-oauth-user": "npm:^6.0.3" + "@octokit/request": "npm:^10.0.13" + "@octokit/request-error": "npm:^7.1.1" + "@octokit/types": "npm:^17.0.0" + toad-cache: "npm:^3.7.0" + universal-github-app-jwt: "npm:^2.2.0" + universal-user-agent: "npm:^7.0.0" + checksum: 10c0/cc74d6d54abb9e0f65b80d67c437dc4617379ed3a875904edb41b63f298627ac0cf8f6b66b07773d4a48bdec24c8f39674281a11b362e73b82c41728e9a7a519 + languageName: node + linkType: hard + "@octokit/auth-oauth-app@npm:^9.0.2, @octokit/auth-oauth-app@npm:^9.0.3": version: 9.0.3 resolution: "@octokit/auth-oauth-app@npm:9.0.3" @@ -3342,6 +3358,19 @@ __metadata: languageName: node linkType: hard +"@octokit/auth-oauth-app@npm:^9.0.4": + version: 9.0.4 + resolution: "@octokit/auth-oauth-app@npm:9.0.4" + dependencies: + "@octokit/auth-oauth-device": "npm:^8.0.4" + "@octokit/auth-oauth-user": "npm:^6.0.3" + "@octokit/request": "npm:^10.0.13" + "@octokit/types": "npm:^17.0.0" + universal-user-agent: "npm:^7.0.0" + checksum: 10c0/752993bc65170fa71038d3f3e0dfedf9a8e05b491316335461692b770cf1b2362057d7d2686ff3b278064fdd2b0dc4b2b0151f095ffd1aa329c19223ee12356e + languageName: node + linkType: hard + "@octokit/auth-oauth-device@npm:^8.0.3": version: 8.0.3 resolution: "@octokit/auth-oauth-device@npm:8.0.3" @@ -3354,6 +3383,18 @@ __metadata: languageName: node linkType: hard +"@octokit/auth-oauth-device@npm:^8.0.4": + version: 8.0.4 + resolution: "@octokit/auth-oauth-device@npm:8.0.4" + dependencies: + "@octokit/oauth-methods": "npm:^6.0.3" + "@octokit/request": "npm:^10.0.13" + "@octokit/types": "npm:^17.0.0" + universal-user-agent: "npm:^7.0.0" + checksum: 10c0/881641864e07f1d7f93e383c94f8315ddc63ec7b8090fea590db67f217dcc8503abfa879caa2101ceea057b84138fdec7d531ad3bfd61fc08cbc84d26ec75b8d + languageName: node + linkType: hard + "@octokit/auth-oauth-user@npm:^6.0.1, @octokit/auth-oauth-user@npm:^6.0.2": version: 6.0.2 resolution: "@octokit/auth-oauth-user@npm:6.0.2" @@ -3367,6 +3408,19 @@ __metadata: languageName: node linkType: hard +"@octokit/auth-oauth-user@npm:^6.0.3": + version: 6.0.3 + resolution: "@octokit/auth-oauth-user@npm:6.0.3" + dependencies: + "@octokit/auth-oauth-device": "npm:^8.0.4" + "@octokit/oauth-methods": "npm:^6.0.3" + "@octokit/request": "npm:^10.0.13" + "@octokit/types": "npm:^17.0.0" + universal-user-agent: "npm:^7.0.0" + checksum: 10c0/1a97479716b4b83af36ffc866f50f800b8a332d0c89e46510d79088272474e60f954a2a4300ee387d72e6e13e7f7a9b816b960d9dc3400149d13adddcb48c82e + languageName: node + linkType: hard + "@octokit/auth-token@npm:^6.0.0": version: 6.0.0 resolution: "@octokit/auth-token@npm:6.0.0" @@ -3455,6 +3509,18 @@ __metadata: languageName: node linkType: hard +"@octokit/oauth-methods@npm:^6.0.3": + version: 6.0.4 + resolution: "@octokit/oauth-methods@npm:6.0.4" + dependencies: + "@octokit/oauth-authorization-url": "npm:^8.0.0" + "@octokit/request": "npm:^10.0.13" + "@octokit/request-error": "npm:^7.1.1" + "@octokit/types": "npm:^17.0.0" + checksum: 10c0/ae4359120dcca8faf59598f5eb0cecad0947d076fa69352677588570a80a8e5c35f080513add57692a324318ad7f0747496e83b1b76742542bd8e7331f744d03 + languageName: node + linkType: hard + "@octokit/openapi-types@npm:^27.0.0": version: 27.0.0 resolution: "@octokit/openapi-types@npm:27.0.0" @@ -3462,6 +3528,13 @@ __metadata: languageName: node linkType: hard +"@octokit/openapi-types@npm:^28.0.0": + version: 28.0.0 + resolution: "@octokit/openapi-types@npm:28.0.0" + checksum: 10c0/1cb8d105a4771df98ab3f34809b48ae6fafa516e66b9e6d9e0c5bc5f4fbb98dd209ad25c6e941745841b7bb20a35b799d155ec198028548fab1c4fd4e4f8cf9f + languageName: node + linkType: hard + "@octokit/openapi-webhooks-types@npm:12.1.0": version: 12.1.0 resolution: "@octokit/openapi-webhooks-types@npm:12.1.0" @@ -3534,6 +3607,29 @@ __metadata: languageName: node linkType: hard +"@octokit/request-error@npm:^7.1.1": + version: 7.1.1 + resolution: "@octokit/request-error@npm:7.1.1" + dependencies: + "@octokit/types": "npm:^17.0.0" + checksum: 10c0/b851dfd17d95394258a279225ff7e23345d59aca78064fb7dfd4f2a129db328880b4b7fb44c9d873e89dc40a0498e6efa56c3063899efa18bc97fa2f8e0825c1 + languageName: node + linkType: hard + +"@octokit/request@npm:^10.0.13": + version: 10.0.15 + resolution: "@octokit/request@npm:10.0.15" + dependencies: + "@octokit/endpoint": "npm:^11.0.3" + "@octokit/request-error": "npm:^7.1.1" + "@octokit/types": "npm:^17.0.0" + content-type: "npm:^3.0.0" + json-with-bigint: "npm:^3.5.12" + universal-user-agent: "npm:^7.0.2" + checksum: 10c0/daede4048e4362f5ebe6aec86d64c1d1f6b7ce7ed7950fbe7ca758cf378d5a07f4710c7da0df1af3b08437033b44d767eba68ef4f8e1bd1667fa0141785eaa7c + languageName: node + linkType: hard + "@octokit/request@npm:^10.0.6": version: 10.0.9 resolution: "@octokit/request@npm:10.0.9" @@ -3558,6 +3654,15 @@ __metadata: languageName: node linkType: hard +"@octokit/types@npm:^17.0.0": + version: 17.0.0 + resolution: "@octokit/types@npm:17.0.0" + dependencies: + "@octokit/openapi-types": "npm:^28.0.0" + checksum: 10c0/fb190b7ef48dcc974c4178a92b62c76a5c820c120607e1812f2c76adeeab5af4c13b645e37a5f54d66b0222b2a58399cb91fa2fd1d375270f77c7987a9cfd231 + languageName: node + linkType: hard + "@octokit/webhooks-methods@npm:^6.0.0": version: 6.0.0 resolution: "@octokit/webhooks-methods@npm:6.0.0" @@ -9345,6 +9450,13 @@ __metadata: languageName: node linkType: hard +"content-type@npm:^3.0.0": + version: 3.0.0 + resolution: "content-type@npm:3.0.0" + checksum: 10c0/4ecb17b151ef272fe3143d2414b78edeea9c7baa45724e2bbcbfc0dbd4bbc5b68d654733df6df2d9c600016af841a25aa26b0a4d290e366b5120705796072d98 + languageName: node + linkType: hard + "convert-hrtime@npm:^5.0.0": version: 5.0.0 resolution: "convert-hrtime@npm:5.0.0" @@ -13572,6 +13684,13 @@ __metadata: languageName: node linkType: hard +"json-with-bigint@npm:^3.5.12": + version: 3.5.12 + resolution: "json-with-bigint@npm:3.5.12" + checksum: 10c0/3c205a445ee946bbe2409fb3e1840617eb0bac9086934ed55fefbd584c8d5bfd288bdc9a44acc8e5ca4d1ccf83b5c2ebd63add5ef4b5ca656ef4f968bf832e79 + languageName: node + linkType: hard + "json-with-bigint@npm:^3.5.3": version: 3.5.8 resolution: "json-with-bigint@npm:3.5.8" @@ -15601,7 +15720,7 @@ __metadata: "@modelcontextprotocol/sdk": "npm:^1.25.3" "@node-oauth/oauth2-server": "npm:^5.3.0" "@notionhq/client": "npm:^2.3.0" - "@octokit/auth-app": "npm:^8.2.0" + "@octokit/auth-app": "npm:^8.3.0" "@octokit/webhooks-types": "npm:^7.6.1" "@outlinewiki/koa-passport": "npm:^4.2.1" "@outlinewiki/passport-azure-ad-oauth2": "npm:^0.1.0" From 2a5571adbc3a408feabda0e70b73b911eaf09f05 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 24 Aug 2026 17:23:30 -0400 Subject: [PATCH 012/181] chore(deps): bump dd-trace from 5.117.0 to 5.123.0 (#13546) Bumps [dd-trace](https://github.com/DataDog/dd-trace-js) from 5.117.0 to 5.123.0. - [Release notes](https://github.com/DataDog/dd-trace-js/releases) - [Commits](https://github.com/DataDog/dd-trace-js/compare/v5.117.0...v5.123.0) --- updated-dependencies: - dependency-name: dd-trace dependency-version: 5.123.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 | 88 +++++++++++++++++----------------------------------- 2 files changed, 30 insertions(+), 60 deletions(-) diff --git a/package.json b/package.json index ceba5ece18..6347615443 100644 --- a/package.json +++ b/package.json @@ -129,7 +129,7 @@ "core-js": "^3.49.0", "crypto-js": "^4.2.0", "date-fns": "^3.6.0", - "dd-trace": "^5.117.0", + "dd-trace": "^5.123.0", "diff": "^5.2.2", "email-providers": "^1.14.0", "emoji-mart": "^5.6.0", diff --git a/yarn.lock b/yarn.lock index e488085f65..2e61ad8392 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1680,19 +1680,10 @@ __metadata: languageName: node linkType: hard -"@datadog/flagging-core@npm:1.2.1": - version: 1.2.1 - resolution: "@datadog/flagging-core@npm:1.2.1" - dependencies: - spark-md5: "npm:^3.0.2" - checksum: 10c0/105dd13dcb8b241e5ed1a76c4d9b3a43bf4f6867af5893e3ae92bb98344907adca3a2b7c3d04511762012459b0803fb9e82feded5cf8eebfac7122de6a27eeff - languageName: node - linkType: hard - -"@datadog/libdatadog@npm:0.9.4": - version: 0.9.4 - resolution: "@datadog/libdatadog@npm:0.9.4" - checksum: 10c0/f1dbfb960f3249d4ae8f8f7f110ad1ea22ef3e71667dc6b7ea00f6f02651660f9deec593a534a2f35ac2b0c279baa7e86a45d42de75f31d11c3c8124ec6c3948 +"@datadog/libdatadog@npm:0.12.1": + version: 0.12.1 + resolution: "@datadog/libdatadog@npm:0.12.1" + checksum: 10c0/92bb0b0d011d78d3166ffbe07d3f531de355b3b65ee311143ad1bc91754ab0de04582152522da40e0fbb227b0f5386826d8b1fc82ca61552f2d951ae642ee66b languageName: node linkType: hard @@ -1727,38 +1718,27 @@ __metadata: languageName: node linkType: hard -"@datadog/openfeature-node-server@npm:2.0.0": - version: 2.0.0 - resolution: "@datadog/openfeature-node-server@npm:2.0.0" - dependencies: - "@datadog/flagging-core": "npm:1.2.1" - peerDependencies: - "@openfeature/server-sdk": ">=1.15.1" - checksum: 10c0/5126bcf3e8907f5dc5d0839c88f4a9998984ce296f0766d39ee0cbee6fc01de2814c857d76de776df6600a3d58175d522566019675437340615011995e80a050 - languageName: node - linkType: hard - -"@datadog/pprof@npm:5.17.0": - version: 5.17.0 - resolution: "@datadog/pprof@npm:5.17.0" +"@datadog/pprof@npm:5.18.1": + version: 5.18.1 + resolution: "@datadog/pprof@npm:5.18.1" dependencies: node-gyp: "npm:latest" node-gyp-build: "npm:^4.8.4" - pprof-format: "npm:^2.2.1" + pprof-format: "npm:^2.3.1" source-map: "npm:^0.8.0" - checksum: 10c0/e3e405dbf387c748ed3c5f976d7a3c487233d6c9866f4125b9a008e32d174c7657c7c81925a1a1239684b4eb3bebcd2694d53bbe99b04514c93de61856e0aa02 + checksum: 10c0/fdc0fcbe0465acbdfbd37d2084faef3e53d0579cd4fc5d1140081a8b9c23fa58b66e610e910e5bf5e73becf59ab0c7e8cfb5d37fe4a702237e31d194b2cad93a languageName: node linkType: hard -"@datadog/wasm-js-rewriter@npm:5.0.1": - version: 5.0.1 - resolution: "@datadog/wasm-js-rewriter@npm:5.0.1" +"@datadog/wasm-js-rewriter@npm:5.0.3": + version: 5.0.3 + resolution: "@datadog/wasm-js-rewriter@npm:5.0.3" dependencies: - js-yaml: "npm:^4.1.0" + js-yaml: "npm:^4.3.1" lru-cache: "npm:^7.14.0" - module-details-from-path: "npm:^1.0.3" - node-gyp-build: "npm:^4.5.0" - checksum: 10c0/e5f665f53b8d292efe85ac401f56923112860cfd14c5d84097ad22e1b86c8a30f3cd39cc92e1ec6e8f5f9de5fef028af46554752d8ae2d0f80b7c3a44827f0db + module-details-from-path: "npm:^1.0.4" + node-gyp-build: "npm:^4.8.4" + checksum: 10c0/59bcf6a0da066dfc7a8fa6c2642f97e534f5927de54edbd5e69c2d00a9563a0a452559874332d1a4c7931bd02dec92840f65e7c69924e5b7f78bd997a230f42d languageName: node linkType: hard @@ -10156,17 +10136,16 @@ __metadata: languageName: node linkType: hard -"dd-trace@npm:^5.117.0": - version: 5.117.0 - resolution: "dd-trace@npm:5.117.0" +"dd-trace@npm:^5.123.0": + version: 5.123.0 + resolution: "dd-trace@npm:5.123.0" dependencies: - "@datadog/libdatadog": "npm:0.9.4" + "@datadog/libdatadog": "npm:0.12.1" "@datadog/native-appsec": "npm:11.0.1" "@datadog/native-iast-taint-tracking": "npm:4.2.0" "@datadog/native-metrics": "npm:3.1.2" - "@datadog/openfeature-node-server": "npm:2.0.0" - "@datadog/pprof": "npm:5.17.0" - "@datadog/wasm-js-rewriter": "npm:5.0.1" + "@datadog/pprof": "npm:5.18.1" + "@datadog/wasm-js-rewriter": "npm:5.0.3" "@opentelemetry/api": "npm:>=1.0.0 <1.10.0" "@opentelemetry/api-logs": "npm:<1.0.0" dc-polyfill: "npm:^0.1.11" @@ -10182,8 +10161,6 @@ __metadata: optional: true "@datadog/native-metrics": optional: true - "@datadog/openfeature-node-server": - optional: true "@datadog/pprof": optional: true "@datadog/wasm-js-rewriter": @@ -10194,7 +10171,7 @@ __metadata: optional: true oxc-parser: optional: true - checksum: 10c0/14a4dff5897accf5953cfbc7244407ed0ffe25e7e65d0e62f8abfb09d99ce1b0c8f2e7c5c44266cd63e1fd9ef4e0a39fbb76fa73acdc16ea5ebf34d485a9b7ea + checksum: 10c0/cd8e13e6e3ed391b3d360ab84856c7d0dd3ee200bd653eb72923001ebfcb13fc8229f101fd0ad1714984ed992936b0650c8205e4ddffdb67d3046a6be3536216 languageName: node linkType: hard @@ -15323,7 +15300,7 @@ __metadata: languageName: node linkType: hard -"node-gyp-build@npm:^4.5.0, node-gyp-build@npm:^4.8.4": +"node-gyp-build@npm:^4.8.4": version: 4.8.4 resolution: "node-gyp-build@npm:4.8.4" bin: @@ -15832,7 +15809,7 @@ __metadata: core-js: "npm:^3.49.0" crypto-js: "npm:^4.2.0" date-fns: "npm:^3.6.0" - dd-trace: "npm:^5.117.0" + dd-trace: "npm:^5.123.0" diff: "npm:^5.2.2" discord-api-types: "npm:^0.38.48" email-providers: "npm:^1.14.0" @@ -16985,10 +16962,10 @@ __metadata: languageName: node linkType: hard -"pprof-format@npm:^2.2.1": - version: 2.2.1 - resolution: "pprof-format@npm:2.2.1" - checksum: 10c0/1c8051b3e3ebba1ac2b8d7cf0a84ce501fdabe5e72a803c7daa6ddf67cbee33e9b5d6dbc6ffbeb740e3e56600c875f372576304ed718a4ffa4c89c18185494ae +"pprof-format@npm:^2.3.1": + version: 2.3.1 + resolution: "pprof-format@npm:2.3.1" + checksum: 10c0/5372d63b5c3152c550a79edd132c1f99be766df5558b14a1a85904756bd9fd12f26e41e861c223742693724aaec5f9395983500ef1566577a32490e175110d99 languageName: node linkType: hard @@ -19184,13 +19161,6 @@ __metadata: languageName: node linkType: hard -"spark-md5@npm:^3.0.2": - version: 3.0.2 - resolution: "spark-md5@npm:3.0.2" - checksum: 10c0/3fd11735eac5e7d60d6006d99ac0a055f148a89e9baf5f0b51ac103022dec30556b44190b37f6737ca50f81e8e50dc13e724f9edf6290c412ff5ab2101ce7780 - languageName: node - linkType: hard - "spawn-command@npm:0.0.2": version: 0.0.2 resolution: "spawn-command@npm:0.0.2" From dd2c2249630455a91c0623c74567b985abf2c2ad Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 24 Aug 2026 17:23:41 -0400 Subject: [PATCH 013/181] chore(deps): bump react-hook-form from 7.76.0 to 7.85.0 (#13545) Bumps [react-hook-form](https://github.com/react-hook-form/react-hook-form) from 7.76.0 to 7.85.0. - [Release notes](https://github.com/react-hook-form/react-hook-form/releases) - [Changelog](https://github.com/react-hook-form/react-hook-form/blob/master/CHANGELOG.md) - [Commits](https://github.com/react-hook-form/react-hook-form/compare/v7.76.0...v7.85.0) --- updated-dependencies: - dependency-name: react-hook-form dependency-version: 7.85.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 | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 6347615443..c3fed8ca6e 100644 --- a/package.json +++ b/package.json @@ -226,7 +226,7 @@ "react-dom": "^17.0.2", "react-dropzone": "^11.7.1", "react-helmet-async": "^2.0.5", - "react-hook-form": "^7.76.0", + "react-hook-form": "^7.85.0", "react-i18next": "^12.3.1", "react-is": "^17.0.2", "react-merge-refs": "^2.1.1", diff --git a/yarn.lock b/yarn.lock index 2e61ad8392..f4638ec868 100644 --- a/yarn.lock +++ b/yarn.lock @@ -15918,7 +15918,7 @@ __metadata: react-dom: "npm:^17.0.2" react-dropzone: "npm:^11.7.1" react-helmet-async: "npm:^2.0.5" - react-hook-form: "npm:^7.76.0" + react-hook-form: "npm:^7.85.0" react-i18next: "npm:^12.3.1" react-is: "npm:^17.0.2" react-merge-refs: "npm:^2.1.1" @@ -17523,12 +17523,12 @@ __metadata: languageName: node linkType: hard -"react-hook-form@npm:^7.76.0": - version: 7.76.0 - resolution: "react-hook-form@npm:7.76.0" +"react-hook-form@npm:^7.85.0": + version: 7.85.0 + resolution: "react-hook-form@npm:7.85.0" peerDependencies: react: ^16.8.0 || ^17 || ^18 || ^19 - checksum: 10c0/b78ff45a5beca6a954d8ef513031c484f9f30f726c174957228866c9faf0528e24dd5523dac850a8dd6db46753ca3485aae0cd61772f9a131a1a77293bb6931c + checksum: 10c0/53e81f4116129efa8e08c620cd334f74541174a82f3e4ce7a8839193c69a561b9bed070b4a46f24654c4860c474ddbb504d2ad402297708c8c2b80f1f6116d59 languageName: node linkType: hard From c8f091b83e36a71b2f93be147fe9d89f67c8b1e8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 24 Aug 2026 17:24:25 -0400 Subject: [PATCH 014/181] chore(deps): bump prosemirror-dropcursor from 1.8.2 to 1.8.3 (#13544) Bumps [prosemirror-dropcursor](https://github.com/prosemirror/prosemirror-dropcursor) from 1.8.2 to 1.8.3. - [Changelog](https://github.com/ProseMirror/prosemirror-dropcursor/blob/master/CHANGELOG.md) - [Commits](https://github.com/prosemirror/prosemirror-dropcursor/commits) --- updated-dependencies: - dependency-name: prosemirror-dropcursor dependency-version: 1.8.3 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 | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index c3fed8ca6e..b2befad582 100644 --- a/package.json +++ b/package.json @@ -202,7 +202,7 @@ "prosemirror-changeset": "2.4.1", "prosemirror-codemark": "^0.4.2", "prosemirror-commands": "^1.7.1", - "prosemirror-dropcursor": "^1.8.2", + "prosemirror-dropcursor": "^1.8.3", "prosemirror-gapcursor": "^1.4.1", "prosemirror-history": "^1.5.0", "prosemirror-inputrules": "^1.5.1", diff --git a/yarn.lock b/yarn.lock index f4638ec868..8391bf6214 100644 --- a/yarn.lock +++ b/yarn.lock @@ -15894,7 +15894,7 @@ __metadata: prosemirror-changeset: "npm:2.4.1" prosemirror-codemark: "npm:^0.4.2" prosemirror-commands: "npm:^1.7.1" - prosemirror-dropcursor: "npm:^1.8.2" + prosemirror-dropcursor: "npm:^1.8.3" prosemirror-gapcursor: "npm:^1.4.1" prosemirror-history: "npm:^1.5.0" prosemirror-inputrules: "npm:^1.5.1" @@ -17100,14 +17100,14 @@ __metadata: languageName: node linkType: hard -"prosemirror-dropcursor@npm:^1.8.2": - version: 1.8.2 - resolution: "prosemirror-dropcursor@npm:1.8.2" +"prosemirror-dropcursor@npm:^1.8.3": + version: 1.8.3 + resolution: "prosemirror-dropcursor@npm:1.8.3" dependencies: prosemirror-state: "npm:^1.0.0" prosemirror-transform: "npm:^1.1.0" prosemirror-view: "npm:^1.1.0" - checksum: 10c0/c3d9e456a64fecc77a6e6a0350116598550dee8cb55f74e8b66fdb26150c48340ddd1f43184134b24d0f2e710b6879ff6ec72c215dc618a6a673320a91c90478 + checksum: 10c0/123381f83a1843ee97d98143bde070cef727dbd20228f63bf7ebf30446d4352baf6982702de9907b27b7958a33d46c8c3d1a274331862c8d7a5912c838a6abce languageName: node linkType: hard From 10ee32db4049c184a5cea4ac2121019fb98f7ffd Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 24 Aug 2026 17:46:54 -0400 Subject: [PATCH 015/181] chore(deps): bump the aws group with 5 updates (#13543) 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.1111.0` | `3.1115.0` | | [@aws-sdk/lib-storage](https://github.com/aws/aws-sdk-js-v3/tree/HEAD/lib/lib-storage) | `3.1111.0` | `3.1115.0` | | [@aws-sdk/s3-presigned-post](https://github.com/aws/aws-sdk-js-v3/tree/HEAD/packages/s3-presigned-post) | `3.1111.0` | `3.1115.0` | | [@aws-sdk/s3-request-presigner](https://github.com/aws/aws-sdk-js-v3/tree/HEAD/packages/s3-request-presigner) | `3.1111.0` | `3.1115.0` | | [@aws-sdk/signature-v4-crt](https://github.com/aws/aws-sdk-js-v3/tree/HEAD/packages/signature-v4-crt) | `3.1111.0` | `3.1115.0` | Updates `@aws-sdk/client-s3` from 3.1111.0 to 3.1115.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.1115.0/clients/client-s3) Updates `@aws-sdk/lib-storage` from 3.1111.0 to 3.1115.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.1115.0/lib/lib-storage) Updates `@aws-sdk/s3-presigned-post` from 3.1111.0 to 3.1115.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.1115.0/packages/s3-presigned-post) Updates `@aws-sdk/s3-request-presigner` from 3.1111.0 to 3.1115.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.1115.0/packages/s3-request-presigner) Updates `@aws-sdk/signature-v4-crt` from 3.1111.0 to 3.1115.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.1115.0/packages/signature-v4-crt) --- updated-dependencies: - dependency-name: "@aws-sdk/client-s3" dependency-version: 3.1115.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: aws - dependency-name: "@aws-sdk/lib-storage" dependency-version: 3.1115.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: aws - dependency-name: "@aws-sdk/s3-presigned-post" dependency-version: 3.1115.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: aws - dependency-name: "@aws-sdk/s3-request-presigner" dependency-version: 3.1115.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: aws - dependency-name: "@aws-sdk/signature-v4-crt" dependency-version: 3.1115.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 | 54 ++++++++++++++++++++++++++-------------------------- 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/package.json b/package.json index b2befad582..567ac96957 100644 --- a/package.json +++ b/package.json @@ -52,12 +52,12 @@ "> 0.25%, not dead" ], "dependencies": { - "@aws-sdk/client-s3": "^3.1111.0", + "@aws-sdk/client-s3": "^3.1115.0", "@aws-sdk/cloudfront-signer": "^3.1111.0", - "@aws-sdk/lib-storage": "^3.1111.0", - "@aws-sdk/s3-presigned-post": "^3.1111.0", - "@aws-sdk/s3-request-presigner": "^3.1111.0", - "@aws-sdk/signature-v4-crt": "^3.1111.0", + "@aws-sdk/lib-storage": "^3.1115.0", + "@aws-sdk/s3-presigned-post": "^3.1115.0", + "@aws-sdk/s3-request-presigner": "^3.1115.0", + "@aws-sdk/signature-v4-crt": "^3.1115.0", "@benrbray/prosemirror-math": "^0.2.2", "@bull-board/api": "^6.21.3", "@bull-board/koa": "^6.21.3", diff --git a/yarn.lock b/yarn.lock index 8391bf6214..58cc82fe9f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -80,9 +80,9 @@ __metadata: languageName: node linkType: hard -"@aws-sdk/client-s3@npm:3.1111.0, @aws-sdk/client-s3@npm:^3.1111.0": - version: 3.1111.0 - resolution: "@aws-sdk/client-s3@npm:3.1111.0" +"@aws-sdk/client-s3@npm:3.1115.0, @aws-sdk/client-s3@npm:^3.1115.0": + version: 3.1115.0 + resolution: "@aws-sdk/client-s3@npm:3.1115.0" dependencies: "@aws-sdk/checksums": "npm:^3.1000.28" "@aws-sdk/core": "npm:^3.977.8" @@ -95,7 +95,7 @@ __metadata: "@smithy/node-http-handler": "npm:^4.9.13" "@smithy/types": "npm:^4.16.1" tslib: "npm:^2.6.2" - checksum: 10c0/a3c752c2385f705c6ae9ce755d105e645b3f6cba04c350613f82aa3f9223b94359edcb186a7b995988c95a4592663371e503d47fb10308e6c9054a4f30bb635f + checksum: 10c0/ecad08091e9fc61c2f1ba7f71a7f65c0a8861870db8bf3ef02977378f056e00040427918d520d17e3d0608fea07248f73c7a3180d12401a94964461c970a1fe7 languageName: node linkType: hard @@ -260,9 +260,9 @@ __metadata: languageName: node linkType: hard -"@aws-sdk/lib-storage@npm:^3.1111.0": - version: 3.1111.0 - resolution: "@aws-sdk/lib-storage@npm:3.1111.0" +"@aws-sdk/lib-storage@npm:^3.1115.0": + version: 3.1115.0 + resolution: "@aws-sdk/lib-storage@npm:3.1115.0" dependencies: "@smithy/core": "npm:^3.31.1" "@smithy/types": "npm:^4.16.1" @@ -271,8 +271,8 @@ __metadata: stream-browserify: "npm:3.0.0" tslib: "npm:^2.6.2" peerDependencies: - "@aws-sdk/client-s3": ^3.1111.0 - checksum: 10c0/32461dffada61831004abc952304b70f3fc83b991bad42f0acce56fbb2ebb5a16ce818d62fa57a7f14c9194ee698bb5bf0349d40e68a41162cd512a5399ae402 + "@aws-sdk/client-s3": ^3.1115.0 + checksum: 10c0/678be35f73bbe2c97dd16f53969a332fdf19bae7de765b41e9efe9922ce832afa758a68e6a29dab9e5d36d2134f283db52b190cd29a9461c7d640ea360646dcc languageName: node linkType: hard @@ -306,24 +306,24 @@ __metadata: languageName: node linkType: hard -"@aws-sdk/s3-presigned-post@npm:^3.1111.0": - version: 3.1111.0 - resolution: "@aws-sdk/s3-presigned-post@npm:3.1111.0" +"@aws-sdk/s3-presigned-post@npm:^3.1115.0": + version: 3.1115.0 + resolution: "@aws-sdk/s3-presigned-post@npm:3.1115.0" dependencies: - "@aws-sdk/client-s3": "npm:3.1111.0" + "@aws-sdk/client-s3": "npm:3.1115.0" "@aws-sdk/core": "npm:^3.977.8" "@aws-sdk/types": "npm:^3.974.4" "@smithy/core": "npm:^3.31.1" "@smithy/signature-v4": "npm:^5.6.12" "@smithy/types": "npm:^4.16.1" tslib: "npm:^2.6.2" - checksum: 10c0/103d5b5ec6d2fcd8096145cbac7fcbc95613d9242ff4b6770b88bfb97474ccc22a70cba5ddfe7977029026c9ccafa42b79eaf021d2ad8a22d1897dd838b6116e + checksum: 10c0/7ec194e073e0e310072f7c69f3e6f339db14abdf4d338a1b2f14a2f6288c947b5f710a00a2933fa02854a9a0130add94d26cee30cb28bf545a6495398b16a08f languageName: node linkType: hard -"@aws-sdk/s3-request-presigner@npm:^3.1111.0": - version: 3.1111.0 - resolution: "@aws-sdk/s3-request-presigner@npm:3.1111.0" +"@aws-sdk/s3-request-presigner@npm:^3.1115.0": + version: 3.1115.0 + resolution: "@aws-sdk/s3-request-presigner@npm:3.1115.0" dependencies: "@aws-sdk/core": "npm:^3.977.8" "@aws-sdk/signature-v4-multi-region": "npm:^3.996.45" @@ -331,13 +331,13 @@ __metadata: "@smithy/core": "npm:^3.31.1" "@smithy/types": "npm:^4.16.1" tslib: "npm:^2.6.2" - checksum: 10c0/ac02935d089fe4bb568c5b43ba16e1e41eb80a073e991d23fdabdacc20096db36d30c0d07f43ccadbf88fad7c7c924bb6993e12bd3f59449a27197888432b6ec + checksum: 10c0/97a4114101609473e79dbc1175f971957ce9a3dc1bc982c8ae3116044ccf01317d8701e191ed1abca40b21414af61d468a0149732ffae9cc62355d7a01b7e1b0 languageName: node linkType: hard -"@aws-sdk/signature-v4-crt@npm:^3.1111.0": - version: 3.1111.0 - resolution: "@aws-sdk/signature-v4-crt@npm:3.1111.0" +"@aws-sdk/signature-v4-crt@npm:^3.1115.0": + version: 3.1115.0 + resolution: "@aws-sdk/signature-v4-crt@npm:3.1115.0" dependencies: "@aws-sdk/crt-loader": "npm:^3.972.73" "@aws-sdk/signature-v4-multi-region": "npm:^3.996.45" @@ -346,7 +346,7 @@ __metadata: "@smithy/signature-v4": "npm:^5.6.12" "@smithy/types": "npm:^4.16.1" tslib: "npm:^2.6.2" - checksum: 10c0/835d3e32062ddb64254e6bf53b7cd75a636cc608828a8ceb2f3c2faa6b157596857726e7834a23ea0a54a05f71ccb5f46e5fa6c90a454808fa19ab6bf8bf2696 + checksum: 10c0/4f4e26b05dfe71d813d82151248b3f42534f13a801c8dad516b52925e2890a498ed01a70a1c88b2615cc0a590a007c46911e8c08aeda569387d675e0fc6f877e languageName: node linkType: hard @@ -15662,12 +15662,12 @@ __metadata: version: 0.0.0-use.local resolution: "outline@workspace:." dependencies: - "@aws-sdk/client-s3": "npm:^3.1111.0" + "@aws-sdk/client-s3": "npm:^3.1115.0" "@aws-sdk/cloudfront-signer": "npm:^3.1111.0" - "@aws-sdk/lib-storage": "npm:^3.1111.0" - "@aws-sdk/s3-presigned-post": "npm:^3.1111.0" - "@aws-sdk/s3-request-presigner": "npm:^3.1111.0" - "@aws-sdk/signature-v4-crt": "npm:^3.1111.0" + "@aws-sdk/lib-storage": "npm:^3.1115.0" + "@aws-sdk/s3-presigned-post": "npm:^3.1115.0" + "@aws-sdk/s3-request-presigner": "npm:^3.1115.0" + "@aws-sdk/signature-v4-crt": "npm:^3.1115.0" "@benrbray/prosemirror-math": "npm:^0.2.2" "@bull-board/api": "npm:^6.21.3" "@bull-board/koa": "npm:^6.21.3" From f1ebc1edb0475caf93e36607eda5b3cf99d1291e Mon Sep 17 00:00:00 2001 From: Tom Moor <tom@getoutline.com> Date: Mon, 24 Aug 2026 18:31:34 -0400 Subject: [PATCH 016/181] fix: Refactor `useCollectionTrees` hook (#13555) * fix: Refactor useCollectionTrees hook * Avoid unneccessary work --- app/hooks/useCollectionTrees.ts | 139 +++++++++++++++----------------- 1 file changed, 67 insertions(+), 72 deletions(-) diff --git a/app/hooks/useCollectionTrees.ts b/app/hooks/useCollectionTrees.ts index 192a0c3722..829e50b6b7 100644 --- a/app/hooks/useCollectionTrees.ts +++ b/app/hooks/useCollectionTrees.ts @@ -1,88 +1,83 @@ -import { useMemo } from "react"; -import type { NavigationNode } from "@shared/types"; +import type { CollectionSort, NavigationNode } from "@shared/types"; import { NavigationNodeType } from "@shared/types"; import { sortNavigationNodes } from "@shared/utils/collections"; -import type Collection from "~/models/Collection"; +import { useComputed } from "~/hooks/useComputed"; import useStores from "~/hooks/useStores"; +import type Collection from "~/models/Collection"; /** - * React hook that modifies the document structure - * of all collections present in store. Adds extra attributes - * like type, depth and parent to each of the nodes in document - * structure. + * React hook that returns the document structure of all collections in the + * store as navigation trees. Each node is a copy of the node in the store with + * extra attributes added – type, collectionId, depth, and parent. * - * @return {NavigationNode[]} collectionTrees root collection nodes of modified trees + * @returns the root node of each collection tree. */ export default function useCollectionTrees(): NavigationNode[] { const { collections } = useStores(); - const getCollectionTree = (collection: Collection): NavigationNode => { - const addType = (node: NavigationNode): NavigationNode => { - if (node.children.length > 0) { - node.children = node.children.map(addType); - } + return useComputed( + () => collections.orderedData.map(getCollectionTree), + [collections] + ); +} - node.type = node.type ? node.type : NavigationNodeType.Document; - return node; - }; - - const addParent = ( - node: NavigationNode, - parent: NavigationNode | null = null - ): NavigationNode => { - if (node.children.length > 0) { - node.children = node.children.map((child) => addParent(child, node)); - } - - node.parent = parent; - return node; - }; - - const addDepth = (node: NavigationNode, depth = 0): NavigationNode => { - if (node.children.length > 0) { - node.children = node.children.map((child) => - addDepth(child, depth + 1) - ); - } - - node.depth = depth; - return node; - }; - - const addCollectionId = ( - node: NavigationNode, - collectionId = collection.id - ): NavigationNode => { - if (node.children.length > 0) { - node.children = node.children.map((child) => - addCollectionId(child, collectionId) - ); - } - - node.collectionId = collectionId; - return node; - }; - - const collectionNode: NavigationNode = { - id: collection.id, - title: collection.name, - url: collection.path, - type: NavigationNodeType.Collection, - children: collection.documents - ? sortNavigationNodes(collection.documents, collection.sort, true) - : [], - parent: null, - }; - - return addParent(addCollectionId(addDepth(addType(collectionNode), 1))); +/** + * Builds the navigation tree for a collection. + * + * @param collection The collection to build the tree for. + * @returns the root node of the collection tree. + */ +function getCollectionTree(collection: Collection): NavigationNode { + const root: NavigationNode = { + id: collection.id, + title: collection.name, + url: collection.path, + type: NavigationNodeType.Collection, + collectionId: collection.id, + depth: 1, + parent: null, + children: [], }; - const key = collections.orderedData.map((o) => o.documents?.length).join("-"); - const collectionTrees = useMemo( - () => collections.orderedData.map(getCollectionTree), - // oxlint-disable-next-line react-hooks/exhaustive-deps - [collections.orderedData, key] + root.children = annotateNodes( + collection.documents ?? [], + collection.sort, + root ); - return collectionTrees; + return root; +} + +/** + * Copies the given nodes and their descendants in sorted order, adding the + * attributes needed to traverse and render the tree. + * + * @param nodes The nodes to copy. + * @param sort The sort of the collection the nodes belong to. + * @param parent The node that the given nodes are children of. + * @returns the copied nodes. + */ +function annotateNodes( + nodes: NavigationNode[], + sort: CollectionSort, + parent: NavigationNode +): NavigationNode[] { + if (!nodes.length) { + return []; + } + + return sortNavigationNodes(nodes, sort, false).map((node) => { + const annotated: NavigationNode = { + ...node, + type: node.type ?? NavigationNodeType.Document, + collectionId: parent.collectionId, + depth: (parent.depth ?? 0) + 1, + parent, + children: [], + }; + + annotated.children = annotateNodes(node.children ?? [], sort, annotated); + + return annotated; + }); } From ccbe2fa99bb03b7974eaf24d3c8b050e88a44739 Mon Sep 17 00:00:00 2001 From: Tom Moor <tom@getoutline.com> Date: Mon, 24 Aug 2026 19:02:31 -0400 Subject: [PATCH 017/181] fix: Enforce import restrictions shadowed by nested oxlint configs (#13558) Nested .oxlintrc.json files replace the root config per-rule rather than merging, so the root's shared/** override for no-restricted-imports was dead config and the sonner restriction was not enforced anywhere. Move the restrictions into shared/.oxlintrc.json, add the prosemirror-tables entry to app/.oxlintrc.json where the same shadowing applies to .tsx files, and drop the dead root override. --- .oxlintrc.json | 26 -------------------------- app/.oxlintrc.json | 12 ++++++++++++ shared/.oxlintrc.json | 16 ++++++++++++++++ 3 files changed, 28 insertions(+), 26 deletions(-) diff --git a/.oxlintrc.json b/.oxlintrc.json index 349f3eea59..7b2243a1a5 100644 --- a/.oxlintrc.json +++ b/.oxlintrc.json @@ -125,32 +125,6 @@ "react-hooks/exhaustive-deps": "error" }, "plugins": ["eslint", "oxc", "react", "typescript", "import"] - }, - { - "files": ["shared/**/*.{js,jsx,ts,tsx}"], - "rules": { - "no-restricted-imports": [ - "error", - { - "paths": [ - { - "name": "prosemirror-tables", - "importNames": [ - "addRowBefore", - "addRowAfter", - "addColumnBefore", - "addColumnAfter" - ], - "message": "Use the wrappers from shared/editor/commands/table instead, which respect the target index and place the cursor in the inserted cell." - }, - { - "name": "sonner", - "message": "Do not import a toast library within shared; surface notifications through the onNotice callback so shared code stays decoupled from the app's toast implementation." - } - ] - } - ] - } } ] } diff --git a/app/.oxlintrc.json b/app/.oxlintrc.json index c5e7a685e1..9857c6171f 100644 --- a/app/.oxlintrc.json +++ b/app/.oxlintrc.json @@ -16,6 +16,18 @@ "no-restricted-imports": [ "error", { + "paths": [ + { + "name": "prosemirror-tables", + "importNames": [ + "addRowBefore", + "addRowAfter", + "addColumnBefore", + "addColumnAfter" + ], + "message": "Use the wrappers from shared/editor/commands/table instead, which respect the target index and place the cursor in the inserted cell." + } + ], "patterns": [ { "group": ["mime-types"], diff --git a/shared/.oxlintrc.json b/shared/.oxlintrc.json index d42a6acdf0..bab232dafa 100644 --- a/shared/.oxlintrc.json +++ b/shared/.oxlintrc.json @@ -16,6 +16,22 @@ "no-restricted-imports": [ "error", { + "paths": [ + { + "name": "prosemirror-tables", + "importNames": [ + "addRowBefore", + "addRowAfter", + "addColumnBefore", + "addColumnAfter" + ], + "message": "Use the wrappers from shared/editor/commands/table instead, which respect the target index and place the cursor in the inserted cell." + }, + { + "name": "sonner", + "message": "Do not import a toast library within shared; surface notifications through the onNotice callback so shared code stays decoupled from the app's toast implementation." + } + ], "patterns": [ { "group": ["@shared/*"], From aab83e837888bc4b2d6ff1af102619baceddf4a9 Mon Sep 17 00:00:00 2001 From: Tom Moor <tom@getoutline.com> Date: Mon, 24 Aug 2026 19:14:55 -0400 Subject: [PATCH 018/181] fix: Reliability of count-based limit checks (#13542) * fix: Make count-based limit checks reliable under concurrency Limits enforced by counting rows before an insert could be exceeded by requests that ran at the same time, as each one read the same count before any of them had written. Add a LockHelper that takes a Postgres advisory lock for the remainder of the transaction, and use it to serialize the check for webhook subscriptions, team domains, share subscriptions and pins. The counts now also run on the transaction so they include rows written earlier in the same request. * Remove excessive tests * Also guard simultaneous row removal --- server/commands/pinCreator.ts | 11 +---- server/commands/teamUpdater.ts | 22 +++++----- server/models/Collection.ts | 10 ++++- server/models/GroupMembership.ts | 10 +++++ server/models/Import.ts | 13 +++++- server/models/Pin.ts | 46 ++++++++++++++++++++- server/models/ShareSubscription.ts | 9 ++++ server/models/TeamDomain.ts | 20 ++++++++- server/models/User.ts | 25 +++++++++++ server/models/UserMembership.test.ts | 55 ++++++++++++++++++++++++ server/models/UserMembership.ts | 10 +++++ server/models/WebhookSubscription.ts | 15 ++++++- server/storage/LockHelper.test.ts | 62 ++++++++++++++++++++++++++++ server/storage/LockHelper.ts | 40 ++++++++++++++++++ server/utils/MutexLock.ts | 6 +++ 15 files changed, 328 insertions(+), 26 deletions(-) create mode 100644 server/storage/LockHelper.test.ts create mode 100644 server/storage/LockHelper.ts diff --git a/server/commands/pinCreator.ts b/server/commands/pinCreator.ts index 195825a613..e0ed518cf7 100644 --- a/server/commands/pinCreator.ts +++ b/server/commands/pinCreator.ts @@ -1,8 +1,6 @@ import fractionalIndex from "fractional-index"; import type { WhereOptions } from "sequelize"; import { Sequelize, Op } from "sequelize"; -import { PinValidation } from "@shared/validations"; -import { ValidationError } from "@server/errors"; import type { User } from "@server/models"; import { Pin } from "@server/models"; import type { APIContext } from "@server/types"; @@ -35,22 +33,17 @@ export default async function pinCreator({ ...rest }: Props): Promise<Pin> { let { index } = rest; + const { transaction } = ctx.context; const where: WhereOptions<Pin> = { teamId: user.teamId, ...(collectionId ? { collectionId } : { collectionId: { [Op.is]: null } }), }; - const count = await Pin.count({ where }); - if (count >= PinValidation.max) { - throw ValidationError( - `You cannot pin more than ${PinValidation.max} documents` - ); - } - if (!index) { const pins = await Pin.findAll({ where, attributes: ["id", "index", "updatedAt"], + transaction, limit: 1, order: [ // using LC_COLLATE:"C" because we need byte order to drive the sorting diff --git a/server/commands/teamUpdater.ts b/server/commands/teamUpdater.ts index 407b577cac..8aa08af663 100644 --- a/server/commands/teamUpdater.ts +++ b/server/commands/teamUpdater.ts @@ -50,17 +50,17 @@ const teamUpdater = async (ctx: APIContext, { params, user, team }: Props) => { const newDomains = allowedDomains.filter( (newDomain) => newDomain !== "" && !existingDomains.includes(newDomain) ); - await Promise.all( - newDomains.map(async (newDomain) => { - newAllowedDomains.push( - await TeamDomain.createWithCtx(ctx, { - name: newDomain, - teamId: team.id, - createdById: user.id, - }) - ); - }) - ); + // Created one at a time so that the limit check on each create counts the + // domains added earlier in the same request. + for (const newDomain of newDomains) { + newAllowedDomains.push( + await TeamDomain.createWithCtx(ctx, { + name: newDomain, + teamId: team.id, + createdById: user.id, + }) + ); + } // Destroy the existing TeamDomains that were removed const deletedDomains = existingAllowedDomains.filter( diff --git a/server/models/Collection.ts b/server/models/Collection.ts index b09046f2ac..e3ed2fc796 100644 --- a/server/models/Collection.ts +++ b/server/models/Collection.ts @@ -4,6 +4,7 @@ import { find, findIndex, isNil, keyBy, remove, uniq } from "es-toolkit/compat"; import type { Identifier, Transaction, + DestroyOptions, FindOptions, NonNullFindOptions, InferAttributes, @@ -58,6 +59,7 @@ import { CollectionValidation } from "@shared/validations"; import { parser } from "@server/editor"; import { ValidationError } from "@server/errors"; import type { APIContext } from "@server/types"; +import { LockHelper } from "@server/storage/LockHelper"; import { CacheHelper } from "@server/utils/CacheHelper"; import { RedisPrefixHelper } from "@server/utils/RedisPrefixHelper"; import removeIndexCollision from "@server/utils/removeIndexCollision"; @@ -409,7 +411,13 @@ class Collection extends ParanoidModel< } @BeforeDestroy - static async checkLastCollection(model: Collection) { + static async checkLastCollection(model: Collection, options: DestroyOptions) { + await LockHelper.acquire( + model.sequelize, + `collections:${model.teamId}`, + options.transaction + ); + const total = await this.count({ where: { teamId: model.teamId, diff --git a/server/models/GroupMembership.ts b/server/models/GroupMembership.ts index 65f0fa4000..18de933aa0 100644 --- a/server/models/GroupMembership.ts +++ b/server/models/GroupMembership.ts @@ -24,6 +24,7 @@ import { import type { DocumentPermission } from "@shared/types"; import { CollectionPermission } from "@shared/types"; import { ValidationError } from "@server/errors"; +import { LockHelper } from "@server/storage/LockHelper"; import type { APIContext } from "@server/types"; import Collection from "./Collection"; import Document from "./Document"; @@ -441,6 +442,15 @@ class GroupMembership extends ParanoidModel< model: GroupMembership, { transaction }: APIContext["context"] ) { + // Both models guard the same invariant, so they share one lock name, + // otherwise the last user manager and the last group manager can be + // removed at the same time. + await LockHelper.acquire( + model.sequelize, + `collectionAdmins:${model.collectionId}`, + transaction + ); + const [userMemberships, groupMemberships] = await Promise.all([ UserMembership.count({ where: { diff --git a/server/models/Import.ts b/server/models/Import.ts index 30aada32bc..b53ea2e0bf 100644 --- a/server/models/Import.ts +++ b/server/models/Import.ts @@ -20,6 +20,7 @@ import { type ImportInput, type ImportScratch } from "@shared/schema"; import { ImportableIntegrationService, ImportState } from "@shared/types"; import { ImportValidation } from "@shared/validations"; import { UnprocessableEntityError } from "@server/errors"; +import { LockHelper } from "@server/storage/LockHelper"; import Integration from "./Integration"; import Team from "./Team"; import User from "./User"; @@ -105,6 +106,16 @@ class Import<T extends ImportableIntegrationService> extends ParanoidModel< @BeforeCreate // oxlint-disable-next-line @typescript-eslint/no-explicit-any static async checkInProgress(model: Import<any>, options: SaveOptions) { + const { transaction } = options; + + // Serialize concurrent creation for the team, otherwise every request can + // read the same count and pass the check. + await LockHelper.acquire( + model.sequelize, + `imports:${model.teamId}`, + transaction + ); + const inProgress = await this.count({ where: { teamId: model.teamId, @@ -114,7 +125,7 @@ class Import<T extends ImportableIntegrationService> extends ParanoidModel< ImportState.Processed, ], }, - transaction: options.transaction, + transaction, }); if (inProgress) { throw UnprocessableEntityError("An import is already in progress"); diff --git a/server/models/Pin.ts b/server/models/Pin.ts index f30132808b..67c07855ec 100644 --- a/server/models/Pin.ts +++ b/server/models/Pin.ts @@ -1,12 +1,21 @@ -import type { InferAttributes, InferCreationAttributes } from "sequelize"; +import type { + InferAttributes, + InferCreationAttributes, + SaveOptions, +} from "sequelize"; +import { Op } from "sequelize"; import { DataType, Column, ForeignKey, BelongsTo, + BeforeCreate, Table, Length, } from "sequelize-typescript"; +import { PinValidation } from "@shared/validations"; +import { ValidationError } from "@server/errors"; +import { LockHelper } from "@server/storage/LockHelper"; import Collection from "./Collection"; import Document from "./Document"; import Team from "./Team"; @@ -54,6 +63,41 @@ class Pin extends IdModel< @ForeignKey(() => Team) @Column(DataType.UUID) teamId: string; + + // hooks + + /** + * Limits the number of documents pinned to a single destination, either one + * collection or the home screen. + */ + @BeforeCreate + static async checkLimit(model: Pin, options: SaveOptions) { + const { transaction } = options; + const { teamId, collectionId } = model; + + // Serialize concurrent creation for the destination, otherwise every + // request can read the same count and pass the check. + await LockHelper.acquire( + model.sequelize, + `pins:${teamId}:${collectionId ?? "home"}`, + transaction + ); + + const count = await this.count({ + where: { + teamId, + ...(collectionId + ? { collectionId } + : { collectionId: { [Op.is]: null } }), + }, + transaction, + }); + if (count >= PinValidation.max) { + throw ValidationError( + `You cannot pin more than ${PinValidation.max} documents` + ); + } + } } export default Pin; diff --git a/server/models/ShareSubscription.ts b/server/models/ShareSubscription.ts index 7c3cd335d6..230b41b89e 100644 --- a/server/models/ShareSubscription.ts +++ b/server/models/ShareSubscription.ts @@ -13,6 +13,7 @@ import { import { subHours } from "date-fns"; import { Hour } from "@shared/utils/time"; import { ValidationError } from "@server/errors"; +import { LockHelper } from "@server/storage/LockHelper"; import Document from "./Document"; import Share from "./Share"; import IdModel from "./base/IdModel"; @@ -96,6 +97,14 @@ class ShareSubscription extends IdModel< return; } + // Serialize concurrent creation from the address, otherwise every request + // can read the same count and pass the check. + await LockHelper.acquire( + model.sequelize, + `shareSubscriptions:${model.ipAddress}`, + options.transaction + ); + const results = await this.findAll({ attributes: ["emailFingerprint"], where: { ipAddress: model.ipAddress }, diff --git a/server/models/TeamDomain.ts b/server/models/TeamDomain.ts index 143cd34388..585dd3dba1 100644 --- a/server/models/TeamDomain.ts +++ b/server/models/TeamDomain.ts @@ -1,5 +1,9 @@ import emailProviders from "email-providers"; -import type { InferAttributes, InferCreationAttributes } from "sequelize"; +import type { + InferAttributes, + InferCreationAttributes, + SaveOptions, +} from "sequelize"; import { Column, DataType, @@ -14,6 +18,7 @@ import { import { TeamValidation } from "@shared/validations"; import env from "@server/env"; import { ValidationError } from "@server/errors"; +import { LockHelper } from "@server/storage/LockHelper"; import Team from "./Team"; import User from "./User"; import IdModel from "./base/IdModel"; @@ -62,13 +67,24 @@ class TeamDomain extends IdModel< } @BeforeCreate - static async checkLimit(model: TeamDomain) { + static async checkLimit(model: TeamDomain, options: SaveOptions) { if (!env.isCloudHosted) { return; } + const { transaction } = options; + + // Serialize concurrent creation for the team, otherwise every request can + // read the same count and pass the check. + await LockHelper.acquire( + model.sequelize, + `teamDomains:${model.teamId}`, + transaction + ); + const count = await this.count({ where: { teamId: model.teamId }, + transaction, }); if (count >= TeamValidation.maxDomains) { throw ValidationError( diff --git a/server/models/User.ts b/server/models/User.ts index 10c33974b6..1974d465a1 100644 --- a/server/models/User.ts +++ b/server/models/User.ts @@ -50,6 +50,7 @@ import type { locales } from "@shared/utils/date"; import { UserValidation } from "@shared/validations"; import env from "@server/env"; import DeleteAttachmentTask from "@server/queues/tasks/DeleteAttachmentTask"; +import { LockHelper } from "@server/storage/LockHelper"; import type { APIContext } from "@server/types"; import { VerificationCode } from "@server/utils/VerificationCode"; import parseAttachmentIds from "@server/utils/parseAttachmentIds"; @@ -747,6 +748,14 @@ class User extends ParanoidModel< model: User, { transaction }: { transaction: Transaction } ) { + // Serialize concurrent deletion within the team, otherwise every request + // can read the same count and pass the check. + await LockHelper.acquire( + model.sequelize, + `users:${model.teamId}`, + transaction + ); + const usersCount = await this.count({ where: { teamId: model.teamId, @@ -770,6 +779,14 @@ class User extends ParanoidModel< return; } + // Shares the lock name with the check above, so both counts are taken + // against a settled team. + await LockHelper.acquire( + model.sequelize, + `users:${model.teamId}`, + transaction + ); + const otherAdminsCount = await this.count({ where: { teamId: model.teamId, @@ -824,6 +841,14 @@ class User extends ParanoidModel< previousRole === UserRole.Admin && UserRoleHelper.isRoleLower(model.role, UserRole.Admin) ) { + // Shares the lock name with the deletion checks, so a demotion and a + // deletion cannot each count the other account as the remaining admin. + await LockHelper.acquire( + model.sequelize, + `users:${model.teamId}`, + options.transaction + ); + const { count } = await this.findAndCountAll({ where: { teamId: model.teamId, diff --git a/server/models/UserMembership.test.ts b/server/models/UserMembership.test.ts index 6632dbafa4..fcf7ba0c6f 100644 --- a/server/models/UserMembership.test.ts +++ b/server/models/UserMembership.test.ts @@ -1,9 +1,14 @@ +import { sleep } from "@shared/utils/timers"; +import { CollectionPermission } from "@shared/types"; import { buildCollection, buildDocument, + buildGroup, buildUser, } from "@server/test/factories"; +import { withAPIContext } from "@server/test/support"; import Event from "./Event"; +import GroupMembership from "./GroupMembership"; import UserMembership from "./UserMembership"; describe("UserMembership", () => { @@ -50,4 +55,54 @@ describe("UserMembership", () => { expect(membership?.collection?.id).toEqual(collection.id); }); }); + describe("validateLastAdminPermission", () => { + it("should not allow the last user and group manager to be removed concurrently", async () => { + const user = await buildUser(); + const collection = await buildCollection({ + teamId: user.teamId, + userId: user.id, + }); + const group = await buildGroup({ teamId: user.teamId }); + + // The collection creator is its only user manager. + const userMembership = await UserMembership.findOne({ + where: { collectionId: collection.id, userId: user.id }, + rejectOnEmpty: true, + }); + const groupMembership = await GroupMembership.create({ + createdById: user.id, + groupId: group.id, + collectionId: collection.id, + permission: CollectionPermission.Admin, + }); + + let removed: () => void = () => undefined; + const first = new Promise<void>((resolve) => { + removed = resolve; + }); + let commit: () => void = () => undefined; + const held = new Promise<void>((resolve) => { + commit = resolve; + }); + + // The user membership goes first, leaving the group as the only manager. + const one = withAPIContext(user, async (ctx) => { + await userMembership.destroyWithCtx(ctx); + removed(); + await held; + }); + await first; + + const two = withAPIContext(user, (ctx) => + groupMembership.destroyWithCtx(ctx) + ); + await sleep(250); + commit(); + await one; + + await expect(two).rejects.toThrow( + "At least one user or group must have manage permissions" + ); + }); + }); }); diff --git a/server/models/UserMembership.ts b/server/models/UserMembership.ts index cbd4019b61..1dda32588d 100644 --- a/server/models/UserMembership.ts +++ b/server/models/UserMembership.ts @@ -20,6 +20,7 @@ import { import type { DocumentPermission } from "@shared/types"; import { CollectionPermission } from "@shared/types"; import { ValidationError } from "@server/errors"; +import { LockHelper } from "@server/storage/LockHelper"; import type { APIContext } from "@server/types"; import { CacheHelper } from "@server/utils/CacheHelper"; import { RedisPrefixHelper } from "@server/utils/RedisPrefixHelper"; @@ -422,6 +423,15 @@ class UserMembership extends IdModel< model: UserMembership, { transaction }: APIContext["context"] ) { + // Both models guard the same invariant, so they share one lock name, + // otherwise the last user manager and the last group manager can be + // removed at the same time. + await LockHelper.acquire( + model.sequelize, + `collectionAdmins:${model.collectionId}`, + transaction + ); + const [userMemberships, groupMemberships] = await Promise.all([ this.count({ where: { diff --git a/server/models/WebhookSubscription.ts b/server/models/WebhookSubscription.ts index 75f71cdf22..2bd1d2f62d 100644 --- a/server/models/WebhookSubscription.ts +++ b/server/models/WebhookSubscription.ts @@ -4,6 +4,7 @@ import type { InferAttributes, InferCreationAttributes, InstanceUpdateOptions, + SaveOptions, Transaction, } from "sequelize"; import { @@ -25,6 +26,7 @@ import { Hour } from "@shared/utils/time"; import { WebhookSubscriptionValidation } from "@shared/validations"; import { ValidationError } from "@server/errors"; import type { Event } from "@server/types"; +import { LockHelper } from "@server/storage/LockHelper"; import { CacheHelper } from "@server/utils/CacheHelper"; import { RedisPrefixHelper } from "@server/utils/RedisPrefixHelper"; import Team from "./Team"; @@ -154,9 +156,20 @@ class WebhookSubscription extends ParanoidModel< // hooks @BeforeCreate - static async checkLimit(model: WebhookSubscription) { + static async checkLimit(model: WebhookSubscription, options: SaveOptions) { + const { transaction } = options; + + // Serialize concurrent creation for the team, otherwise every request can + // read the same count and pass the check. + await LockHelper.acquire( + model.sequelize, + `webhookSubscriptions:${model.teamId}`, + transaction + ); + const count = await this.count({ where: { teamId: model.teamId }, + transaction, }); if (count >= WebhookSubscriptionValidation.maxSubscriptions) { throw ValidationError( diff --git a/server/storage/LockHelper.test.ts b/server/storage/LockHelper.test.ts new file mode 100644 index 0000000000..46a9122a3b --- /dev/null +++ b/server/storage/LockHelper.test.ts @@ -0,0 +1,62 @@ +import { sleep } from "@shared/utils/timers"; +import { sequelize } from "./database"; +import { LockHelper } from "./LockHelper"; + +describe("LockHelper", () => { + describe("acquire", () => { + it("should block another transaction holding the same lock", async () => { + const events: string[] = []; + let release: () => void = () => undefined; + const held = new Promise<void>((resolve) => { + release = resolve; + }); + + const first = sequelize.transaction(async (transaction) => { + await LockHelper.acquire(sequelize, "limit:one", transaction); + events.push("first"); + await held; + }); + + while (!events.length) { + await sleep(10); + } + + const second = sequelize.transaction(async (transaction) => { + await LockHelper.acquire(sequelize, "limit:one", transaction); + events.push("second"); + }); + + await sleep(250); + expect(events).toEqual(["first"]); + + release(); + await Promise.all([first, second]); + expect(events).toEqual(["first", "second"]); + }); + + it("should not block a transaction holding a different lock", async () => { + let release: () => void = () => undefined; + const held = new Promise<void>((resolve) => { + release = resolve; + }); + + const first = sequelize.transaction(async (transaction) => { + await LockHelper.acquire(sequelize, "limit:two", transaction); + await held; + }); + + await sequelize.transaction(async (transaction) => { + await LockHelper.acquire(sequelize, "limit:three", transaction); + }); + + release(); + await first; + }); + + it("should not throw without a transaction", async () => { + await expect( + LockHelper.acquire(sequelize, "limit:four") + ).resolves.toBeUndefined(); + }); + }); +}); diff --git a/server/storage/LockHelper.ts b/server/storage/LockHelper.ts new file mode 100644 index 0000000000..c860c2dabb --- /dev/null +++ b/server/storage/LockHelper.ts @@ -0,0 +1,40 @@ +import type { Sequelize, Transaction } from "sequelize"; +import { QueryTypes } from "sequelize"; + +/** + * Helper for taking advisory locks in the database. + * + * These locks are scoped to a transaction. When the routine to serialize is not + * a transaction, or it calls an external service, use `MutexLock` instead. + */ +export class LockHelper { + /** + * Take an advisory lock that is held for the remainder of the given + * transaction, blocking every other transaction that asks for the same name + * until this one commits or rolls back. + * + * Use this to make a read-then-write sequence atomic when there is no row to + * lock, such as counting rows before inserting one more. + * + * @param sequelize the database connection to take the lock on. + * @param name the name of the lock, shared by everything that must serialize. + * @param transaction the transaction to hold the lock for. When none is given + * the lock cannot be held and is skipped. + * @returns a promise that resolves when the lock is held. + */ + public static async acquire( + sequelize: Sequelize, + name: string, + transaction?: Transaction | null + ): Promise<void> { + if (!transaction) { + return; + } + + await sequelize.query("SELECT pg_advisory_xact_lock(hashtext(:name))", { + replacements: { name }, + type: QueryTypes.SELECT, + transaction, + }); + } +} diff --git a/server/utils/MutexLock.ts b/server/utils/MutexLock.ts index c44927c804..081c3b1f3d 100644 --- a/server/utils/MutexLock.ts +++ b/server/utils/MutexLock.ts @@ -20,6 +20,12 @@ type AcquireOptions = { /** * A distributed mutex lock backed by Redis, for coordinating exclusive access * to resources across processes. + * + * Use this when the resource is Redis or an external service, when the routine + * makes network calls, or when it runs long enough that holding a database + * connection would matter. When the routine is database work in a single + * transaction and the lock must be held until that transaction commits, use + * `LockHelper` instead. */ export class MutexLock { /** Default expiry time for acquiring lock in milliseconds. */ From 4cb691c65868508567a4b7b12883069d652b6ac0 Mon Sep 17 00:00:00 2001 From: Tom Moor <tom@getoutline.com> Date: Thu, 27 Aug 2026 15:07:50 -0400 Subject: [PATCH 019/181] chore: Reduce cardinality of datadog metrics (#13565) * chore: Reduce cardinality of datadog metrics * address feedback --- server/collaboration/MetricsExtension.ts | 39 +++++++----------------- server/middlewares/rateLimiter.ts | 2 +- 2 files changed, 12 insertions(+), 29 deletions(-) diff --git a/server/collaboration/MetricsExtension.ts b/server/collaboration/MetricsExtension.ts index d1880d2780..53aaf82041 100644 --- a/server/collaboration/MetricsExtension.ts +++ b/server/collaboration/MetricsExtension.ts @@ -1,37 +1,27 @@ import type { - onChangePayload, onDisconnectPayload, - onLoadDocumentPayload, Extension, connectedPayload, + onLoadDocumentPayload, } from "@hocuspocus/server"; import Metrics from "@server/logging/Metrics"; import type { withContext } from "./types"; export default class MetricsExtension implements Extension { - async onLoadDocument({ - documentName, - instance, - }: withContext<onLoadDocumentPayload>) { - Metrics.increment("collaboration.load_document", { - documentName, - }); + async onLoadDocument({ instance }: withContext<onLoadDocumentPayload>) { + Metrics.increment("collaboration.load_document"); Metrics.gaugePerInstance( "collaboration.documents_count", instance.getDocumentsCount() ); } - onAuthenticationFailed({ documentName }: { documentName: string }) { - Metrics.increment("collaboration.authentication_failed", { - documentName, - }); + onAuthenticationFailed() { + Metrics.increment("collaboration.authentication_failed"); } - async connected({ documentName, instance }: withContext<connectedPayload>) { - Metrics.increment("collaboration.connect", { - documentName, - }); + async connected({ instance }: withContext<connectedPayload>) { + Metrics.increment("collaboration.connect"); Metrics.gaugePerInstance( "collaboration.connections_count", instance.getConnectionsCount() + 1 @@ -42,13 +32,8 @@ export default class MetricsExtension implements Extension { ); } - async onDisconnect({ - documentName, - instance, - }: withContext<onDisconnectPayload>) { - Metrics.increment("collaboration.disconnect", { - documentName, - }); + async onDisconnect({ instance }: withContext<onDisconnectPayload>) { + Metrics.increment("collaboration.disconnect"); Metrics.gaugePerInstance( "collaboration.connections_count", instance.getConnectionsCount() @@ -59,10 +44,8 @@ export default class MetricsExtension implements Extension { ); } - async onStoreDocument({ documentName }: withContext<onChangePayload>) { - Metrics.increment("collaboration.change", { - documentName, - }); + async onStoreDocument() { + Metrics.increment("collaboration.change"); } async onDestroy() { diff --git a/server/middlewares/rateLimiter.ts b/server/middlewares/rateLimiter.ts index 1ddfb8bc29..7c908470c6 100644 --- a/server/middlewares/rateLimiter.ts +++ b/server/middlewares/rateLimiter.ts @@ -95,7 +95,7 @@ async function consume( ctx.set("RateLimit-Reset", `${resetSeconds}`); Metrics.increment("rate_limit.exceeded", { - path: fullPath, + path: isPathScoped ? "path" : "default", }); throw RateLimitExceededError(); From d2697d354e49435dc37bfc0f14ec58d6ce2c7e8f Mon Sep 17 00:00:00 2001 From: Tom Moor <tom@getoutline.com> Date: Thu, 27 Aug 2026 15:27:02 -0400 Subject: [PATCH 020/181] fix: Respect heading number preference in HTML export (#13563) Heading numbers are drawn by a ProseMirror decoration, and the server strips all plugin decorations before it serializes, so exported HTML always came out unnumbered. Compute the same labels during export and write them to the rendered headings as a data attribute, which the exported editor styles already render. A revision takes the preference from the document it belongs to. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> --- server/models/helpers/DocumentHelper.test.ts | 47 ++++++++++++++++++++ server/models/helpers/DocumentHelper.tsx | 16 +++++-- server/models/helpers/ProsemirrorHelper.tsx | 19 +++++++- shared/editor/extensions/HeadingPrefix.ts | 34 ++++++++++++++ 4 files changed, 111 insertions(+), 5 deletions(-) diff --git a/server/models/helpers/DocumentHelper.test.ts b/server/models/helpers/DocumentHelper.test.ts index 17c81cff6e..66b4cee329 100644 --- a/server/models/helpers/DocumentHelper.test.ts +++ b/server/models/helpers/DocumentHelper.test.ts @@ -2,6 +2,7 @@ import Revision from "@server/models/Revision"; import { buildCollection, buildDocument } from "@server/test/factories"; import { ChangesetHelper } from "@shared/editor/lib/ChangesetHelper"; import { EditorStyleHelper } from "@shared/editor/styles/EditorStyleHelper"; +import { HeadingPrefixStyle } from "@shared/types"; import { DocumentHelper } from "./DocumentHelper"; describe("DocumentHelper", () => { @@ -181,6 +182,52 @@ describe("DocumentHelper", () => { expect(result).not.toContain("katex.min.css"); }); + it("should number headings according to the document preference", async () => { + const document = await buildDocument({ + text: "# One\n\n## Two\n\n# Three", + preferences: { headingPrefix: HeadingPrefixStyle.Numeric }, + }); + const result = await DocumentHelper.toHTML(document, { + includeTitle: false, + includeStyles: false, + }); + + expect(result).toContain('data-heading-prefix="1"'); + expect(result).toContain('data-heading-prefix="1.1"'); + expect(result).toContain('data-heading-prefix="2"'); + }); + + it("should not number headings without the document preference", async () => { + const document = await buildDocument({ + text: "# One\n\n## Two", + }); + const result = await DocumentHelper.toHTML(document, { + includeTitle: false, + includeStyles: false, + }); + + expect(result).not.toContain("data-heading-prefix"); + }); + + it("should number headings of a revision from its document", async () => { + const document = await buildDocument({ + text: "# One\n\n## Two", + preferences: { headingPrefix: HeadingPrefixStyle.Numeric }, + }); + const revision = new Revision({ + documentId: document.id, + title: document.title, + text: document.text, + }); + const result = await DocumentHelper.toHTML(revision, { + includeTitle: false, + includeStyles: false, + }); + + expect(result).toContain('data-heading-prefix="1"'); + expect(result).toContain('data-heading-prefix="1.1"'); + }); + it("should render diff classes when changes provided", async () => { const doc1 = await buildDocument({ text: "Hello world" }); const doc2 = await buildDocument({ text: "Hello modified world" }); diff --git a/server/models/helpers/DocumentHelper.tsx b/server/models/helpers/DocumentHelper.tsx index ec1b382df2..7f6665c4cd 100644 --- a/server/models/helpers/DocumentHelper.tsx +++ b/server/models/helpers/DocumentHelper.tsx @@ -11,7 +11,7 @@ import headingToSlug from "@shared/editor/lib/headingToSlug"; import textBetween from "@shared/editor/lib/textBetween"; import { EditorStyleHelper } from "@shared/editor/styles/EditorStyleHelper"; import type { NavigationNode, ProsemirrorData } from "@shared/types"; -import { IconType, TextEditMode } from "@shared/types"; +import { DocumentPreference, IconType, TextEditMode } from "@shared/types"; import { determineIconType } from "@shared/utils/icon"; import { ProsemirrorDataHelper } from "@shared/utils/ProsemirrorDataHelper"; import { parser, serializer, schema } from "@server/editor"; @@ -348,6 +348,15 @@ export class DocumentHelper { options?: HTMLOptions ) { const node = DocumentHelper.toProsemirror(model); + // Heading numbering is a preference of the document, which a revision + // inherits from the document it belongs to. + const document = + model instanceof Document + ? model + : model instanceof Revision + ? await model.$get("document") + : null; + let output = await ProsemirrorHelper.toHTML(node, { title: options?.includeTitle !== false @@ -362,6 +371,7 @@ export class DocumentHelper { baseUrl: options?.baseUrl, changes: options?.changes, cspNonce: options?.cspNonce, + headingPrefix: document?.getPreference(DocumentPreference.HeadingPrefix), }); addTags({ @@ -371,9 +381,7 @@ export class DocumentHelper { if (options?.signedUrls) { const teamId = - model instanceof Collection || model instanceof Document - ? model.teamId - : (await model.$get("document"))?.teamId; + model instanceof Collection ? model.teamId : document?.teamId; if (!teamId) { return output; diff --git a/server/models/helpers/ProsemirrorHelper.tsx b/server/models/helpers/ProsemirrorHelper.tsx index 74c46e0036..c758249b5a 100644 --- a/server/models/helpers/ProsemirrorHelper.tsx +++ b/server/models/helpers/ProsemirrorHelper.tsx @@ -20,6 +20,7 @@ import { import * as Y from "yjs"; import { toError, errToString } from "@shared/utils/error"; import Diff from "@shared/editor/extensions/Diff"; +import { HeadingPrefixHelper } from "@shared/editor/extensions/HeadingPrefix"; import { EditorStyleHelper } from "@shared/editor/styles/EditorStyleHelper"; import type { ExtendedChange } from "@shared/editor/lib/ChangesetHelper"; import textBetween from "@shared/editor/lib/textBetween"; @@ -27,7 +28,11 @@ import { withTrailingNode } from "@shared/editor/lib/trailingNode"; import EditorContainer from "@shared/editor/components/Styles"; import GlobalStyles from "@shared/styles/globals"; import light from "@shared/styles/theme"; -import type { ProsemirrorData, UnfurlResponse } from "@shared/types"; +import type { + HeadingPrefixStyle, + ProsemirrorData, + UnfurlResponse, +} from "@shared/types"; import { AttachmentPreset, MentionType } from "@shared/types"; import { attachmentRedirectRegex, @@ -66,6 +71,8 @@ export type HTMLOptions = { changes?: readonly ExtendedChange[]; /** CSP nonce to apply to injected inline scripts */ cspNonce?: string; + /** The style of prefix displayed before headings (defaults to none) */ + headingPrefix?: HeadingPrefixStyle; }; /** The identifiers of a document that another document's content may link to. */ @@ -769,6 +776,16 @@ export class ProsemirrorHelper extends SharedProsemirrorHelper { // (e.g. Frame's iframe) commit before serialization, then rewriting. await this.flushReactEffects(); + // The heading prefix is a decoration in the editor, which the export + // renders without, so the labels are added to the output directly. + if (options?.headingPrefix) { + HeadingPrefixHelper.applyToDOM( + target as HTMLElement, + node, + options.headingPrefix + ); + } + // Components may render editable regions, such as captions, but the // exported document is static. for (const el of doc.querySelectorAll('[contenteditable="true"]')) { diff --git a/shared/editor/extensions/HeadingPrefix.ts b/shared/editor/extensions/HeadingPrefix.ts index 870d362f93..e41b980174 100644 --- a/shared/editor/extensions/HeadingPrefix.ts +++ b/shared/editor/extensions/HeadingPrefix.ts @@ -185,6 +185,40 @@ export class HeadingPrefixHelper { return new Slice(inject(slice.content), slice.openStart, slice.openEnd); } + /** + * Adds the prefix labels to the headings of a rendered document, matching + * the numbering displayed in the editor. Headings inside tables are skipped. + * + * @param container the element that holds the rendered document. + * @param doc the document the container was rendered from. + * @param style the prefix style to format the labels with. + */ + public static applyToDOM( + container: Element, + doc: ProsemirrorNode, + style: HeadingPrefixStyle + ): void { + if (style === HeadingPrefixStyle.None) { + return; + } + + const headings = HeadingPrefixHelper.collectHeadings(doc); + const queue = HeadingPrefixHelper.labels( + headings.map((heading) => heading.level), + style + ); + + container.querySelectorAll("h1, h2, h3, h4, h5, h6").forEach((heading) => { + if (heading.closest("table")) { + return; + } + const label = queue.shift(); + if (label !== undefined) { + heading.setAttribute("data-heading-prefix", label); + } + }); + } + /** * Removes prefix elements from pasted HTML so that copied numbering does * not become part of the document content. From 46cfa0c8d082ff88e3d2edd4d3bb8a75506cc12b Mon Sep 17 00:00:00 2001 From: Tom Moor <tom@getoutline.com> Date: Thu, 27 Aug 2026 16:09:55 -0400 Subject: [PATCH 021/181] fix: Keep OIDC provider identifier in sync with configured domain (#13574) --- plugins/oidc/server/auth/oidcRouter.ts | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/plugins/oidc/server/auth/oidcRouter.ts b/plugins/oidc/server/auth/oidcRouter.ts index a5e9e517c8..db936004a1 100644 --- a/plugins/oidc/server/auth/oidcRouter.ts +++ b/plugins/oidc/server/auth/oidcRouter.ts @@ -164,9 +164,25 @@ export function createOIDCRouter( // Derive a providerId from the OIDC location if there is no existing provider. const oidcURL = new URL(endpoints.authorizationURL); - const providerId = + let providerId = authenticationProvider?.providerId ?? oidcURL.hostname; + // The provider can move to a different domain, in which case the + // stored identifier must follow the configured location. + if (authenticationProvider && providerId !== oidcURL.hostname) { + try { + await authenticationProvider.update({ + providerId: oidcURL.hostname, + }); + providerId = oidcURL.hostname; + } catch (error) { + Logger.warn( + "Could not update OIDC authentication provider identifier", + { providerId, hostname: oidcURL.hostname, error } + ); + } + } + if (!domain) { throw OIDCMalformedUserInfoError(); } From ace35aaa7d2ea7b9737f5629adf885d8f155a20a Mon Sep 17 00:00:00 2001 From: Tom Moor <tom@getoutline.com> Date: Thu, 27 Aug 2026 16:10:13 -0400 Subject: [PATCH 022/181] fix: Sidebar context lost when navigating from action menus (#13566) Resolve the sidebar context from location state when no provider supplies one, and preserve it when leaving or deleting a revision from history. --- app/actions/definitions/revisions.tsx | 4 ++-- .../Sidebar/components/CollectionRow.tsx | 4 +++- app/components/Sidebar/components/DocumentRow.tsx | 1 + app/hooks/useActionContext.tsx | 15 +++++++++++++-- app/scenes/Document/hooks/useDocumentSidebar.tsx | 6 +++++- 5 files changed, 24 insertions(+), 6 deletions(-) diff --git a/app/actions/definitions/revisions.tsx b/app/actions/definitions/revisions.tsx index 96bff4050a..98b14fd1c8 100644 --- a/app/actions/definitions/revisions.tsx +++ b/app/actions/definitions/revisions.tsx @@ -94,7 +94,7 @@ export const deleteRevision = createAction({ dangerous: true, visible: ({ activeDocumentId }) => !!activeDocumentId && stores.policies.abilities(activeDocumentId).update, - perform: async ({ t, event, location, activeDocumentId }) => { + perform: async ({ t, event, location, activeDocumentId, sidebarContext }) => { event?.preventDefault(); if (!activeDocumentId) { return; @@ -113,7 +113,7 @@ export const deleteRevision = createAction({ const revision = stores.revisions.get(revisionId); await revision?.delete(); toast.success(t("This version of the document was deleted")); - history.push(documentHistoryPath(document)); + history.push(documentHistoryPath(document), { sidebarContext }); } }, }); diff --git a/app/components/Sidebar/components/CollectionRow.tsx b/app/components/Sidebar/components/CollectionRow.tsx index 93f943db96..b9680146aa 100644 --- a/app/components/Sidebar/components/CollectionRow.tsx +++ b/app/components/Sidebar/components/CollectionRow.tsx @@ -227,7 +227,9 @@ function CollectionRow({ ); return ( - <ActionContextProvider value={{ activeModels: [collection] }}> + <ActionContextProvider + value={{ activeModels: [collection], sidebarContext }} + > <Relative ref={mergedRef}> <DropToImport collectionId={collection.id}> {sidebarLinkElement} diff --git a/app/components/Sidebar/components/DocumentRow.tsx b/app/components/Sidebar/components/DocumentRow.tsx index 5e7b335799..ea64eb8773 100644 --- a/app/components/Sidebar/components/DocumentRow.tsx +++ b/app/components/Sidebar/components/DocumentRow.tsx @@ -284,6 +284,7 @@ function DocumentRow({ <ActionContextProvider value={{ activeModels: document ? [document] : [], + sidebarContext, }} > <Relative ref={parentRef}> diff --git a/app/hooks/useActionContext.tsx b/app/hooks/useActionContext.tsx index b9342e3e7f..46ec02b14e 100644 --- a/app/hooks/useActionContext.tsx +++ b/app/hooks/useActionContext.tsx @@ -67,7 +67,7 @@ export const ActionContextProvider = observer(function ActionContextProvider_({ // navigation does not invalidate the context value. Action perform/visible // callbacks see the current location at call time via history.location, // which react-router updates on every navigation. - const history = useHistory(); + const history = useHistory<{ sidebarContext?: SidebarContextType }>(); const { activeModels: valueModels, @@ -174,7 +174,6 @@ export const ActionContextProvider = observer(function ActionContextProvider_({ ...(isMenu !== undefined ? { isMenu } : {}), ...(isCommandBar !== undefined ? { isCommandBar } : {}), ...(isButton !== undefined ? { isButton } : {}), - ...(sidebarContext !== undefined ? { sidebarContext } : {}), ...(event !== undefined ? { event } : {}), activeCollectionId, activeDocumentId, @@ -193,6 +192,18 @@ export const ActionContextProvider = observer(function ActionContextProvider_({ configurable: true, }); + // The sidebar context is carried in location state, so fall back to the + // current location when no ancestor provider supplies one. A getter for the + // same reason as `location` above. + Object.defineProperty(result, "sidebarContext", { + get: () => + sidebarContext ?? + parentContext?.sidebarContext ?? + history.location.state?.sidebarContext, + enumerable: true, + configurable: true, + }); + return result; }, [ parentContext, diff --git a/app/scenes/Document/hooks/useDocumentSidebar.tsx b/app/scenes/Document/hooks/useDocumentSidebar.tsx index 6c033b0b4a..e1d5441280 100644 --- a/app/scenes/Document/hooks/useDocumentSidebar.tsx +++ b/app/scenes/Document/hooks/useDocumentSidebar.tsx @@ -119,13 +119,17 @@ export default function useDocumentSidebar() { ? documents.get(slugMatch.params.documentSlug) : undefined; if (document) { - paneHistory.push(documentPath(document)); + paneHistory.push({ + pathname: documentPath(document), + state: location.state, + }); } } }, [ panel, isHistoryRoute, location.pathname, + location.state, documents, paneHistory, ui, From 9dc74f445955a11e1d6b7f21e5e091a5040f6fc9 Mon Sep 17 00:00:00 2001 From: Tom Moor <tom@getoutline.com> Date: Thu, 27 Aug 2026 17:11:56 -0400 Subject: [PATCH 023/181] fix: Insert files dropped around the document at the nearest editor position (#13575) Dropping a file in the margins around a document previously did nothing. react-dnd's window level dragover handler forced dropEffect to "none" for any target outside of .ProseMirror, so the browser never dispatched a drop event there. --- app/components/Editor.tsx | 64 +-------------------- app/components/EditorAwareHTML5Backend.ts | 10 +++- app/editor/index.tsx | 60 ++++++++++++++++++- app/scenes/Document/components/Document.tsx | 34 +++++++++++ shared/editor/commands/insertFiles.ts | 2 +- shared/editor/queries/findNearestPos.ts | 31 ++++++++++ 6 files changed, 137 insertions(+), 64 deletions(-) create mode 100644 shared/editor/queries/findNearestPos.ts diff --git a/app/components/Editor.tsx b/app/components/Editor.tsx index b9b523cc4b..46353cb49a 100644 --- a/app/components/Editor.tsx +++ b/app/components/Editor.tsx @@ -1,22 +1,16 @@ import { difference } from "es-toolkit/compat"; import { observer } from "mobx-react"; -import { DOMParser as ProsemirrorDOMParser } from "prosemirror-model"; -import { TextSelection } from "prosemirror-state"; import * as React from "react"; import { useTranslation } from "react-i18next"; import { toast } from "sonner"; import { mergeRefs } from "react-merge-refs"; import type { Optional } from "utility-types"; -import insertFiles from "@shared/editor/commands/insertFiles"; import EditorContainer from "@shared/editor/components/Styles"; import { AttachmentPreset } from "@shared/types"; import { ProsemirrorHelper } from "@shared/utils/ProsemirrorHelper"; -import { getDataTransferFiles } from "@shared/utils/files"; -import { AttachmentValidation } from "@shared/validations"; import ClickablePadding from "~/components/ClickablePadding"; import ErrorBoundary from "~/components/ErrorBoundary"; import type { Props as EditorProps, Editor as SharedEditor } from "~/editor"; -import { toastNotice } from "~/editor/toastNotice"; import useCurrentUser from "~/hooks/useCurrentUser"; import useEditorClickHandlers from "~/hooks/useEditorClickHandlers"; import useEmbeds from "~/hooks/useEmbeds"; @@ -135,61 +129,9 @@ function Editor(props: Props, ref: React.RefObject<SharedEditor> | null) { }, [localRef]); const handleDrop = React.useCallback( - (event: React.DragEvent<HTMLDivElement>) => { - event.preventDefault(); - event.stopPropagation(); - const files = getDataTransferFiles(event); - - const view = localRef?.current?.view; - if (!view) { - return; - } - - // Find a valid position at the end of the document to insert our content - const pos = TextSelection.near( - view.state.doc.resolve(view.state.doc.nodeSize - 2) - ).from; - - // If there are no files in the drop event attempt to parse the html - // as a fragment and insert it at the end of the document - if (files.length === 0) { - const text = - event.dataTransfer.getData("text/html") || - event.dataTransfer.getData("text/plain"); - - const dom = new DOMParser().parseFromString(text, "text/html"); - - view.dispatch( - view.state.tr.insert( - pos, - ProsemirrorDOMParser.fromSchema(view.state.schema).parse(dom) - ) - ); - - return; - } - - // Insert all files as attachments if any of the files are not images. - const isAttachment = files.some( - (file) => !AttachmentValidation.imageContentTypes.includes(file.type) - ); - - return insertFiles(view, event, pos, files, { - uploadFile: handleUploadFile, - onFileUploadStart: handleFileUploadStart, - onFileUploadStop: handleFileUploadStop, - onFileUploadProgress: handleFileUploadProgress, - onNotice: toastNotice, - isAttachment, - }); - }, - [ - localRef, - handleFileUploadStart, - handleFileUploadStop, - handleFileUploadProgress, - handleUploadFile, - ] + (event: React.DragEvent<HTMLDivElement>) => + localRef.current?.insertDroppedContent(event), + [] ); // see: https://stackoverflow.com/a/50233827/192065 diff --git a/app/components/EditorAwareHTML5Backend.ts b/app/components/EditorAwareHTML5Backend.ts index 3322d22a19..b1924052d4 100644 --- a/app/components/EditorAwareHTML5Backend.ts +++ b/app/components/EditorAwareHTML5Backend.ts @@ -29,6 +29,14 @@ const topHandlerNames = [ const isWithinEditor = (target: EventTarget | null): boolean => target instanceof Element && Boolean(target.closest(".ProseMirror")); +// A file dragged over an element marked `data-drop-area`, which accepts native +// file drops itself. react-dnd never tracks these drags, so its handlers would +// otherwise reject them. +const isFileOverDropArea = (event: DragEvent): boolean => + Boolean(event.dataTransfer?.types.includes("Files")) && + event.target instanceof Element && + Boolean(event.target.closest("[data-drop-area]")); + /** * An HTML5 drag-and-drop backend that ignores drag events originating within the * rich text editor so that ProseMirror can handle them itself. @@ -57,7 +65,7 @@ export const EditorAwareHTML5Backend: BackendFactory = ( const original = handlers[name]; if (typeof original === "function") { handlers[name] = (event: DragEvent) => { - if (isWithinEditor(event.target)) { + if (isWithinEditor(event.target) || isFileOverDropArea(event)) { return; } // A drag that began or entered the page over the editor is never diff --git a/app/editor/index.tsx b/app/editor/index.tsx index d33096aa1d..06a201d204 100644 --- a/app/editor/index.tsx +++ b/app/editor/index.tsx @@ -9,7 +9,11 @@ import { gapCursor } from "prosemirror-gapcursor"; import type { InputRule } from "prosemirror-inputrules"; import { keymap } from "prosemirror-keymap"; import type { NodeSpec, MarkSpec } from "prosemirror-model"; -import { Schema, Node as ProsemirrorNode } from "prosemirror-model"; +import { + Schema, + Node as ProsemirrorNode, + DOMParser as ProsemirrorDOMParser, +} from "prosemirror-model"; import type { Plugin, Transaction } from "prosemirror-state"; import { EditorState, Selection, TextSelection } from "prosemirror-state"; import type { MarkdownParser } from "prosemirror-markdown"; @@ -36,6 +40,7 @@ import { inputRules } from "@shared/editor/lib/inputRules"; import type { MarkdownSerializer } from "@shared/editor/lib/markdown/serializer"; import { isRemoteTransaction } from "@shared/editor/lib/multiplayer"; import textBetween from "@shared/editor/lib/textBetween"; +import { findNearestPos } from "@shared/editor/queries/findNearestPos"; import { basicExtensions as extensions } from "@shared/editor/nodes"; import type ReactNode from "@shared/editor/nodes/ReactNode"; import type { @@ -52,6 +57,8 @@ import { HeadingPrefixStyle } from "@shared/types"; import { headingPrefixPluginKey } from "@shared/editor/extensions/HeadingPrefix"; import { ProsemirrorHelper } from "@shared/utils/ProsemirrorHelper"; import EventEmitter from "@shared/utils/events"; +import { getDataTransferFiles } from "@shared/utils/files"; +import { AttachmentValidation } from "@shared/validations"; import type Document from "~/models/Document"; import Flex from "~/components/Flex"; import { PortalContext } from "~/components/Portal"; @@ -745,6 +752,57 @@ export class Editor extends React.PureComponent< this.props ); + /** + * Insert the content of a drop event at the position nearest to where it + * occurred. Intended for drops that land outside of the editor itself. + * + * @param event The drop event. + */ + public insertDroppedContent = (event: React.DragEvent<HTMLElement>) => { + const { view } = this; + if (!view.editable) { + return; + } + + event.preventDefault(); + event.stopPropagation(); + + const pos = findNearestPos(view, { + left: event.clientX, + top: event.clientY, + }); + const files = getDataTransferFiles(event); + + // Without files, attempt to parse the payload as an HTML fragment. + if (files.length === 0) { + const text = + event.dataTransfer.getData("text/html") || + event.dataTransfer.getData("text/plain"); + if (!text) { + return; + } + + const dom = new DOMParser().parseFromString(text, "text/html"); + view.dispatch( + view.state.tr.insert( + pos, + ProsemirrorDOMParser.fromSchema(view.state.schema).parse(dom) + ) + ); + return; + } + + // Insert all files as attachments if any of the files are not images. + const isAttachment = files.some( + (file) => !AttachmentValidation.imageContentTypes.includes(file.type) + ); + + return insertFiles(view, event, pos, files, { + ...this.props, + isAttachment, + }); + }; + /** * Returns true if the trimmed content of the editor is an empty string. * diff --git a/app/scenes/Document/components/Document.tsx b/app/scenes/Document/components/Document.tsx index 90299bed8b..7f8884b08c 100644 --- a/app/scenes/Document/components/Document.tsx +++ b/app/scenes/Document/components/Document.tsx @@ -206,6 +206,37 @@ function DocumentScene({ [readOnly, abilities.update, history, document, sidebarContext] ); + // Files dropped in the margins around the document are inserted at the + // closest point in the editor, rather than being ignored by the browser. + const isFileDrag = useCallback( + (event: React.DragEvent<HTMLElement>) => + !readOnly && !revision && event.dataTransfer.types.includes("Files"), + [readOnly, revision] + ); + + const handleDragOver = useCallback( + (event: React.DragEvent<HTMLElement>) => { + if (isFileDrag(event)) { + event.dataTransfer.dropEffect = "copy"; + event.preventDefault(); + } + }, + [isFileDrag] + ); + + const handleDrop = useCallback( + (event: React.DragEvent<HTMLElement>) => { + // A drop that landed inside the editor has already been handled. + if (event.defaultPrevented || !isFileDrag(event)) { + return; + } + // Prevent the browser from navigating to the file if it cannot be added. + event.preventDefault(); + void editorRef.current?.insertDroppedContent(event); + }, + [isFileDrag] + ); + const goToHistory = useCallback( (ev: KeyboardEvent) => { if (!readOnly) { @@ -315,6 +346,9 @@ function DocumentScene({ key={revision ? revision.id : document.id} column auto + onDragOver={handleDragOver} + onDrop={handleDrop} + data-drop-area > <PageTitle title={pageTitle} favicon={favicon} /> {(isUploading || isSaving) && <LoadingIndicator />} diff --git a/shared/editor/commands/insertFiles.ts b/shared/editor/commands/insertFiles.ts index c472017262..6aa0495e9e 100644 --- a/shared/editor/commands/insertFiles.ts +++ b/shared/editor/commands/insertFiles.ts @@ -48,7 +48,7 @@ const insertFiles = async function ( event: | Event | React.ChangeEvent<HTMLInputElement> - | React.DragEvent<HTMLDivElement>, + | React.DragEvent<HTMLElement>, pos: number, files: File[], options: Options diff --git a/shared/editor/queries/findNearestPos.ts b/shared/editor/queries/findNearestPos.ts new file mode 100644 index 0000000000..7c84121e53 --- /dev/null +++ b/shared/editor/queries/findNearestPos.ts @@ -0,0 +1,31 @@ +import { clamp } from "es-toolkit"; +import { TextSelection } from "prosemirror-state"; +import type { EditorView } from "prosemirror-view"; + +/** + * Find the position in the document nearest to the given viewport coordinates. + * Unlike `posAtCoords`, coordinates that fall outside of the editor are clamped + * to its bounds so that a position is always returned. + * + * @param view the editor view. + * @param coords the viewport coordinates. + * @returns a position in the document that a selection can be placed at. + */ +export function findNearestPos( + view: EditorView, + coords: { left: number; top: number } +): number { + const { doc } = view.state; + const rect = view.dom.getBoundingClientRect(); + const top = clamp(coords.top, rect.top + 1, rect.bottom - 1); + const result = + view.posAtCoords({ + left: clamp(coords.left, rect.left + 1, rect.right - 1), + top, + }) ?? + // The clamped point can still land in the space between two blocks, in + // which case fall back to the start of the nearest line. + view.posAtCoords({ left: rect.left + 1, top }); + + return TextSelection.near(doc.resolve(result?.pos ?? doc.nodeSize - 2)).from; +} From a7aac841cfb6501407d5098522bcdebb7c0a162c Mon Sep 17 00:00:00 2001 From: Tom Moor <tom@getoutline.com> Date: Thu, 27 Aug 2026 17:35:21 -0400 Subject: [PATCH 024/181] chore: Vendorize `y-indexeddb` persistence (#12918) * chore: Vendorize y-indexeddb persistence Replaces the y-indexeddb dependency with a small typed module in app/utils/IndexeddbPersistence.ts so we have full control over the underlying database rows. The IndexedDB schema is unchanged and remains compatible with databases created by y-indexeddb, so existing local caches continue to work. Differences from upstream: - Promise-based API (whenSynced) instead of the lib0 Observable events, which simplifies MultiplayerEditor and lets it handle environments where IndexedDB exists but cannot be opened (e.g. Firefox private browsing) by falling back to no local persistence. - Skips writing an empty state row every time a document is opened. - Exposes a public compact() to merge all rows into one on demand. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XYncL4PQ5jaEeMBNgjRzf9 * chore: Remove persistence tests and fake-indexeddb dependency Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XYncL4PQ5jaEeMBNgjRzf9 * chore: Make trim size a private class member, drop unused custom store Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XYncL4PQ5jaEeMBNgjRzf9 * fix: Guard async persistence callbacks against post-cleanup state updates Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XYncL4PQ5jaEeMBNgjRzf9 * Added onversionchange handler --------- Co-authored-by: Claude <noreply@anthropic.com> --- .../Document/components/MultiplayerEditor.tsx | 30 ++- app/utils/IndexeddbPersistence.ts | 234 ++++++++++++++++++ package.json | 1 - vite.config.ts | 2 +- yarn.lock | 14 +- 5 files changed, 258 insertions(+), 23 deletions(-) create mode 100644 app/utils/IndexeddbPersistence.ts diff --git a/app/scenes/Document/components/MultiplayerEditor.tsx b/app/scenes/Document/components/MultiplayerEditor.tsx index a6733f7966..5dd095e824 100644 --- a/app/scenes/Document/components/MultiplayerEditor.tsx +++ b/app/scenes/Document/components/MultiplayerEditor.tsx @@ -13,7 +13,6 @@ import { import { useTranslation } from "react-i18next"; import { useHistory } from "react-router-dom"; import { toast } from "sonner"; -import { IndexeddbPersistence } from "y-indexeddb"; import * as Y from "yjs"; import { EditorUpdateError } from "@shared/collaboration/CloseEvents"; import History from "@shared/editor/extensions/History"; @@ -31,6 +30,7 @@ import useIsMounted from "~/hooks/useIsMounted"; import usePageVisibility from "~/hooks/usePageVisibility"; import useStores from "~/hooks/useStores"; import type { AwarenessChangeEvent } from "~/types"; +import { IndexeddbPersistence } from "~/utils/IndexeddbPersistence"; import Logger from "~/utils/Logger"; import { homePath } from "~/utils/routeHelpers"; import { sleep } from "@shared/utils/timers"; @@ -82,6 +82,9 @@ function MultiplayerEditor( // an orphaned websocket connection. // see: https://github.com/facebook/react/issues/20090#issuecomment-715926549 useLayoutEffect(() => { + // Tracks whether this effect has been cleaned up so async persistence + // callbacks below do not update state afterwards. + let isActive = true; const debug = env.ENVIRONMENT === "development"; const name = `document.${documentId}`; const localProvider = @@ -172,10 +175,23 @@ function MultiplayerEditor( }; provider.on("awarenessChange", showCursorNames); - localProvider?.on("synced", () => - // only set local storage to "synced" if it's loaded a non-empty doc - setLocalSynced(!!ydoc.get("default")._start) - ); + localProvider?.whenSynced + .then(() => { + if (!isActive || !localProvider.synced) { + return; + } + if (debug) { + Logger.debug("collaboration", "local synced"); + } + // only set local storage to "synced" if it's loaded a non-empty doc + setLocalSynced(!!ydoc.get("default")._start); + }) + .catch(() => { + // IndexedDB exists but is unusable, e.g. Firefox private browsing. + if (isActive) { + setHasLocalPersistence(false); + } + }); provider.on("synced", () => { presence.touch(documentId, currentUser.id, false); setRemoteSynced(true); @@ -211,9 +227,6 @@ function MultiplayerEditor( message: ev.message, }) ); - localProvider?.on("synced", () => - Logger.debug("collaboration", "local synced") - ); } provider.on("status", (ev: ConnectionStatusEvent) => { @@ -225,6 +238,7 @@ function MultiplayerEditor( setRemoteProvider(provider); return () => { + isActive = false; window.removeEventListener("click", finishObserving); window.removeEventListener("wheel", finishObserving); window.removeEventListener("scroll", syncScrollPosition); diff --git a/app/utils/IndexeddbPersistence.ts b/app/utils/IndexeddbPersistence.ts new file mode 100644 index 0000000000..7d64223ac1 --- /dev/null +++ b/app/utils/IndexeddbPersistence.ts @@ -0,0 +1,234 @@ +import * as Y from "yjs"; + +/** + * Persists a Y.Doc to IndexedDB so documents can be loaded instantly from the + * local cache and edited offline. + * + * Adapted from y-indexeddb (https://github.com/yjs/y-indexeddb, MIT licensed) + * so that we have full control over the underlying database rows. The schema + * is kept compatible with databases created by y-indexeddb: one database per + * document containing an "updates" object store where each row is a binary + * Yjs update keyed by an auto-incrementing integer. Rows are periodically + * compacted into a single row holding the whole document state. + */ +export class IndexeddbPersistence { + /** Name of the IndexedDB database that backs this instance. */ + public readonly name: string; + + /** The Y.Doc that is being persisted. */ + public readonly doc: Y.Doc; + + /** Whether the state stored in the database has been applied to the document. */ + public synced = false; + + /** + * Resolves once the state stored in the database has been applied to the + * document, or immediately if the instance is destroyed beforehand – check + * `synced` to distinguish the two. + */ + public readonly whenSynced: Promise<IndexeddbPersistence>; + + /** + * @param name Name of the database, unique per persisted document. + * @param doc The Y.Doc to persist. + */ + constructor(name: string, doc: Y.Doc) { + this.name = name; + this.doc = doc; + this.dbPromise = openDatabase(name); + + this.whenSynced = this.dbPromise.then(async (db) => { + this.db = db; + await this.fetchStoredUpdates(true); + + if (!this.destroyed) { + this.synced = true; + } + return this; + }); + + doc.on("update", this.handleDocUpdate); + doc.on("destroy", this.destroy); + } + + /** + * Merges all stored update rows into a single row containing the current + * document state. + * + * @returns a promise that resolves when compaction has completed. + */ + public compact(): Promise<void> { + return this.storeState(true); + } + + /** + * Stops persisting the document and closes the database connection. Data + * already stored is left intact. + * + * @returns a promise that resolves when the database has been closed. + */ + public destroy = (): Promise<void> => { + if (this.destroyed) { + return Promise.resolve(); + } + this.destroyed = true; + + if (this.storeTimeoutId !== undefined) { + clearTimeout(this.storeTimeoutId); + this.storeTimeoutId = undefined; + } + + this.doc.off("update", this.handleDocUpdate); + this.doc.off("destroy", this.destroy); + + return this.dbPromise.then( + (db) => db.close(), + () => undefined + ); + }; + + private dbPromise: Promise<IDBDatabase>; + + private db: IDBDatabase | null = null; + + /** Key of the first update row that has not been applied to the document. */ + private dbref = 0; + + /** Approximate number of rows in the updates store. */ + private dbsize = 0; + + private destroyed = false; + + /** + * Number of stored updates after which they are merged into a single + * database row containing the entire document state, keeping loads fast. + */ + private preferredTrimSize = 500; + + /** Time in ms to debounce compaction once the trim size is reached. */ + private storeTimeout = 1000; + + private storeTimeoutId?: ReturnType<typeof setTimeout>; + + /** + * Appends every local document update as a new row, and schedules a + * compaction once the number of rows grows beyond the preferred trim size. + */ + private handleDocUpdate = (update: Uint8Array, origin: unknown) => { + if (!this.db || origin === this || this.destroyed) { + return; + } + + this.updatesStore(this.db).add(update); + + if (++this.dbsize >= this.preferredTrimSize) { + if (this.storeTimeoutId !== undefined) { + clearTimeout(this.storeTimeoutId); + } + this.storeTimeoutId = setTimeout(() => { + this.storeTimeoutId = undefined; + void this.storeState(false); + }, this.storeTimeout); + } + }; + + /** + * Applies all rows stored since the last read to the document – on first + * call this loads the document, on later calls it picks up rows written by + * other tabs. When `storeCurrentState` is set, any state already in the + * document is written as a new row so it cannot be lost. + * + * @returns the object store, still inside the read-write transaction. + */ + private async fetchStoredUpdates( + storeCurrentState = false + ): Promise<IDBObjectStore | undefined> { + if (!this.db) { + return undefined; + } + const store = this.updatesStore(this.db); + const updates: Uint8Array[] = await requestToPromise( + store.getAll(IDBKeyRange.lowerBound(this.dbref, false)) + ); + + if (!this.destroyed) { + if (storeCurrentState && this.doc.store.clients.size > 0) { + store.add(Y.encodeStateAsUpdate(this.doc)); + } + Y.transact( + this.doc, + () => updates.forEach((update) => Y.applyUpdate(this.doc, update)), + this, + false + ); + } + + const lastKeyPromise = getLastKey(store); + const countPromise = requestToPromise(store.count()); + this.dbref = (await lastKeyPromise) + 1; + this.dbsize = await countPromise; + return store; + } + + /** + * Writes the whole document state as a single row and deletes the rows it + * replaces. Unless `force` is set, this only happens once the number of + * rows has grown beyond the preferred trim size. + */ + private async storeState(force: boolean): Promise<void> { + const store = await this.fetchStoredUpdates(); + + if (!store || this.destroyed) { + return; + } + if (force || this.dbsize >= this.preferredTrimSize) { + store.add(Y.encodeStateAsUpdate(this.doc)); + store.delete(IDBKeyRange.upperBound(this.dbref, true)); + this.dbsize = await requestToPromise(store.count()); + } + } + + private updatesStore(db: IDBDatabase): IDBObjectStore { + return db + .transaction(updatesStoreName, "readwrite") + .objectStore(updatesStoreName); + } +} + +const updatesStoreName = "updates"; + +function requestToPromise<T>(request: IDBRequest<T>): Promise<T> { + return new Promise((resolve, reject) => { + request.onsuccess = () => resolve(request.result); + request.onerror = () => reject(request.error); + }); +} + +function openDatabase(name: string): Promise<IDBDatabase> { + return new Promise((resolve, reject) => { + const request = indexedDB.open(name); + request.onupgradeneeded = () => { + const db = request.result; + if (!db.objectStoreNames.contains(updatesStoreName)) { + db.createObjectStore(updatesStoreName, { autoIncrement: true }); + } + }; + request.onsuccess = () => { + const db = request.result; + // Close the connection when another context deletes or upgrades the + // database, otherwise their request would block indefinitely. + db.onversionchange = () => db.close(); + resolve(db); + }; + request.onerror = () => reject(request.error); + }); +} + +function getLastKey(store: IDBObjectStore): Promise<number> { + return new Promise((resolve, reject) => { + const request = store.openKeyCursor(null, "prev"); + request.onsuccess = () => + resolve(request.result ? Number(request.result.key) : -1); + request.onerror = () => reject(request.error); + }); +} diff --git a/package.json b/package.json index 567ac96957..bf258decfe 100644 --- a/package.json +++ b/package.json @@ -274,7 +274,6 @@ "vite-plugin-pwa": "1.3.0", "winston": "^3.17.0", "ws": "^7.5.11", - "y-indexeddb": "^9.0.12", "y-prosemirror": "^1.3.7", "y-protocols": "^1.0.7", "yauzl": "^3.3.1", diff --git a/vite.config.ts b/vite.config.ts index 70ef306888..1498a81502 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -229,7 +229,7 @@ export default ({ mode }: ConfigEnv) => }, { name: "vendor-collab", - test: /node_modules[\\/](yjs|y-prosemirror|y-indexeddb|@hocuspocus|lib0)/, + test: /node_modules[\\/](yjs|y-prosemirror|@hocuspocus|lib0)/, priority: 20, }, { diff --git a/yarn.lock b/yarn.lock index 58cc82fe9f..84d551a4f3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -14065,7 +14065,7 @@ __metadata: languageName: node linkType: hard -"lib0@npm:^0.2.109, lib0@npm:^0.2.46, lib0@npm:^0.2.47, lib0@npm:^0.2.74, lib0@npm:^0.2.85, lib0@npm:^0.2.99": +"lib0@npm:^0.2.109, lib0@npm:^0.2.46, lib0@npm:^0.2.47, lib0@npm:^0.2.85, lib0@npm:^0.2.99": version: 0.2.114 resolution: "lib0@npm:0.2.114" dependencies: @@ -15974,7 +15974,6 @@ __metadata: vitest: "npm:^4.1.10" winston: "npm:^3.17.0" ws: "npm:^7.5.11" - y-indexeddb: "npm:^9.0.12" y-prosemirror: "npm:^1.3.7" y-protocols: "npm:^1.0.7" yauzl: "npm:^3.3.1" @@ -21533,17 +21532,6 @@ __metadata: languageName: node linkType: hard -"y-indexeddb@npm:^9.0.12": - version: 9.0.12 - resolution: "y-indexeddb@npm:9.0.12" - dependencies: - lib0: "npm:^0.2.74" - peerDependencies: - yjs: ^13.0.0 - checksum: 10c0/b31fbc12ef4a7d71f09212db02570af07c6a17b02537ce4cbb29f0549137adcbebf613cb2af63fa1d13e0932645be0293a4e7189cb5bf5dc6263cf2f72b65004 - languageName: node - linkType: hard - "y-prosemirror@npm:^1.3.7": version: 1.3.7 resolution: "y-prosemirror@npm:1.3.7" From 1ed8ca2b78b3a794c9ceee51a9c9d40c7b585f75 Mon Sep 17 00:00:00 2001 From: chenniannian90 <1028630307@qq.com> Date: Fri, 28 Aug 2026 05:39:59 +0800 Subject: [PATCH 025/181] fix(History): show revision author in meta when viewing a revision (#13571) The revision branch of DocumentMeta keys the "You updated" case off revision.createdBy, but the displayed name falls back to the document's current updatedBy. Viewing a revision created by another user therefore attributes it to whoever last edited the document, next to the revision's own timestamp. Display revision.createdBy's name instead, falling back to "Unknown" when the author is unavailable, matching the existing deletedBy handling. Fixes #13570 Co-authored-by: Claude <noreply@anthropic.com> --- app/components/DocumentMeta.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/components/DocumentMeta.tsx b/app/components/DocumentMeta.tsx index f9e5413f2c..8e0180938d 100644 --- a/app/components/DocumentMeta.tsx +++ b/app/components/DocumentMeta.tsx @@ -86,7 +86,9 @@ const DocumentMeta: React.FC<Props> = ({ <span> {revision.createdBy?.id === user.id ? t("You updated") - : t("{{ userName }} updated", { userName })}{" "} + : t("{{ userName }} updated", { + userName: revision.createdBy?.name ?? t("Unknown"), + })}{" "} <Time dateTime={revision.createdAt} addSuffix /> </span> ); From f49b047648ea9d2ece1630485ff883d9eae2dadb Mon Sep 17 00:00:00 2001 From: Tom Moor <tom@getoutline.com> Date: Thu, 27 Aug 2026 17:42:28 -0400 Subject: [PATCH 026/181] feat: Convert @ prefixed Markdown links to mentions on server writes (#13403) * checkpoint * feat: Convert @ prefixed links to mentions on server Markdown writes A Markdown link preceded by "@" now becomes a mention when brought in through the documents API, MCP, or an import, so an exported mention survives a round trip instead of degrading to a plain link. The editor rule creates a generic mention carrying the href, and the type of resource it points at is resolved by the plugin that recognizes the URL through a new MentionProvider hook. Mentions of external resources also serialize to their real URL rather than a mention:// URI, so the reference resolves outside of Outline. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * fix: Escape values interpolated into rendered mention HTML markdown-it leaves markup in a link label intact when html is disabled, so the label and attributes are escaped before being written into the tag. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> --- plugins/github/server/index.ts | 5 ++ plugins/github/shared/GitHubUtils.ts | 24 ++++++ plugins/gitlab/server/index.ts | 7 ++ plugins/gitlab/shared/GitLabUtils.ts | 28 ++++++- plugins/linear/server/index.ts | 5 ++ plugins/linear/shared/LinearUtils.ts | 22 +++++ server/editor/index.ts | 5 +- server/editor/rules/mentions.test.ts | 72 ++++++++++++++++ server/editor/rules/mentions.ts | 55 +++++++++++++ .../models/helpers/ProseMirrorHelper.test.ts | 65 ++++++++++++++- server/types.ts | 8 ++ server/utils/PluginManager.ts | 8 +- shared/editor/nodes/Mention.test.ts | 25 ++++-- shared/editor/nodes/Mention.tsx | 29 ++++++- shared/editor/rules/mention.test.ts | 54 ++++++++++++ shared/editor/rules/mention.ts | 82 +++++++++++++++---- 16 files changed, 464 insertions(+), 30 deletions(-) create mode 100644 server/editor/rules/mentions.test.ts create mode 100644 server/editor/rules/mentions.ts diff --git a/plugins/github/server/index.ts b/plugins/github/server/index.ts index 1c47fbac26..68f31193a9 100644 --- a/plugins/github/server/index.ts +++ b/plugins/github/server/index.ts @@ -1,6 +1,7 @@ import { Minute } from "@shared/utils/time"; import { PluginManager, Hook } from "@server/utils/PluginManager"; import config from "../plugin.json"; +import { GitHubUtils } from "../shared/GitHubUtils"; import { GitHubIssueProvider } from "./GitHubIssueProvider"; import router from "./api/github"; import env from "./env"; @@ -34,6 +35,10 @@ if (enabled) { type: Hook.UnfurlProvider, value: { unfurl: GitHub.unfurl, cacheExpiry: Minute.seconds }, }, + { + type: Hook.MentionProvider, + value: (url: URL) => GitHubUtils.mentionType(url), + }, { type: Hook.Uninstall, value: uninstall, diff --git a/plugins/github/shared/GitHubUtils.ts b/plugins/github/shared/GitHubUtils.ts index 0b9a70aa7a..dffc2e390e 100644 --- a/plugins/github/shared/GitHubUtils.ts +++ b/plugins/github/shared/GitHubUtils.ts @@ -1,5 +1,6 @@ import queryString from "query-string"; import env from "@shared/env"; +import { MentionType } from "@shared/types"; import { integrationSettingsPath } from "@shared/utils/routeHelpers"; export const GitHubOAuthNonceCookie = "githubOAuthNonce"; @@ -60,6 +61,29 @@ export class GitHubUtils { return `${this.url}?install_request=true`; } + /** + * Determines the type of mention a GitHub URL represents. + * + * @param url the URL to evaluate. + * @returns the mention type, or undefined if this is not a GitHub URL for a + * resource that can be mentioned. + */ + public static mentionType(url: URL): MentionType | undefined { + if (url.hostname !== "github.com") { + return undefined; + } + + const type = url.pathname.split("/")[3]; + + return type === "pull" + ? MentionType.PullRequest + : type === "issues" + ? MentionType.Issue + : type === "projects" + ? MentionType.Project + : undefined; + } + public static getColorForStatus(status: string, isDraftPR: boolean = false) { switch (status) { case "open": diff --git a/plugins/gitlab/server/index.ts b/plugins/gitlab/server/index.ts index c4f9c11d09..b98988445e 100644 --- a/plugins/gitlab/server/index.ts +++ b/plugins/gitlab/server/index.ts @@ -1,6 +1,7 @@ import { Minute } from "@shared/utils/time"; import { PluginManager, Hook } from "@server/utils/PluginManager"; import config from "../plugin.json"; +import { GitLabUtils } from "../shared/GitLabUtils"; import { GitLabIssueProvider } from "./GitLabIssueProvider"; import router from "./api/gitlab"; import { GitLab } from "./gitlab"; @@ -20,6 +21,12 @@ PluginManager.add([ type: Hook.UnfurlProvider, value: { unfurl: GitLab.unfurl, cacheExpiry: Minute.seconds }, }, + { + // Only the public host is recognized here, a self-hosted instance is not + // known without the settings of a connected integration. + type: Hook.MentionProvider, + value: (url: URL) => GitLabUtils.mentionType(url), + }, { type: Hook.Task, value: GitLabWebhookTask, diff --git a/plugins/gitlab/shared/GitLabUtils.ts b/plugins/gitlab/shared/GitLabUtils.ts index 4834960652..a37e83a774 100644 --- a/plugins/gitlab/shared/GitLabUtils.ts +++ b/plugins/gitlab/shared/GitLabUtils.ts @@ -1,6 +1,6 @@ import env from "@shared/env"; import { integrationSettingsPath } from "@shared/utils/routeHelpers"; -import { UnfurlResourceType } from "@shared/types"; +import { MentionType, UnfurlResourceType } from "@shared/types"; export const GitLabOAuthNonceCookie = "gitlabOAuthNonce"; @@ -244,6 +244,32 @@ export class GitLabUtils { } } + /** + * Determines the type of mention a GitLab URL represents. + * + * @param url the URL to evaluate. + * @param customUrl optional custom GitLab URL from integration settings. + * @returns the mention type, or undefined if this is not a GitLab URL for a + * resource that can be mentioned. + */ + public static mentionType( + url: URL, + customUrl?: string + ): MentionType | undefined { + const parsed = this.parseUrl(url.toString(), customUrl); + + switch (parsed?.type) { + case UnfurlResourceType.PR: + return MentionType.PullRequest; + case UnfurlResourceType.Issue: + return MentionType.Issue; + case UnfurlResourceType.Project: + return MentionType.Project; + default: + return undefined; + } + } + /** * Checks if the first path segment is a known GitLab system path. * diff --git a/plugins/linear/server/index.ts b/plugins/linear/server/index.ts index 9b533dcbaa..69c62b065d 100644 --- a/plugins/linear/server/index.ts +++ b/plugins/linear/server/index.ts @@ -1,6 +1,7 @@ import { Minute } from "@shared/utils/time"; import { Hook, PluginManager } from "@server/utils/PluginManager"; import config from "../plugin.json"; +import { LinearUtils } from "../shared/LinearUtils"; import router from "./api/linear"; import env from "./env"; import { Linear } from "./linear"; @@ -24,6 +25,10 @@ if (enabled) { type: Hook.UnfurlProvider, value: { unfurl: Linear.unfurl, cacheExpiry: Minute.seconds }, }, + { + type: Hook.MentionProvider, + value: (url: URL) => LinearUtils.mentionType(url), + }, { type: Hook.Uninstall, value: uninstall, diff --git a/plugins/linear/shared/LinearUtils.ts b/plugins/linear/shared/LinearUtils.ts index 6c2e3f1b13..e362805675 100644 --- a/plugins/linear/shared/LinearUtils.ts +++ b/plugins/linear/shared/LinearUtils.ts @@ -1,5 +1,6 @@ import queryString from "query-string"; import env from "@shared/env"; +import { MentionType } from "@shared/types"; import { integrationSettingsPath } from "@shared/utils/routeHelpers"; export const LinearOAuthNonceCookie = "linearOAuthNonce"; @@ -26,6 +27,27 @@ export class LinearUtils { } } + /** + * Determines the type of mention a Linear URL represents. + * + * @param url the URL to evaluate. + * @returns the mention type, or undefined if this is not a Linear URL for a + * resource that can be mentioned. + */ + public static mentionType(url: URL): MentionType | undefined { + if (url.hostname !== "linear.app") { + return undefined; + } + + const type = url.pathname.split("/")[2]; + + return type === "issue" + ? MentionType.Issue + : type === "project" + ? MentionType.Project + : undefined; + } + static successUrl() { return this.settingsUrl; } diff --git a/server/editor/index.ts b/server/editor/index.ts index c66728ef0b..57a1f9d721 100644 --- a/server/editor/index.ts +++ b/server/editor/index.ts @@ -13,6 +13,7 @@ import { import CodeBlock from "@shared/editor/nodes/CodeBlock"; import CodeFence from "@shared/editor/nodes/CodeFence"; import Mention from "@shared/editor/nodes/Mention"; +import mentionRules from "./rules/mentions"; populateEmojiData(data as EmojiMartData); @@ -43,7 +44,7 @@ for (const extension of extensionManager.extensions) { export const parser = extensionManager.parser({ schema, - plugins: extensionManager.rulePlugins, + plugins: [...extensionManager.rulePlugins, mentionRules], }); export const serializer = extensionManager.serializer(); @@ -80,5 +81,5 @@ for (const extension of commentExtensionManager.extensions) { export const commentParser = commentExtensionManager.parser({ schema: commentSchema, - plugins: commentExtensionManager.rulePlugins, + plugins: [...commentExtensionManager.rulePlugins, mentionRules], }); diff --git a/server/editor/rules/mentions.test.ts b/server/editor/rules/mentions.test.ts new file mode 100644 index 0000000000..2630d74256 --- /dev/null +++ b/server/editor/rules/mentions.test.ts @@ -0,0 +1,72 @@ +import type { Node } from "prosemirror-model"; +import { MentionType } from "@shared/types"; +import { parser } from ".."; + +function firstMention(markdown: string): Node | undefined { + const doc = parser.parse(markdown); + let mention: Node | undefined; + + doc?.descendants((node: Node) => { + if (!mention && node.type.name === "mention") { + mention = node; + } + }); + + return mention; +} + +describe("mention type rule", () => { + it("should resolve a GitHub issue link", () => { + const mention = firstMention( + "@[Fix parser](https://github.com/acme/infra/issues/2)" + ); + + expect(mention?.attrs.type).toBe(MentionType.Issue); + expect(mention?.attrs.href).toBe("https://github.com/acme/infra/issues/2"); + expect(mention?.attrs.label).toBe("Fix parser"); + }); + + it("should resolve a GitHub pull request link", () => { + const mention = firstMention( + "@[Add parser](https://github.com/acme/infra/pull/5)" + ); + + expect(mention?.attrs.type).toBe(MentionType.PullRequest); + }); + + it("should resolve a GitHub project link", () => { + const mention = firstMention( + "@[Roadmap](https://github.com/orgs/acme/projects/1)" + ); + + expect(mention?.attrs.type).toBe(MentionType.Project); + }); + + it("should leave a GitHub link to an unmentionable resource generic", () => { + const mention = firstMention("@[Repo](https://github.com/acme/infra)"); + + expect(mention?.attrs.type).toBe(MentionType.URL); + }); + + it("should leave a link no plugin recognizes generic", () => { + const mention = firstMention("@[Example](https://example.com/page)"); + + expect(mention?.attrs.type).toBe(MentionType.URL); + expect(mention?.attrs.href).toBe("https://example.com/page"); + }); + + it("should not affect mention:// links", () => { + const mention = firstMention( + "@[John Doe](mention://a1b2c3d4-e5f6-7890-abcd-ef1234567890/user/f0e1d2c3-b4a5-6789-0abc-def123456789)" + ); + + expect(mention?.attrs.type).toBe(MentionType.User); + expect(mention?.attrs.href).toBeUndefined(); + }); + + it("should not convert a link without an @ prefix", () => { + expect( + firstMention("[Fix parser](https://github.com/acme/infra/issues/2)") + ).toBeUndefined(); + }); +}); diff --git a/server/editor/rules/mentions.ts b/server/editor/rules/mentions.ts new file mode 100644 index 0000000000..9d4f53ec3f --- /dev/null +++ b/server/editor/rules/mentions.ts @@ -0,0 +1,55 @@ +import type MarkdownIt from "markdown-it"; +import type StateCore from "markdown-it/lib/rules_core/state_core.mjs"; +import { Hook, PluginManager } from "@server/utils/PluginManager"; + +/** + * Narrows the generic mentions produced for external links to the resource + * they point at, by asking each plugin whether it recognizes the URL. + * + * @param state the markdown-it parser state. + */ +function resolveMentionTypes(state: StateCore) { + const providers = PluginManager.getHooks(Hook.MentionProvider); + if (!providers.length) { + return; + } + + for (const token of state.tokens) { + if (token.type !== "inline" || !token.children) { + continue; + } + + for (const child of token.children) { + const href = child.type === "mention" ? child.attrGet("href") : null; + if (!href) { + continue; + } + + let url: URL; + try { + url = new URL(href); + } catch { + continue; + } + + for (const provider of providers) { + const type = provider.value(url); + if (type) { + child.attrSet("type", type); + break; + } + } + } + } +} + +/** + * Markdown-it plugin that resolves the type of mentions created from external + * links. It is only applied to parsers on the server, where the plugins that + * recognize a URL are registered. + * + * @param md the markdown-it instance. + */ +export default function mentions(md: MarkdownIt) { + md.core.ruler.after("mention", "mention_type", resolveMentionTypes); +} diff --git a/server/models/helpers/ProseMirrorHelper.test.ts b/server/models/helpers/ProseMirrorHelper.test.ts index b89ec2821c..005ac55049 100644 --- a/server/models/helpers/ProseMirrorHelper.test.ts +++ b/server/models/helpers/ProseMirrorHelper.test.ts @@ -7,7 +7,7 @@ import type { ProsemirrorData } from "@shared/types"; import { MentionType } from "@shared/types"; import { ProsemirrorHelper as SharedProsemirrorHelper } from "@shared/utils/ProsemirrorHelper"; import { createContext } from "@server/context"; -import { parser, schema } from "@server/editor"; +import { parser, schema, serializer } from "@server/editor"; import env from "@server/env"; import { Attachment } from "@server/models"; import { buildProseMirrorDoc, buildUser } from "@server/test/factories"; @@ -1055,6 +1055,69 @@ describe("ProsemirrorHelper", () => { expect(thirdItem.attrs.checked).toBe(true); expect(thirdItem.textContent).toBe("Third"); }); + + it("should convert an @ prefixed GitHub link to an issue mention", () => { + const markdown = + "Please review @[Fix parser](https://github.com/acme/infra/issues/2)"; + + const doc = ProsemirrorHelper.toProsemirror(markdown); + const paragraph = doc.content.child(0); + const mention = paragraph.content.child(1); + + expect(mention.type.name).toBe("mention"); + expect(mention.attrs.type).toBe(MentionType.Issue); + expect(mention.attrs.href).toBe("https://github.com/acme/infra/issues/2"); + expect(mention.attrs.label).toBe("Fix parser"); + expect(paragraph.content.child(0).text).toBe("Please review "); + }); + + it("should convert an @ prefixed GitHub pull request link", () => { + const markdown = "@[Add parser](https://github.com/acme/infra/pull/5)"; + + const doc = ProsemirrorHelper.toProsemirror(markdown); + const mention = doc.content.child(0).content.child(0); + + expect(mention.attrs.type).toBe(MentionType.PullRequest); + }); + + it("should convert an @ prefixed link to an unclaimed host to a url mention", () => { + const markdown = "@[Example](https://example.com/page)"; + + const doc = ProsemirrorHelper.toProsemirror(markdown); + const mention = doc.content.child(0).content.child(0); + + expect(mention.attrs.type).toBe(MentionType.URL); + expect(mention.attrs.href).toBe("https://example.com/page"); + }); + + it("should keep a link without an @ prefix as a link", () => { + const markdown = + "Please review [Fix parser](https://github.com/acme/infra/issues/2)"; + + const doc = ProsemirrorHelper.toProsemirror(markdown); + const paragraph = doc.content.child(0); + + expect( + paragraph.content + .child(1) + .marks.some((mark) => mark.type.name === "link") + ).toBe(true); + }); + + it("should round-trip an external mention through Markdown", () => { + const markdown = "@[Fix parser](https://github.com/acme/infra/issues/2)"; + + const doc = ProsemirrorHelper.toProsemirror(markdown); + const mention = doc.content.child(0).content.child(0); + + expect(mention.type.name).toBe("mention"); + expect(mention.attrs.type).toBe(MentionType.Issue); + // Markdown that leaves Outline carries the url, so it comes back in as a + // mention rather than a plain link. + expect(serializer.serialize(doc, { commonMark: true }).trim()).toBe( + "@[Fix parser](https://github.com/acme/infra/issues/2)" + ); + }); }); describe("replaceDocumentReferences", () => { diff --git a/server/types.ts b/server/types.ts index 49037c1435..adad7772a5 100644 --- a/server/types.ts +++ b/server/types.ts @@ -9,6 +9,7 @@ import type { Client, CollectionPermission, JSONValue, + MentionType, UnfurlResourceType, ProsemirrorData, UnfurlResponse, @@ -623,6 +624,13 @@ export type UnfurlSignature = ( actor?: User ) => Promise<Unfurl | UnfurlError | undefined>; +/** + * Recognizes the URL of a resource belonging to the service and returns the + * type of mention that represents it, or undefined when the URL is not one the + * service can mention. + */ +export type MentionSignature = (url: URL) => MentionType | undefined; + export type UninstallSignature = (integration: Integration) => Promise<void>; export type Replace<T, K extends keyof T, N extends string> = { diff --git a/server/utils/PluginManager.ts b/server/utils/PluginManager.ts index 9caa54e6e3..0ba1057554 100644 --- a/server/utils/PluginManager.ts +++ b/server/utils/PluginManager.ts @@ -7,7 +7,11 @@ import env from "@server/env"; import Logger from "@server/logging/Logger"; import type BaseProcessor from "@server/queues/processors/BaseProcessor"; import type { BaseTask } from "@server/queues/tasks/base/BaseTask"; -import type { UnfurlSignature, UninstallSignature } from "@server/types"; +import type { + MentionSignature, + UnfurlSignature, + UninstallSignature, +} from "@server/types"; import type { BaseIssueProvider } from "./BaseIssueProvider"; import type { GroupSyncProvider } from "./GroupSyncProvider"; import type { BaseSearchProvider } from "./BaseSearchProvider"; @@ -34,6 +38,7 @@ export enum Hook { IssueProvider = "issueProvider", Processor = "processor", SearchProvider = "searchProvider", + MentionProvider = "mentionProvider", Task = "task", UnfurlProvider = "unfurl", Uninstall = "uninstall", @@ -50,6 +55,7 @@ type PluginValueMap = { // eslint-disable-next-line @typescript-eslint/no-explicit-any -- typeof BaseEmail<EmailProps> isn't assignable from BaseEmail<Subtype>; plugins register heterogeneous template Props. [Hook.EmailTemplate]: typeof BaseEmail<any>; [Hook.IssueProvider]: BaseIssueProvider; + [Hook.MentionProvider]: MentionSignature; [Hook.Processor]: typeof BaseProcessor; [Hook.SearchProvider]: BaseSearchProvider; [Hook.Task]: typeof BaseTask<object>; diff --git a/shared/editor/nodes/Mention.test.ts b/shared/editor/nodes/Mention.test.ts index 2177ef2cf9..bf3eb087c1 100644 --- a/shared/editor/nodes/Mention.test.ts +++ b/shared/editor/nodes/Mention.test.ts @@ -22,7 +22,7 @@ const serializeMention = ( describe("Mention serialization", () => { describe("markdown leaving Outline", () => { - it("serializes an issue mention as a link to the external url", () => { + it("serializes an issue mention as an @ prefixed link to the external url", () => { expect( serializeMention( { @@ -33,11 +33,11 @@ describe("Mention serialization", () => { { commonMark: true } ) ).toBe( - "[Epic 1: Control plane Helm chart](https://github.com/acme/infra/issues/2)" + "@[Epic 1: Control plane Helm chart](https://github.com/acme/infra/issues/2)" ); }); - it("serializes a pull request mention as a link to the external url", () => { + it("serializes a pull request mention as an @ prefixed link to the external url", () => { expect( serializeMention( { @@ -47,10 +47,10 @@ describe("Mention serialization", () => { }, { commonMark: true } ) - ).toBe("[Add Helm chart](https://github.com/acme/infra/pull/42)"); + ).toBe("@[Add Helm chart](https://github.com/acme/infra/pull/42)"); }); - it("serializes a project mention as a link to the external url", () => { + it("serializes a project mention as an @ prefixed link to the external url", () => { expect( serializeMention( { @@ -60,7 +60,20 @@ describe("Mention serialization", () => { }, { commonMark: true } ) - ).toBe("[Q3 Roadmap](https://github.com/orgs/acme/projects/7)"); + ).toBe("@[Q3 Roadmap](https://github.com/orgs/acme/projects/7)"); + }); + + it("serializes a url mention as an @ prefixed link", () => { + expect( + serializeMention( + { + type: MentionType.URL, + label: "Example", + href: "https://example.com/page", + }, + { commonMark: true } + ) + ).toBe("@[Example](https://example.com/page)"); }); it("sanitizes an unsafe url", () => { diff --git a/shared/editor/nodes/Mention.tsx b/shared/editor/nodes/Mention.tsx index 46a91fb7d4..9813247ce8 100644 --- a/shared/editor/nodes/Mention.tsx +++ b/shared/editor/nodes/Mention.tsx @@ -65,6 +65,15 @@ function isExternalMention(type: MentionType): boolean { ); } +/** The mention type that represents each kind of unfurled resource. */ +const MentionTypeForResource: Partial<Record<UnfurlResourceType, MentionType>> = + { + [UnfurlResourceType.Issue]: MentionType.Issue, + [UnfurlResourceType.PR]: MentionType.PullRequest, + [UnfurlResourceType.Project]: MentionType.Project, + [UnfurlResourceType.URL]: MentionType.URL, + }; + export default class Mention extends Node { get name() { return "mention"; @@ -394,12 +403,13 @@ export default class Mention extends Node { state.write(`[${label}](/collection/${mId})`); } else if ( state.options.commonMark && - isExternalMention(mType) && + (isExternalMention(mType) || mType === MentionType.URL) && node.attrs.href ) { // Markdown that leaves Outline cannot resolve a mention:// reference, so - // external mentions fall back to the URL they already carry. - state.write(`[${label}](${sanitizeUrl(node.attrs.href)})`); + // external mentions fall back to the URL they already carry. The "@" + // prefix allows them to be parsed back into a mention on the way in. + state.write(`@[${label}](${sanitizeUrl(node.attrs.href)})`); } else { // Keep the mention:// format for everything else, it round-trips back // into a live mention through Outline's own parser. @@ -414,6 +424,7 @@ export default class Mention extends Node { id: tok.attrGet("id"), type: tok.attrGet("type"), modelId: tok.attrGet("modelId"), + href: tok.attrGet("href") ?? undefined, label: tok.content, }), }; @@ -456,6 +467,18 @@ export default class Mention extends Node { const overrides: Record<string, unknown> = label ? { label } : {}; overrides.unfurl = unfurl; + // The resource an external link points at is only known once it has been + // unfurled, so narrow a generic URL mention to the type it turned out to + // be – an issue, pull request or project. + const unfurledType = MentionTypeForResource[unfurl.type]; + if ( + unfurledType && + node.attrs.type === MentionType.URL && + unfurledType !== node.attrs.type + ) { + overrides.type = unfurledType; + } + const pos = getPos(); if (!isMatch(node.attrs, overrides)) { diff --git a/shared/editor/rules/mention.test.ts b/shared/editor/rules/mention.test.ts index c403b71eb6..65193101ae 100644 --- a/shared/editor/rules/mention.test.ts +++ b/shared/editor/rules/mention.test.ts @@ -1,4 +1,5 @@ import markdownit from "markdown-it"; +import { MentionType } from "../../types"; import mentionRule from "./mention"; function findMentionTokens(tokens: ReturnType<markdownit["parse"]>) { @@ -6,6 +7,7 @@ function findMentionTokens(tokens: ReturnType<markdownit["parse"]>) { id: string | null; type: string | null; modelId: string | null; + href: string | null; label: string; }> = []; @@ -17,6 +19,7 @@ function findMentionTokens(tokens: ReturnType<markdownit["parse"]>) { id: child.attrGet("id"), type: child.attrGet("type"), modelId: child.attrGet("modelId"), + href: child.attrGet("href"), label: child.content, }); } @@ -43,6 +46,7 @@ describe("mention rule", () => { id: "a1b2c3d4-e5f6-7890-abcd-ef1234567890", type: "user", modelId: "f0e1d2c3-b4a5-6789-0abc-def123456789", + href: null, label: "John Doe", }); }); @@ -165,6 +169,56 @@ describe("mention rule", () => { }); }); + describe("external links", () => { + it("should parse an external link as a generic mention carrying the href", () => { + const result = md.parse("@[Example](https://example.com/page)", {}); + const mentions = findMentionTokens(result); + + expect(mentions).toHaveLength(1); + expect(mentions[0].type).toBe(MentionType.URL); + expect(mentions[0].href).toBe("https://example.com/page"); + expect(mentions[0].label).toBe("Example"); + expect(mentions[0].id).toBeTruthy(); + expect(mentions[0].modelId).toBeTruthy(); + }); + + it("should parse an external link within text", () => { + const result = md.parse( + "Please review @[Example](https://example.com/page) today", + {} + ); + const mentions = findMentionTokens(result); + + expect(mentions).toHaveLength(1); + expect(mentions[0].href).toBe("https://example.com/page"); + }); + + it("should not parse a link with an unsupported protocol", () => { + const result = md.parse("@[Mail](mailto:jane@example.com)", {}); + const mentions = findMentionTokens(result); + + expect(mentions).toHaveLength(0); + }); + }); + + describe("rendering", () => { + it("should escape markup in the label", () => { + const html = md.render( + "@[<img src=x onerror=alert(1)>](mention://user/abc123)" + ); + + expect(html).not.toContain("<img"); + expect(html).toContain("<img"); + }); + + it("should not allow an external href to break out of the attribute", () => { + const html = md.render('@[Example](https://example.com/"onmouseover=1)'); + + expect(html).not.toContain('"onmouseover'); + expect(html).toContain('href="https://example.com/%22onmouseover=1"'); + }); + }); + describe("non-mentions", () => { it("should not parse regular links as mentions", () => { const result = md.parse("[John Doe](https://example.com)", {}); diff --git a/shared/editor/rules/mention.ts b/shared/editor/rules/mention.ts index 3d04e5cde5..11919df2d2 100644 --- a/shared/editor/rules/mention.ts +++ b/shared/editor/rules/mention.ts @@ -2,7 +2,9 @@ import type MarkdownIt from "markdown-it"; import type StateCore from "markdown-it/lib/rules_core/state_core.mjs"; import type Token from "markdown-it/lib/token.mjs"; import { v4 as uuidv4 } from "uuid"; +import { MentionType } from "../../types"; import parseMentionUrl from "@shared/utils/parseMentionUrl"; +import { sanitizeUrl } from "@shared/utils/urls"; /** * Check whether a URL is a valid mention:// href. @@ -15,6 +17,24 @@ function isMentionHref(href: string) { return mentionType !== undefined && modelId !== undefined; } +/** + * Parse an href that points at an external resource that can be represented as + * a mention. + * + * @param href the URL string to parse. + * @returns the parsed URL, or undefined when the href cannot be mentioned. + */ +function parseExternalHref(href: string): URL | undefined { + try { + const url = new URL(href); + return url.protocol === "http:" || url.protocol === "https:" + ? url + : undefined; + } catch { + return undefined; + } +} + /** * Parse a mention:// href into the id, type and modelId needed by the editor. * For 2-segment URLs (no instance id) a fresh UUID is generated. @@ -37,14 +57,22 @@ function parseMentionHref(href: string): { return { id: id ?? uuidv4(), type: mentionType, modelId }; } -function renderMention(tokens: Token[], idx: number) { - const id = tokens[idx].attrGet("id"); - const mType = tokens[idx].attrGet("type"); - const mId = tokens[idx].attrGet("modelId"); - const label = tokens[idx].content; +const renderMention = (md: MarkdownIt) => (tokens: Token[], idx: number) => { + // The label and attributes originate in the document, and markdown-it leaves + // any markup in them intact when `html` is disabled, so everything written + // into the tag is escaped here. + const esc = (value: string | null) => md.utils.escapeHtml(value ?? ""); - return `<span id="${id}" class="mention" data-type="${mType}" data-id="${mId}">${label}</span>`; -} + const id = esc(tokens[idx].attrGet("id")); + const mType = esc(tokens[idx].attrGet("type")); + const mId = esc(tokens[idx].attrGet("modelId")); + const href = tokens[idx].attrGet("href"); + const label = esc(tokens[idx].content); + + return href + ? `<a id="${id}" class="mention" href="${esc(sanitizeUrl(href) ?? "")}" data-type="${mType}" data-id="${mId}">${label}</a>` + : `<span id="${id}" class="mention" data-type="${mType}" data-id="${mId}">${label}</span>`; +}; function parseMentions(state: StateCore) { for (let i = 0; i < state.tokens.length; i++) { @@ -75,9 +103,16 @@ function parseMentions(state: StateCore) { return false; } - // "link_open" token should have valid href + // "link_open" token should have a mention:// href, or an external href + // that can be represented as a mention. const attr = openToken.attrs?.[0]; - if (!(attr && attr[0] === "href" && isMentionHref(attr[1]))) { + if ( + !( + attr && + attr[0] === "href" && + (isMentionHref(attr[1]) || parseExternalHref(attr[1])) + ) + ) { return false; } @@ -91,15 +126,30 @@ function parseMentions(state: StateCore) { // remove "@" from preceding token precToken.content = precToken.content.slice(0, -1); - // href must be present, otherwise the isMentionHref test would've failed + // href must be present, otherwise the href test would've failed // oxlint-disable-next-line @typescript-eslint/no-non-null-assertion const href = openToken.attrs![0][1]; - const { id, type: mType, modelId: mId } = parseMentionHref(href); - const mentionToken = new state.Token("mention", "", 0); - mentionToken.attrSet("id", id); - mentionToken.attrSet("type", mType); - mentionToken.attrSet("modelId", mId); + const externalUrl = isMentionHref(href) + ? undefined + : parseExternalHref(href); + + if (externalUrl) { + // External links carry their identity in the href, so the ids are + // generated the same way a paste in the editor would. The mention is + // generic here and is narrowed to the resource it points at by the + // service that recognizes the URL. + mentionToken.attrSet("id", uuidv4()); + mentionToken.attrSet("type", MentionType.URL); + mentionToken.attrSet("modelId", uuidv4()); + mentionToken.attrSet("href", href); + } else { + const { id, type: mType, modelId: mId } = parseMentionHref(href); + mentionToken.attrSet("id", id); + mentionToken.attrSet("type", mType); + mentionToken.attrSet("modelId", mId); + } + mentionToken.content = textToken.content; // "link_open", followed by "text" and "link_close" tokens are coalesced @@ -129,6 +179,6 @@ function parseMentions(state: StateCore) { } export default function mention(md: MarkdownIt) { - md.renderer.rules.mention = renderMention; + md.renderer.rules.mention = renderMention(md); md.core.ruler.after("inline", "mention", parseMentions); } From d8d8f2fffed97eaf3e9d48d820c8f1e1facf4008 Mon Sep 17 00:00:00 2001 From: Tom Moor <tom@getoutline.com> Date: Fri, 28 Aug 2026 00:13:56 -0400 Subject: [PATCH 027/181] Support HEIC and HEIF avatar uploads with in-browser conversion (#13577) * feat: Support HEIC avatar uploads with in-browser conversion HEIC and HEIF images picked for an avatar are now converted to JPEG in the browser before the cropper opens. The browser's own decoder is used when it supports the format, otherwise a WebAssembly decoder is loaded on demand. Also collects the image utilities into an ImageHelper class, fixes the crop dialog's submit button never disabling, and stops the upload from forwarding request headers the browser controls itself. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * refactor: Use only the browser's own HEIC decoder Drops the bundled WebAssembly decoder in favour of the browser's native support. This removes an LGPL dependency and a 3MB lazy chunk, and lets the Content Security Policy stay as it was. Browsers without HEIC support now get a message asking for a JPEG or PNG. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * docs: Add class-level JSDoc to ImageHelper Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> --- .../EmojiDialog/EmojiCreateDialog.tsx | 4 +- .../EmojiDialog/EmojiReplaceDialog.tsx | 4 +- .../components/ShareSettingsPopover.tsx | 4 +- .../Settings/components/ImageUpload.tsx | 65 ++++++---- app/utils/ImageHelper.test.ts | 31 +++++ app/utils/ImageHelper.ts | 95 ++++++++++++++ app/utils/compressImage.ts | 21 ---- app/utils/files.ts | 51 ++++++++ shared/i18n/locales/en_US/translation.json | 1 + shared/validations.ts | 16 +++ yarn.lock | 116 +----------------- 11 files changed, 244 insertions(+), 164 deletions(-) create mode 100644 app/utils/ImageHelper.test.ts create mode 100644 app/utils/ImageHelper.ts delete mode 100644 app/utils/compressImage.ts diff --git a/app/components/EmojiDialog/EmojiCreateDialog.tsx b/app/components/EmojiDialog/EmojiCreateDialog.tsx index ac23e76fb0..eaa4fcc7ee 100644 --- a/app/components/EmojiDialog/EmojiCreateDialog.tsx +++ b/app/components/EmojiDialog/EmojiCreateDialog.tsx @@ -8,7 +8,7 @@ import Input, { LabelText } from "~/components/Input"; import Text from "~/components/Text"; import useStores from "~/hooks/useStores"; import { uploadFile } from "~/utils/files"; -import { compressImage } from "~/utils/compressImage"; +import { ImageHelper } from "~/utils/ImageHelper"; import { generateEmojiNameFromFilename } from "~/utils/emoji"; import { useEmojiFileUpload, EmojiImageDropZone } from "./Components"; @@ -55,7 +55,7 @@ export function EmojiCreateDialog({ onSubmit }: Props) { const fileToUpload = file.type === "image/gif" ? file - : await compressImage(file, { + : await ImageHelper.compress(file, { maxHeight: 64, maxWidth: 64, }); diff --git a/app/components/EmojiDialog/EmojiReplaceDialog.tsx b/app/components/EmojiDialog/EmojiReplaceDialog.tsx index e2a891ffa1..0ea06bc6a0 100644 --- a/app/components/EmojiDialog/EmojiReplaceDialog.tsx +++ b/app/components/EmojiDialog/EmojiReplaceDialog.tsx @@ -7,7 +7,7 @@ import Text from "~/components/Text"; import type Emoji from "~/models/Emoji"; import useStores from "~/hooks/useStores"; import { uploadFile } from "~/utils/files"; -import { compressImage } from "~/utils/compressImage"; +import { ImageHelper } from "~/utils/ImageHelper"; import { useEmojiFileUpload, EmojiImageDropZone } from "./Components"; interface Props { @@ -38,7 +38,7 @@ export function EmojiReplaceDialog({ emoji, onSubmit }: Props) { const fileToUpload = file.type === "image/gif" ? file - : await compressImage(file, { + : await ImageHelper.compress(file, { maxHeight: 64, maxWidth: 64, }); diff --git a/app/components/Sharing/components/ShareSettingsPopover.tsx b/app/components/Sharing/components/ShareSettingsPopover.tsx index 14e62a08ad..3f3baaabcc 100644 --- a/app/components/Sharing/components/ShareSettingsPopover.tsx +++ b/app/components/Sharing/components/ShareSettingsPopover.tsx @@ -29,7 +29,7 @@ import Tooltip from "~/components/Tooltip"; import env from "~/env"; import { useMenuAction } from "~/hooks/useMenuAction"; import useStores from "~/hooks/useStores"; -import { compressImage } from "~/utils/compressImage"; +import { ImageHelper } from "~/utils/ImageHelper"; import { uploadFile } from "~/utils/files"; import { Popover, @@ -90,7 +90,7 @@ function ShareSettingsPopover({ share, children }: Props) { setIsUploading(true); try { - const compressed = await compressImage(file, { + const compressed = await ImageHelper.compress(file, { maxHeight: 512, maxWidth: 512, }); diff --git a/app/scenes/Settings/components/ImageUpload.tsx b/app/scenes/Settings/components/ImageUpload.tsx index fe81288e2d..97c6be5ec4 100644 --- a/app/scenes/Settings/components/ImageUpload.tsx +++ b/app/scenes/Settings/components/ImageUpload.tsx @@ -14,8 +14,8 @@ import ButtonLarge from "~/components/ButtonLarge"; import Flex from "~/components/Flex"; import LoadingIndicator from "~/components/LoadingIndicator"; import useStores from "~/hooks/useStores"; -import { compressImage } from "~/utils/compressImage"; import { uploadFile, dataUrlToBlob } from "~/utils/files"; +import { ImageHelper } from "~/utils/ImageHelper"; export type Props = { onSuccess: (url: string | null) => void | Promise<void>; @@ -34,13 +34,13 @@ const ImageUpload: React.FC<Props> = ({ const { dialogs } = useStores(); const { t } = useTranslation(); - const [isUploading, setIsUploading] = useState(false); const [isCropping, setIsCropping] = useState(false); + const [isConverting, setIsConverting] = useState(false); const uploadImage = React.useCallback( async (blob: Blob, file: File) => { try { - const compressed = await compressImage(blob, { + const compressed = await ImageHelper.compress(blob, { maxHeight: 512, maxWidth: 512, }); @@ -52,7 +52,6 @@ const ImageUpload: React.FC<Props> = ({ } catch (err) { onError(errToString(err)); } finally { - setIsUploading(false); setIsCropping(false); dialogs.closeAllModals(); } @@ -62,29 +61,44 @@ const ImageUpload: React.FC<Props> = ({ const handleUpload = React.useCallback( (blob: Blob, file: File) => { - setIsUploading(true); - // allow the UI to update before converting the canvas to a Blob - // for large images this can cause the page rendering to hang. - setTimeout(() => uploadImage(blob, file), 0); + void uploadImage(blob, file); }, [uploadImage] ); const handleClose = React.useCallback(() => { - setIsUploading(false); setIsCropping(false); }, []); const onDropAccepted = React.useCallback( async (files: File[]) => { + let file = files[0]; + + // Most browsers cannot display HEIC images, so convert to JPEG before + // the image is shown in the cropper. + if (ImageHelper.isHeic(file)) { + setIsConverting(true); + const converted = await ImageHelper.convertHeicToJpeg(file); + setIsConverting(false); + + if (!converted) { + onError( + t( + "Your browser cannot read HEIC images, please convert it to JPEG or PNG first" + ) + ); + return; + } + file = converted; + } + setIsCropping(true); dialogs.openModal({ title: "", content: ( <AvatarEditorDialog - file={files[0]} + file={file} onUpload={handleUpload} - isUploading={isUploading} borderRadius={borderRadius ?? 150} submitText={submitText || t("Crop image")} /> @@ -92,19 +106,11 @@ const ImageUpload: React.FC<Props> = ({ onClose: handleClose, }); }, - [ - t, - dialogs, - handleUpload, - handleClose, - isUploading, - borderRadius, - submitText, - ] + [t, dialogs, handleUpload, handleClose, onError, borderRadius, submitText] ); const { getRootProps, getInputProps } = useDropzone({ - accept: AttachmentValidation.avatarContentTypes.join(", "), + accept: AttachmentValidation.avatarInputContentTypes.join(", "), onDropAccepted, }); @@ -114,6 +120,7 @@ const ImageUpload: React.FC<Props> = ({ return ( <div {...getRootProps()}> + {isConverting && <LoadingIndicator />} <input {...getInputProps()} /> {children} </div> @@ -123,23 +130,27 @@ const ImageUpload: React.FC<Props> = ({ type AvatarEditorDialogProps = { file: File; onUpload: (blob: Blob, file: File) => void; - isUploading: boolean; borderRadius: number; submitText: string; }; const AvatarEditorDialog: React.FC<AvatarEditorDialogProps> = observer( - ({ file, onUpload, isUploading, borderRadius, submitText }) => { + ({ file, onUpload, borderRadius, submitText }) => { const { ui } = useStores(); const { t } = useTranslation(); const [zoom, setZoom] = useState(1); + const [isUploading, setIsUploading] = useState(false); const avatarEditorRef = useRef<AvatarEditor>(null); const handleUpload = React.useCallback(() => { - const canvas = avatarEditorRef.current?.getImage(); - invariant(canvas, "canvas is not defined"); - const blob = dataUrlToBlob(canvas.toDataURL()); - onUpload(blob, file); + setIsUploading(true); + // Allow the button to render as disabled before the canvas is converted, + // which hangs rendering for large images. + setTimeout(() => { + const canvas = avatarEditorRef.current?.getImage(); + invariant(canvas, "canvas is not defined"); + onUpload(dataUrlToBlob(canvas.toDataURL()), file); + }, 0); }, [file, onUpload]); const handleZoom = React.useCallback( diff --git a/app/utils/ImageHelper.test.ts b/app/utils/ImageHelper.test.ts new file mode 100644 index 0000000000..cf231606d0 --- /dev/null +++ b/app/utils/ImageHelper.test.ts @@ -0,0 +1,31 @@ +import { ImageHelper } from "./ImageHelper"; + +const fileWith = (name: string, type: string) => new File([], name, { type }); + +describe("ImageHelper", () => { + describe("isHeic", () => { + it("matches HEIC and HEIF mime-types", () => { + expect(ImageHelper.isHeic(fileWith("photo", "image/heic"))).toBe(true); + expect(ImageHelper.isHeic(fileWith("photo", "image/heif"))).toBe(true); + expect(ImageHelper.isHeic(fileWith("photo", "image/heic-sequence"))).toBe( + true + ); + expect(ImageHelper.isHeic(fileWith("photo", "IMAGE/HEIC"))).toBe(true); + }); + + it("matches by extension when the mime-type is missing", () => { + expect(ImageHelper.isHeic(fileWith("photo.heic", ""))).toBe(true); + expect(ImageHelper.isHeic(fileWith("photo.HEIF", ""))).toBe(true); + }); + + it("does not match other images", () => { + expect(ImageHelper.isHeic(fileWith("photo.png", "image/png"))).toBe( + false + ); + expect(ImageHelper.isHeic(fileWith("photo.jpg", "image/jpeg"))).toBe( + false + ); + expect(ImageHelper.isHeic(fileWith("heic.png", "image/png"))).toBe(false); + }); + }); +}); diff --git a/app/utils/ImageHelper.ts b/app/utils/ImageHelper.ts new file mode 100644 index 0000000000..bfc6593c85 --- /dev/null +++ b/app/utils/ImageHelper.ts @@ -0,0 +1,95 @@ +import Compressor from "compressorjs"; + +/** + * Helpers for inspecting and transforming images in the browser. + */ +export class ImageHelper { + /** + * Checks whether a file is a HEIC or HEIF image. The extension is also + * checked because some platforms report an empty mime-type for these files. + * + * @param file the file to check. + * @returns true if the file is a HEIC or HEIF image. + */ + public static isHeic(file: File): boolean { + const contentTypes = [ + "image/heic", + "image/heif", + "image/heic-sequence", + "image/heif-sequence", + ]; + const extensions = [".heic", ".heif"]; + + return ( + contentTypes.includes(file.type.toLowerCase()) || + extensions.some((extension) => + file.name.toLowerCase().endsWith(extension) + ) + ); + } + + /** + * Compresses an image file or blob, optionally constraining its dimensions. + * + * @param file the image file or blob to compress. + * @param options optional compression options, the result is returned by the + * promise rather than the success and error callbacks. + * @returns a promise resolving to the compressed image blob. + */ + public static compress( + file: File | Blob, + options?: Omit<Compressor.Options, "success" | "error"> + ): Promise<Blob> { + return new Promise((resolve, reject) => { + new Compressor(file, { ...options, success: resolve, error: reject }); + }); + } + + /** + * Converts a HEIC or HEIF image to a JPEG that all browsers can display, + * using the browser's own decoder. Support is limited, so callers must + * handle an undefined result. + * + * @param file the HEIC or HEIF file to convert. + * @returns a promise resolving to the converted JPEG file, or undefined if + * the browser cannot decode the format. + */ + public static async convertHeicToJpeg(file: File): Promise<File | undefined> { + if (typeof createImageBitmap === "undefined") { + return undefined; + } + + let bitmap: ImageBitmap; + try { + bitmap = await createImageBitmap(file, { + imageOrientation: "from-image", + }); + } catch (_err) { + return undefined; + } + + try { + const canvas = document.createElement("canvas"); + canvas.width = bitmap.width; + canvas.height = bitmap.height; + + const context = canvas.getContext("2d"); + if (!context) { + return undefined; + } + context.drawImage(bitmap, 0, 0); + + const blob = await new Promise<Blob | null>((resolve) => { + canvas.toBlob(resolve, "image/jpeg", 0.92); + }); + if (!blob) { + return undefined; + } + + const name = `${file.name.replace(/\.(heic|heif)$/i, "")}.jpg`; + return new File([blob], name, { type: "image/jpeg" }); + } finally { + bitmap.close(); + } + } +} diff --git a/app/utils/compressImage.ts b/app/utils/compressImage.ts deleted file mode 100644 index 69397d2dce..0000000000 --- a/app/utils/compressImage.ts +++ /dev/null @@ -1,21 +0,0 @@ -import Compressor from "compressorjs"; - -type Options = { - maxWidth?: number; - maxHeight?: number; -}; - -/** - * Compresses an image file or blob, optionally constraining its dimensions. - * - * @param file the image file or blob to compress. - * @param options optional maximum width and height constraints. - * @returns a promise resolving to the compressed image blob. - */ -export const compressImage = async ( - file: File | Blob, - options?: Options -): Promise<Blob> => - new Promise((resolve, reject) => { - new Compressor(file, { ...options, success: resolve, error: reject }); - }); diff --git a/app/utils/files.ts b/app/utils/files.ts index 6cb719e80f..181e181c6d 100644 --- a/app/utils/files.ts +++ b/app/utils/files.ts @@ -101,6 +101,9 @@ export const uploadFile = async ( for (const [key, value] of Object.entries( data.headers as Record<string, string> )) { + if (isForbiddenRequestHeader(key)) { + continue; + } xhr.setRequestHeader(key, value); } } @@ -145,6 +148,54 @@ export const uploadFile = async ( export { dataUrlToBlob }; +/** + * Header names the browser controls itself - it silently ignores an attempt to + * set one and logs an error to the console. + * + * @see https://fetch.spec.whatwg.org/#forbidden-request-header + */ +const forbiddenRequestHeaders = [ + "accept-charset", + "accept-encoding", + "access-control-request-headers", + "access-control-request-method", + "connection", + "content-length", + "cookie", + "cookie2", + "date", + "dnt", + "expect", + "host", + "keep-alive", + "origin", + "referer", + "set-cookie", + "te", + "trailer", + "transfer-encoding", + "upgrade", + "via", +]; + +const forbiddenRequestHeaderPrefixes = ["proxy-", "sec-"]; + +/** + * Checks whether the browser refuses to let a header be set on a request. + * + * @param name the header name to check. + * @returns true if the header cannot be set. + */ +const isForbiddenRequestHeader = (name: string): boolean => { + const lowercased = name.toLowerCase(); + return ( + forbiddenRequestHeaders.includes(lowercased) || + forbiddenRequestHeaderPrefixes.some((prefix) => + lowercased.startsWith(prefix) + ) + ); +}; + const CHAR_FORWARD_SLASH = 47; /* / */ const CHAR_DOT = 46; /* . */ diff --git a/shared/i18n/locales/en_US/translation.json b/shared/i18n/locales/en_US/translation.json index 698f972104..16bd66767c 100644 --- a/shared/i18n/locales/en_US/translation.json +++ b/shared/i18n/locales/en_US/translation.json @@ -1325,6 +1325,7 @@ "Synced <2></2>": "Synced <2></2>", "Date created": "Date created", "Crop Image": "Crop Image", + "Your browser cannot read HEIC images, please convert it to JPEG or PNG first": "Your browser cannot read HEIC images, please convert it to JPEG or PNG first", "Crop image": "Crop image", "You can import a zip file that was previously exported from the JSON option in another instance. In {{ appName }}, open <em>Export</em> in the Settings sidebar and click on <em>Export Data</em>.": "You can import a zip file that was previously exported from the JSON option in another instance. In {{ appName }}, open <em>Export</em> in the Settings sidebar and click on <em>Export Data</em>.", "Drag and drop the zip file from the JSON export option in {{appName}}, or click to upload": "Drag and drop the zip file from the JSON export option in {{appName}}, or click to upload", diff --git a/shared/validations.ts b/shared/validations.ts index 31e99421f8..4831ff20fd 100644 --- a/shared/validations.ts +++ b/shared/validations.ts @@ -2,6 +2,22 @@ export const AttachmentValidation = { /** The limited allowable mime-types for user and team avatars */ avatarContentTypes: ["image/jpg", "image/jpeg", "image/png"], + /** + * The mime-types and file extensions offered by the avatar file picker. HEIC + * and HEIF images are converted to a type in `avatarContentTypes` by the + * client before they are uploaded. Extensions are included because some + * platforms report an empty mime-type for these files. + */ + avatarInputContentTypes: [ + "image/jpg", + "image/jpeg", + "image/png", + "image/heic", + "image/heif", + ".heic", + ".heif", + ], + /** The most widely supported mime-types across modern browsers */ emojiContentTypes: [ "image/png", diff --git a/yarn.lock b/yarn.lock index 84d551a4f3..9997b80164 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3293,23 +3293,7 @@ __metadata: languageName: node linkType: hard -"@octokit/auth-app@npm:^8.1.2": - version: 8.2.0 - resolution: "@octokit/auth-app@npm:8.2.0" - dependencies: - "@octokit/auth-oauth-app": "npm:^9.0.3" - "@octokit/auth-oauth-user": "npm:^6.0.2" - "@octokit/request": "npm:^10.0.6" - "@octokit/request-error": "npm:^7.0.2" - "@octokit/types": "npm:^16.0.0" - toad-cache: "npm:^3.7.0" - universal-github-app-jwt: "npm:^2.2.0" - universal-user-agent: "npm:^7.0.0" - checksum: 10c0/7f1b113c9f2ef4d0aac06ffb0b1930a256c6a8985744c709c36fe8c4565c5c184de742de4c4a52e4d9f25baef00c9b855732cfaeb81db8abe238d6c2ee54d6d6 - languageName: node - linkType: hard - -"@octokit/auth-app@npm:^8.3.0": +"@octokit/auth-app@npm:^8.1.2, @octokit/auth-app@npm:^8.3.0": version: 8.3.0 resolution: "@octokit/auth-app@npm:8.3.0" dependencies: @@ -3325,20 +3309,7 @@ __metadata: languageName: node linkType: hard -"@octokit/auth-oauth-app@npm:^9.0.2, @octokit/auth-oauth-app@npm:^9.0.3": - version: 9.0.3 - resolution: "@octokit/auth-oauth-app@npm:9.0.3" - dependencies: - "@octokit/auth-oauth-device": "npm:^8.0.3" - "@octokit/auth-oauth-user": "npm:^6.0.2" - "@octokit/request": "npm:^10.0.6" - "@octokit/types": "npm:^16.0.0" - universal-user-agent: "npm:^7.0.0" - checksum: 10c0/1b47dc2a6ea480c04cc3b03d03f4836916ef666047b639c78134d49bbf9fb112a0610021aa017abaa30d8a63a5e66117b3d2b3a4d3976d10153bd5efef54da8b - languageName: node - linkType: hard - -"@octokit/auth-oauth-app@npm:^9.0.4": +"@octokit/auth-oauth-app@npm:^9.0.2, @octokit/auth-oauth-app@npm:^9.0.4": version: 9.0.4 resolution: "@octokit/auth-oauth-app@npm:9.0.4" dependencies: @@ -3351,18 +3322,6 @@ __metadata: languageName: node linkType: hard -"@octokit/auth-oauth-device@npm:^8.0.3": - version: 8.0.3 - resolution: "@octokit/auth-oauth-device@npm:8.0.3" - dependencies: - "@octokit/oauth-methods": "npm:^6.0.2" - "@octokit/request": "npm:^10.0.6" - "@octokit/types": "npm:^16.0.0" - universal-user-agent: "npm:^7.0.0" - checksum: 10c0/2c43d131fbd0b60abef5f37e6168e31f5ec1b8361bac1d71c19499e1960e5e00957c54db9836d88754b467ad48c4e15f60409b0d66dc740468c49834e787e971 - languageName: node - linkType: hard - "@octokit/auth-oauth-device@npm:^8.0.4": version: 8.0.4 resolution: "@octokit/auth-oauth-device@npm:8.0.4" @@ -3375,20 +3334,7 @@ __metadata: languageName: node linkType: hard -"@octokit/auth-oauth-user@npm:^6.0.1, @octokit/auth-oauth-user@npm:^6.0.2": - version: 6.0.2 - resolution: "@octokit/auth-oauth-user@npm:6.0.2" - dependencies: - "@octokit/auth-oauth-device": "npm:^8.0.3" - "@octokit/oauth-methods": "npm:^6.0.2" - "@octokit/request": "npm:^10.0.6" - "@octokit/types": "npm:^16.0.0" - universal-user-agent: "npm:^7.0.0" - checksum: 10c0/7af66189e7c0b19c456462d571f61ac787d8464554375b12ded245d0d209a7a0f873f9189d7a3e9afef8aa59eb268c573f8e98b0ee683ebf0989625c20e2125a - languageName: node - linkType: hard - -"@octokit/auth-oauth-user@npm:^6.0.3": +"@octokit/auth-oauth-user@npm:^6.0.1, @octokit/auth-oauth-user@npm:^6.0.3": version: 6.0.3 resolution: "@octokit/auth-oauth-user@npm:6.0.3" dependencies: @@ -3477,19 +3423,7 @@ __metadata: languageName: node linkType: hard -"@octokit/oauth-methods@npm:^6.0.1, @octokit/oauth-methods@npm:^6.0.2": - version: 6.0.2 - resolution: "@octokit/oauth-methods@npm:6.0.2" - dependencies: - "@octokit/oauth-authorization-url": "npm:^8.0.0" - "@octokit/request": "npm:^10.0.6" - "@octokit/request-error": "npm:^7.0.2" - "@octokit/types": "npm:^16.0.0" - checksum: 10c0/51d2f3218839ce37609e6e0adc274efcc198bdcae57ef3ecf3ada95f6f30dcc3052f6db34e4aa3a1bc94545d7025baa44058d5c044fdd6bdd83562eb9b8510c2 - languageName: node - linkType: hard - -"@octokit/oauth-methods@npm:^6.0.3": +"@octokit/oauth-methods@npm:^6.0.1, @octokit/oauth-methods@npm:^6.0.3": version: 6.0.4 resolution: "@octokit/oauth-methods@npm:6.0.4" dependencies: @@ -3578,16 +3512,7 @@ __metadata: languageName: node linkType: hard -"@octokit/request-error@npm:^7.0.0, @octokit/request-error@npm:^7.0.2": - version: 7.1.0 - resolution: "@octokit/request-error@npm:7.1.0" - dependencies: - "@octokit/types": "npm:^16.0.0" - checksum: 10c0/62b90a54545c36a30b5ffdda42e302c751be184d85b68ffc7f1242c51d7ca54dbd185b7d0027b491991776923a910c85c9c51269fe0d86111bac187507a5abc4 - languageName: node - linkType: hard - -"@octokit/request-error@npm:^7.1.1": +"@octokit/request-error@npm:^7.0.0, @octokit/request-error@npm:^7.0.2, @octokit/request-error@npm:^7.1.1": version: 7.1.1 resolution: "@octokit/request-error@npm:7.1.1" dependencies: @@ -3596,7 +3521,7 @@ __metadata: languageName: node linkType: hard -"@octokit/request@npm:^10.0.13": +"@octokit/request@npm:^10.0.13, @octokit/request@npm:^10.0.6": version: 10.0.15 resolution: "@octokit/request@npm:10.0.15" dependencies: @@ -3610,21 +3535,6 @@ __metadata: languageName: node linkType: hard -"@octokit/request@npm:^10.0.6": - version: 10.0.9 - resolution: "@octokit/request@npm:10.0.9" - dependencies: - "@octokit/endpoint": "npm:^11.0.3" - "@octokit/request-error": "npm:^7.0.2" - "@octokit/types": "npm:^16.0.0" - content-type: "npm:^2.0.0" - fast-content-type-parse: "npm:^3.0.0" - json-with-bigint: "npm:^3.5.3" - universal-user-agent: "npm:^7.0.2" - checksum: 10c0/2a642870202117c8cf0021b7c01a92e18acdec4826c103f7749a942537a265251e033c0ac5178807f0c63b9759e149ce9701015454167d4c1627d30218ddf9f2 - languageName: node - linkType: hard - "@octokit/types@npm:^16.0.0": version: 16.0.0 resolution: "@octokit/types@npm:16.0.0" @@ -11339,13 +11249,6 @@ __metadata: languageName: node linkType: hard -"fast-content-type-parse@npm:^3.0.0": - version: 3.0.0 - resolution: "fast-content-type-parse@npm:3.0.0" - checksum: 10c0/06251880c83b7118af3a5e66e8bcee60d44f48b39396fc60acc2b4630bd5f3e77552b999b5c8e943d45a818854360e5e97164c374ec4b562b4df96a2cdf2e188 - languageName: node - linkType: hard - "fast-deep-equal@npm:^3.1.3": version: 3.1.3 resolution: "fast-deep-equal@npm:3.1.3" @@ -13668,13 +13571,6 @@ __metadata: languageName: node linkType: hard -"json-with-bigint@npm:^3.5.3": - version: 3.5.8 - resolution: "json-with-bigint@npm:3.5.8" - checksum: 10c0/a0c4e37626d74a9a493539f9f9a94855933fa15ea2f028859a787229a42c5f11803db6f94f1ce7b1d89756c1e80a7c1f11006bac266ec7ce819b75701765ca0a - languageName: node - linkType: hard - "json5@npm:^2.2.3": version: 2.2.3 resolution: "json5@npm:2.2.3" From d55e7f37e551a72d7b959ededa79e267fb946f1d Mon Sep 17 00:00:00 2001 From: Tom Moor <tom@getoutline.com> Date: Sat, 29 Aug 2026 19:49:28 -0400 Subject: [PATCH 028/181] fix: Raise OAuth redirect_uris limit and log client errors (#13583) Dynamic client registration rejected any client sending more than 10 redirect URIs. The limit is now 20, shared between the register and update schemas, and the error reports how many were received. OAuth client errors were swallowed without reaching logs or Sentry, leaving a failing integration invisible beyond its status code. 4xx responses are now logged with the reason. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> --- .../oauth/middlewares/oauthErrorHandler.ts | 57 ++++++++++++------- server/routes/oauth/oauth.test.ts | 41 +++++++++++++ server/routes/oauth/schema.ts | 22 ++++--- shared/validations.ts | 3 + 4 files changed, 95 insertions(+), 28 deletions(-) diff --git a/server/routes/oauth/middlewares/oauthErrorHandler.ts b/server/routes/oauth/middlewares/oauthErrorHandler.ts index 5994c2618f..2be36ad603 100644 --- a/server/routes/oauth/middlewares/oauthErrorHandler.ts +++ b/server/routes/oauth/middlewares/oauthErrorHandler.ts @@ -4,6 +4,12 @@ import { EmptyResultError as SequelizeEmptyResultError, } from "sequelize"; import { errToString } from "@shared/utils/error"; +import Logger from "@server/logging/Logger"; + +interface OAuthErrorBody { + error: string; + error_description: string; +} /** Extract the first numeric status-like property from an unknown error. */ function statusCodeFromError(err: unknown): number { @@ -31,36 +37,47 @@ export default function oauthErrorHandler() { try { await next(); } catch (err) { + let status: number; + let body: OAuthErrorBody; + if (err instanceof SequelizeEmptyResultError) { - ctx.status = 404; - ctx.body = { + status = 404; + body = { error: "invalid_request", error_description: "Resource not found", }; - return; - } - if (err instanceof SequelizeValidationError) { - ctx.status = 400; - ctx.body = { + } else if (err instanceof SequelizeValidationError) { + status = 400; + body = { error: "invalid_request", error_description: err.errors[0].message, }; - return; + } else { + status = statusCodeFromError(err); + // Map common HTTP status codes to OAuth error types + let errorType = "server_error"; + if (status === 400) { + errorType = "invalid_request"; + } else if (status === 401) { + errorType = "invalid_client"; + } + + body = { + error: errorType, + error_description: errToString(err), + }; } - ctx.status = statusCodeFromError(err); - // Map common HTTP status codes to OAuth error types - let errorType = "server_error"; - if (ctx.status === 400) { - errorType = "invalid_request"; - } else if (ctx.status === 401) { - errorType = "invalid_client"; - } + ctx.status = status; + ctx.body = body; - ctx.body = { - error: errorType, - error_description: errToString(err), - }; + if (status < 500) { + Logger.info("authentication", "OAuth request rejected", { + path: ctx.path, + status, + ...body, + }); + } } }; } diff --git a/server/routes/oauth/oauth.test.ts b/server/routes/oauth/oauth.test.ts index 14a115fca6..c86e274f47 100644 --- a/server/routes/oauth/oauth.test.ts +++ b/server/routes/oauth/oauth.test.ts @@ -1,6 +1,7 @@ import { faker } from "@faker-js/faker"; import sharedEnv from "@shared/env"; import { TeamPreference } from "@shared/types"; +import { OAuthClientValidation } from "@shared/validations"; import env from "@server/env"; import { OAuthClient } from "@server/models"; import { @@ -156,6 +157,46 @@ describe("#oauth.register", () => { expect(res.status).toEqual(400); }); + it("should allow the maximum number of redirect_uris", async () => { + const res = await server.post("/oauth/register", { + body: { + client_name: "Test Client", + redirect_uris: Array.from( + { length: OAuthClientValidation.maxRedirectUris }, + (_, index) => `https://example.com/callback/${index}` + ), + }, + headers: { + host: `${subdomain}.outline.dev`, + }, + }); + + expect(res.status).toEqual(201); + }); + + it("should reject too many redirect_uris and report the received count", async () => { + const count = OAuthClientValidation.maxRedirectUris + 1; + const res = await server.post("/oauth/register", { + body: { + client_name: "Test Client", + redirect_uris: Array.from( + { length: count }, + (_, index) => `https://example.com/callback/${index}` + ), + }, + headers: { + host: `${subdomain}.outline.dev`, + }, + }); + + expect(res.status).toEqual(400); + const body = await res.json(); + expect(body.error).toEqual("invalid_request"); + expect(body.error_description).toEqual( + `redirect_uris: expected array to have <=${OAuthClientValidation.maxRedirectUris} items, received ${count}` + ); + }); + it("should reject unsupported grant types", async () => { const res = await server.post("/oauth/register", { body: { diff --git a/server/routes/oauth/schema.ts b/server/routes/oauth/schema.ts index e639f046b6..da2e875bb8 100644 --- a/server/routes/oauth/schema.ts +++ b/server/routes/oauth/schema.ts @@ -25,6 +25,18 @@ export const TokenRevokeSchema = BaseSchema.extend({ export type TokenRevokeReq = z.infer<typeof TokenRevokeSchema>; +// The received count is included in the message so that clients registering an +// oversized list, and our own logs, show how far over the limit they are. +const redirectUris = z + .array(z.url().max(OAuthClientValidation.maxRedirectUriLength)) + .min(1) + .max(OAuthClientValidation.maxRedirectUris, { + error: (issue) => + `expected array to have <=${OAuthClientValidation.maxRedirectUris} items, received ${ + Array.isArray(issue.input) ? issue.input.length : "unknown" + }`, + }); + export const RegisterSchema = BaseSchema.extend({ body: z.object({ // RFC 7591 §2 marks every metadata field as OPTIONAL; some MCP clients @@ -35,10 +47,7 @@ export const RegisterSchema = BaseSchema.extend({ .min(1) .max(OAuthClientValidation.maxNameLength) .optional(), - redirect_uris: z - .array(z.url().max(OAuthClientValidation.maxRedirectUriLength)) - .min(1) - .max(10), + redirect_uris: redirectUris, grant_types: z .array(z.enum(["authorization_code", "refresh_token"])) .default(["authorization_code"]), @@ -66,10 +75,7 @@ export type RegisterReq = z.infer<typeof RegisterSchema>; export const RegisterUpdateSchema = BaseSchema.extend({ body: z.object({ client_name: z.string().min(1).max(OAuthClientValidation.maxNameLength), - redirect_uris: z - .array(z.url().max(OAuthClientValidation.maxRedirectUriLength)) - .min(1) - .max(10), + redirect_uris: redirectUris, client_uri: z .string() .url() diff --git a/shared/validations.ts b/shared/validations.ts index 4831ff20fd..074381e3c0 100644 --- a/shared/validations.ts +++ b/shared/validations.ts @@ -116,6 +116,9 @@ export const OAuthClientValidation = { /** The maximum length of an OAuth client redirect URI */ maxRedirectUriLength: 1024, + /** The maximum number of redirect URIs for an OAuth client */ + maxRedirectUris: 20, + /** The allowed OAuth client types */ clientTypes: ["confidential", "public"] as const, }; From f44fad43807694248bc6cf4b036e0bac6b79b293 Mon Sep 17 00:00:00 2001 From: Tom Moor <tom@getoutline.com> Date: Tue, 1 Sep 2026 02:12:39 -0400 Subject: [PATCH 029/181] fix: Preserve MCP attachment form values (#13597) * fix: Preserve MCP attachment form values * fix: Escape MCP attachment form arguments * fix: Support current TypeScript library target --- server/tools/attachments.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/server/tools/attachments.ts b/server/tools/attachments.ts index ab79ffcff7..24e4325e71 100644 --- a/server/tools/attachments.ts +++ b/server/tools/attachments.ts @@ -147,7 +147,9 @@ export function attachmentTools(server: McpServer, scopes: string[]) { }; const formArgs = Object.entries(form) - .map(([k, v]) => `-F '${k}=${v}'`) + .map( + ([k, v]) => `--form-string ${quoteShellArgument(`${k}=${v}`)}` + ) .join(" "); const curlCommand = `curl -X POST ${formArgs} -F 'file=@/path/to/file' '${uploadUrl}'`; @@ -171,3 +173,7 @@ export function attachmentTools(server: McpServer, scopes: string[]) { ); } } + +function quoteShellArgument(value: string) { + return `'${value.replace(/'/g, "'\\''")}'`; +} From 2dfc26f14bca5bb00d96748e0f59bc7eb394ed12 Mon Sep 17 00:00:00 2001 From: Tom Moor <tom@getoutline.com> Date: Tue, 1 Sep 2026 02:36:21 -0400 Subject: [PATCH 030/181] fix: Provision OIDC users with locale claim (#13601) --- app/hooks/useFormatNumber.ts | 4 +- app/scenes/Document/components/Editor.tsx | 2 +- app/utils/language.ts | 59 -------------- plugins/oidc/server/auth/oidcRouter.ts | 4 + shared/utils/language.test.ts | 41 ++++++++++ shared/utils/language.ts | 93 +++++++++++++++++++++++ 6 files changed, 141 insertions(+), 62 deletions(-) create mode 100644 shared/utils/language.test.ts create mode 100644 shared/utils/language.ts diff --git a/app/hooks/useFormatNumber.ts b/app/hooks/useFormatNumber.ts index e492a7cd9f..9750243d0b 100644 --- a/app/hooks/useFormatNumber.ts +++ b/app/hooks/useFormatNumber.ts @@ -1,6 +1,6 @@ -import { formatNumber } from "~/utils/language"; -import useUserLocale from "./useUserLocale"; import { unicodeCLDRtoBCP47 } from "@shared/utils/date"; +import { formatNumber } from "@shared/utils/language"; +import useUserLocale from "./useUserLocale"; /** * Hook that returns a function to format numbers based on the user's locale. diff --git a/app/scenes/Document/components/Editor.tsx b/app/scenes/Document/components/Editor.tsx index 91ed7abdd8..fe50489980 100644 --- a/app/scenes/Document/components/Editor.tsx +++ b/app/scenes/Document/components/Editor.tsx @@ -7,6 +7,7 @@ import styled from "styled-components"; import Text from "@shared/components/Text"; import type { CommentAnchor } from "@shared/editor/commands/comment"; import { richExtensions, withComments } from "@shared/editor/nodes"; +import { getLangFor } from "@shared/utils/language"; import { DocumentPreference } from "@shared/types"; import { colorPalette } from "@shared/constants"; import Comment from "~/models/Comment"; @@ -38,7 +39,6 @@ import MultiplayerEditor from "./AsyncMultiplayerEditor"; import DocumentMeta from "./DocumentMeta"; import DocumentTitle from "./DocumentTitle"; import { first } from "es-toolkit/compat"; -import { getLangFor } from "~/utils/language"; import useShare from "@shared/hooks/useShare"; import CodeWordBreak from "@shared/editor/extensions/CodeWordBreak"; diff --git a/app/utils/language.ts b/app/utils/language.ts index 7095dc7284..a9e53a08d5 100644 --- a/app/utils/language.ts +++ b/app/utils/language.ts @@ -4,22 +4,6 @@ import { unicodeCLDRtoBCP47 } from "@shared/utils/date"; import { isRTLLanguage } from "@shared/utils/rtl"; import Desktop from "./Desktop"; -/** - * Formats a number using the user's locale where possible. Use `useFormatNumber` hook - * instead of this function in React components, to automatically use the user's locale. - * - * @param number The number to format - * @param locale The locale to use for formatting (BCP47 format) - * @returns The formatted number as a string - */ -export function formatNumber(number: number, locale: string) { - try { - return new Intl.NumberFormat(locale).format(number); - } catch (_err) { - return number.toString(); - } -} - /** * Detects the user's language based on the browser's language settings. * @@ -55,46 +39,3 @@ export async function changeLanguage( document.documentElement.dir = isRTLLanguage(locale) ? "rtl" : "ltr"; } } - -/** - * Languages with special styling, in ISO 639-1 format. - */ -const scriptsWithLang = new Set([ - "th", // Thai - "lo", // Lao - "km", // Khmer - "my", // Burmese - "hi", // Hindi - "mr", // Marathi - "ne", // Nepali - "bn", // Bengali - "gu", // Gujarati - "pa", // Punjabi - "te", // Telugu - "ta", // Tamil - "ml", // Malayalam - "si", // Sinhala - "bo", // Tibetan - "ar", // Arabic - "fa", // Persian - "ur", // Urdu - "he", // Hebrew - "am", // Amharic - "mn", // Mongolian -]); - -/** - * Returns the language code if it requires special text styling, otherwise undefined. - * This is used to determine if a lang attribute should be set on elements for CSS styling. - * - * @param langCode The language code to check, in ISO 639-1 format - * @returns The language code if it requires special styling, otherwise undefined - */ -export function getLangFor( - langCode: string | null | undefined -): string | undefined { - if (!langCode) { - return undefined; - } - return scriptsWithLang.has(langCode) ? langCode : undefined; -} diff --git a/plugins/oidc/server/auth/oidcRouter.ts b/plugins/oidc/server/auth/oidcRouter.ts index db936004a1..e7e959b55d 100644 --- a/plugins/oidc/server/auth/oidcRouter.ts +++ b/plugins/oidc/server/auth/oidcRouter.ts @@ -6,6 +6,7 @@ import { get } from "es-toolkit/compat"; import { toError } from "@shared/utils/error"; import { slugifyDomain } from "@shared/utils/domains"; import { parseEmail } from "@shared/utils/email"; +import { getSupportedLanguage } from "@shared/utils/language"; import { isBase64Url } from "@shared/utils/urls"; import accountProvisioner from "@server/commands/accountProvisioner"; import { @@ -112,6 +113,7 @@ export function createOIDCRouter( return decoded as { email?: string; email_verified?: boolean | string; + locale?: string; preferred_username?: string; sub?: string; }; @@ -122,6 +124,7 @@ export function createOIDCRouter( })(); const email = profile.email ?? token.email ?? null; + const language = getSupportedLanguage(profile.locale, token.locale); if (!email) { throw AuthenticationError( @@ -241,6 +244,7 @@ export function createOIDCRouter( email, emailVerified, avatarUrl, + language, }, authenticationProvider: { name: config.id, diff --git a/shared/utils/language.test.ts b/shared/utils/language.test.ts new file mode 100644 index 0000000000..af699a3451 --- /dev/null +++ b/shared/utils/language.test.ts @@ -0,0 +1,41 @@ +import { formatNumber, getLangFor, getSupportedLanguage } from "./language"; + +describe("formatNumber", () => { + it("formats a number with the specified locale", () => { + expect(formatNumber(1234, "en-US")).toEqual("1,234"); + }); + + it("returns the unformatted number for an invalid locale", () => { + expect(formatNumber(1234, "invalid_locale")).toEqual("1234"); + }); +}); + +describe("getSupportedLanguage", () => { + it("converts a supported BCP 47 locale", () => { + expect(getSupportedLanguage("pt-BR")).toEqual("pt_BR"); + }); + + it("accepts a supported CLDR locale", () => { + expect(getSupportedLanguage("pt_BR")).toEqual("pt_BR"); + }); + + it("returns the first supported locale", () => { + expect(getSupportedLanguage(undefined, "en-US")).toEqual("en_US"); + }); + + it("ignores unsupported and malformed locales", () => { + expect(getSupportedLanguage("invalid_locale", "en-US")).toEqual("en_US"); + expect(getSupportedLanguage("en-CA")).toBeUndefined(); + }); +}); + +describe("getLangFor", () => { + it("returns languages that need special text styling", () => { + expect(getLangFor("fa")).toEqual("fa"); + }); + + it("ignores other or empty languages", () => { + expect(getLangFor("en")).toBeUndefined(); + expect(getLangFor(null)).toBeUndefined(); + }); +}); diff --git a/shared/utils/language.ts b/shared/utils/language.ts new file mode 100644 index 0000000000..4220a9ad82 --- /dev/null +++ b/shared/utils/language.ts @@ -0,0 +1,93 @@ +import { languages } from "../i18n"; +import { unicodeBCP47toCLDR, unicodeCLDRtoBCP47 } from "./date"; + +/** + * Formats a number using the specified locale where possible. + * + * @param number the number to format. + * @param locale the locale to use in BCP 47 format. + * @return the formatted number as a string. + */ +export function formatNumber(number: number, locale: string): string { + try { + return new Intl.NumberFormat(locale).format(number); + } catch { + return number.toString(); + } +} + +/** + * Returns the first supported language from BCP 47 or CLDR locale values. + * + * @param locales the locale values in priority order. + * @return the supported language in CLDR format, or undefined. + */ +export function getSupportedLanguage( + ...locales: unknown[] +): string | undefined { + for (const locale of locales) { + if (typeof locale !== "string") { + continue; + } + + let canonicalLocale; + try { + [canonicalLocale] = Intl.getCanonicalLocales(unicodeCLDRtoBCP47(locale)); + } catch { + continue; + } + + const language = unicodeBCP47toCLDR(canonicalLocale); + const supportedLanguage = languages.find( + (candidate) => candidate === language + ); + if (supportedLanguage) { + return supportedLanguage; + } + } + + return undefined; +} + +/** + * Returns the language code if it needs special text styling. + * + * @param language the language code to check in ISO 639-1 format. + * @return the language code if it needs special styling, or undefined. + */ +export function getLangFor( + language: string | null | undefined +): string | undefined { + if (!language) { + return undefined; + } + + return scriptsWithLang.has(language) ? language : undefined; +} + +/** + * Languages with special styling, in ISO 639-1 format. + */ +const scriptsWithLang = new Set([ + "th", // Thai + "lo", // Lao + "km", // Khmer + "my", // Burmese + "hi", // Hindi + "mr", // Marathi + "ne", // Nepali + "bn", // Bengali + "gu", // Gujarati + "pa", // Punjabi + "te", // Telugu + "ta", // Tamil + "ml", // Malayalam + "si", // Sinhala + "bo", // Tibetan + "ar", // Arabic + "fa", // Persian + "ur", // Urdu + "he", // Hebrew + "am", // Amharic + "mn", // Mongolian +]); From 22a1e1d45b3c4181970c886ab6440a0d6dc1ec09 Mon Sep 17 00:00:00 2001 From: Tom Moor <tom@getoutline.com> Date: Tue, 1 Sep 2026 02:36:30 -0400 Subject: [PATCH 031/181] fix: Match PWA chrome to active theme (#13599) --- app/components/PageTheme.ts | 20 ++++++++++----- app/stores/UiStore.ts | 4 +++ server/static/index.html | 51 +++++++++++++++++++++++++++++-------- 3 files changed, 58 insertions(+), 17 deletions(-) diff --git a/app/components/PageTheme.ts b/app/components/PageTheme.ts index e78a12a744..6dfee07cbf 100644 --- a/app/components/PageTheme.ts +++ b/app/components/PageTheme.ts @@ -2,12 +2,18 @@ import { useEffect } from "react"; import { useTheme } from "styled-components"; import { light } from "@shared/styles/theme"; +/** + * Synchronizes browser page colors with the active application theme. + * + * @returns null. + */ export default function PageTheme() { const theme = useTheme(); + const { background, isDark } = theme; useEffect(() => { - // theme-color adjusts the title bar color for desktop PWA - const themeElement = document.querySelector('meta[name="theme-color"]'); + // theme-color adjusts the browser chrome for installed PWAs + const themeElements = document.querySelectorAll('meta[name="theme-color"]'); // color-scheme controls user-agent controls, scrollbars and the page canvas const colorSchemeElement = document.querySelector( @@ -19,17 +25,19 @@ export default function PageTheme() { if (document.body) { document.body.style.background = background; } - themeElement?.setAttribute("content", background); + themeElements.forEach((element) => { + element.setAttribute("content", background); + }); colorSchemeElement?.setAttribute("content", isDark ? "dark" : "light"); }; - applyTheme(theme.background, theme.isDark); + applyTheme(background, isDark); const handleChange = (event: MediaQueryListEvent) => { if (event.matches) { applyTheme(light.background, false); } else { - applyTheme(theme.background, theme.isDark); + applyTheme(background, isDark); } }; @@ -39,7 +47,7 @@ export default function PageTheme() { const mediaQuery = window.matchMedia("print"); mediaQuery.addEventListener("change", handleChange); return () => mediaQuery.removeEventListener("change", handleChange); - }, [theme]); + }, [background, isDark]); return null; } diff --git a/app/stores/UiStore.ts b/app/stores/UiStore.ts index d0c441b007..2bb5bdc65c 100644 --- a/app/stores/UiStore.ts +++ b/app/stores/UiStore.ts @@ -16,6 +16,8 @@ import { startViewTransition } from "~/utils/viewTransition"; import type RootStore from "./RootStore"; const UI_STORE = "UI_STORE"; +// Used by the static page before the UI store is available. +const THEME_STORAGE_KEY = "theme"; export enum Theme { Light = "light", @@ -175,6 +177,7 @@ class UiStore { this.tocVisible = data.tocVisible; this.rightSidebar = data.rightSidebar ?? null; this.theme = data.theme || Theme.System; + Storage.set(THEME_STORAGE_KEY, this.theme); // system theme listeners if (window.matchMedia) { @@ -312,6 +315,7 @@ class UiStore { flushSync(() => { this.theme = theme; this.persist(); + Storage.set(THEME_STORAGE_KEY, this.theme); }); }); }; diff --git a/server/static/index.html b/server/static/index.html index f3efa1469e..03a54a1cc2 100644 --- a/server/static/index.html +++ b/server/static/index.html @@ -2,7 +2,43 @@ <html lang="{lang}"> <head> <title>{title} - + + + {env} {script-tags}
{content}
From 9d29580e7f6f03291a492740d76f438c0b799304 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Tue, 1 Sep 2026 03:14:30 -0400 Subject: [PATCH 032/181] fix: Apply document download policy to revision export (#13603) Co-authored-by: Claude Opus 5 (1M context) --- server/routes/api/revisions/revisions.test.ts | 54 ++++++++++++++++++- server/routes/api/revisions/revisions.ts | 1 + 2 files changed, 54 insertions(+), 1 deletion(-) diff --git a/server/routes/api/revisions/revisions.test.ts b/server/routes/api/revisions/revisions.test.ts index e13166c6ee..788b6ab620 100644 --- a/server/routes/api/revisions/revisions.test.ts +++ b/server/routes/api/revisions/revisions.test.ts @@ -1,4 +1,8 @@ -import { DocumentPermission, ExportContentType } from "@shared/types"; +import { + DocumentPermission, + ExportContentType, + TeamPreference, +} from "@shared/types"; import { createContext } from "@server/context"; import { UserMembership, Revision } from "@server/models"; import FileStorage from "@server/storage/files"; @@ -7,7 +11,9 @@ import { buildAttachment, buildCollection, buildDocument, + buildTeam, buildUser, + buildViewer, } from "@server/test/factories"; import { getTestServer, readZipResponse } from "@server/test/support"; @@ -531,4 +537,50 @@ describe("#revisions.export", () => { }); expect(res.status).toEqual(403); }); + + it("should not allow viewer to export when disabled for team", async () => { + const team = await buildTeam(); + team.setPreference(TeamPreference.ViewersCanExport, false); + await team.save(); + + const author = await buildUser({ teamId: team.id }); + const viewer = await buildViewer({ teamId: team.id }); + const document = await buildDocument({ + teamId: team.id, + userId: author.id, + }); + const revision = await Revision.createFromDocument( + createContext({ user: author }), + document + ); + const res = await server.post("/api/revisions.export", viewer, { + body: { + id: revision.id, + }, + }); + expect(res.status).toEqual(403); + }); + + it("should allow viewer to export when enabled for team", async () => { + const team = await buildTeam(); + team.setPreference(TeamPreference.ViewersCanExport, true); + await team.save(); + + const author = await buildUser({ teamId: team.id }); + const viewer = await buildViewer({ teamId: team.id }); + const document = await buildDocument({ + teamId: team.id, + userId: author.id, + }); + const revision = await Revision.createFromDocument( + createContext({ user: author }), + document + ); + const res = await server.post("/api/revisions.export", viewer, { + body: { + id: revision.id, + }, + }); + expect(res.status).toEqual(200); + }); }); diff --git a/server/routes/api/revisions/revisions.ts b/server/routes/api/revisions/revisions.ts index 789140150b..36f2afb750 100644 --- a/server/routes/api/revisions/revisions.ts +++ b/server/routes/api/revisions/revisions.ts @@ -150,6 +150,7 @@ router.post( includeViews: false, }); authorize(user, "listRevisions", document); + authorize(user, "download", document); let contentType: string; let content: string; From 0a3851edb3417e3cd32be4f1cb16e7fe7c7f8b76 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Tue, 1 Sep 2026 03:14:41 -0400 Subject: [PATCH 033/181] fix: Keep expanded code blocks open after undo (#13600) * fix: Preserve expanded code blocks after undo * refactor: Rename used editor state parameter --- shared/editor/nodes/CodeFence.ts | 50 ++++++++++++++++++++++++++++---- 1 file changed, 44 insertions(+), 6 deletions(-) diff --git a/shared/editor/nodes/CodeFence.ts b/shared/editor/nodes/CodeFence.ts index 792caf529f..3ebf21ce1a 100644 --- a/shared/editor/nodes/CodeFence.ts +++ b/shared/editor/nodes/CodeFence.ts @@ -42,7 +42,7 @@ import { setRecentlyUsedCodeLanguage, } from "../lib/code"; import { isCode, isMermaid } from "../lib/isCode"; -import { isRemoteTransaction } from "../lib/multiplayer"; +import { isRemoteTransaction, mapDecorations } from "../lib/multiplayer"; import { findBlockNodes } from "../queries/findChildren"; import type { MarkdownSerializerState } from "../lib/markdown/serializer"; import { escapeRawTableCell } from "../lib/markdown/tableCell"; @@ -445,7 +445,7 @@ export default class CodeFence extends Node { const tallBlocks = findTallBlocks(state.doc); return build(state.doc, tallBlocks, new Set(tallBlocks)); }, - apply: (tr, prev, _oldState, newState) => { + apply: (tr, prev, oldState, newState) => { const meta = tr.getMeta(collapseKey); // Toggle collapsed state @@ -477,14 +477,52 @@ export default class CodeFence extends Node { const tallBlocks = findTallBlocks(newState.doc); const collapsedBlocks = new Set(); const isRemote = isRemoteTransaction(tr, newState); + const previousBlockDecorations: Decoration[] = []; + for (const pos of prev.tallBlocks) { + const node = oldState.doc.nodeAt(pos); + if (!node || !isCode(node)) { + continue; + } + + previousBlockDecorations.push( + Decoration.node( + pos, + pos + node.nodeSize, + {}, + { + collapsed: prev.collapsedBlocks.has(pos), + trackedCodeBlock: true, + } + ) + ); + } + + const mappedTallBlocks = new Set(); + const mappedCollapsedBlocks = new Set(); + const previousBlocks = DecorationSet.create( + oldState.doc, + previousBlockDecorations + ); + for (const decoration of mapDecorations( + previousBlocks, + tr, + newState + ).find()) { + if (!decoration.spec.trackedCodeBlock) { + continue; + } + + mappedTallBlocks.add(decoration.from); + if (decoration.spec.collapsed) { + mappedCollapsedBlocks.add(decoration.from); + } + } - const inverse = tr.mapping.invert(); for (const pos of tallBlocks) { - const oldPos = inverse.map(pos); - if (isRemote && !prev.tallBlocks.has(oldPos)) { + if (isRemote && !mappedTallBlocks.has(pos)) { // Newly tall blocks start collapsed on load collapsedBlocks.add(pos); - } else if (prev.collapsedBlocks.has(oldPos)) { + } else if (mappedCollapsedBlocks.has(pos)) { // Preserve previous collapsed state collapsedBlocks.add(pos); } From 92af44f4b6ef5cf051483476a3ef41332b4ac7fb Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Tue, 1 Sep 2026 03:23:52 -0400 Subject: [PATCH 034/181] fix: preserve quoted tables during document patches (#13604) --- server/commands/documentUpdater.test.ts | 126 ++++++++++++++++++++++- shared/editor/lib/markdown/serializer.ts | 3 + 2 files changed, 128 insertions(+), 1 deletion(-) diff --git a/server/commands/documentUpdater.test.ts b/server/commands/documentUpdater.test.ts index 0e1cf5b565..81cf43567f 100644 --- a/server/commands/documentUpdater.test.ts +++ b/server/commands/documentUpdater.test.ts @@ -1,6 +1,6 @@ import { randomUUID } from "node:crypto"; import * as Y from "yjs"; -import { TextEditMode } from "@shared/types"; +import { TextEditMode, type ProsemirrorData } from "@shared/types"; import { APIUpdateExtension } from "@server/collaboration/APIUpdateExtension"; import { Event } from "@server/models"; import { parser } from "@server/editor"; @@ -1393,6 +1393,130 @@ describe("documentUpdater", () => { expect(blockquote.content![1]).toEqual(secondPara); }); + it("should preserve a blockquote containing a table when patching a later link", async () => { + const user = await buildUser(); + const document = await buildDocument({ teamId: user.teamId }); + const fillerParagraphs: ProsemirrorData[] = Array.from( + { length: 242 }, + (_, index) => ({ + type: "paragraph", + content: [{ type: "text", text: `Quoted paragraph ${index + 1}` }], + }) + ); + + document.content = { + type: "doc", + content: [ + { + type: "paragraph", + content: [{ type: "text", text: "Before quote" }], + }, + { + type: "blockquote", + content: [ + { + type: "heading", + attrs: { level: 1 }, + content: [{ type: "text", text: "Quoted source" }], + }, + { + type: "table", + content: [ + { + type: "tr", + content: [ + { + type: "th", + content: [ + { + type: "paragraph", + content: [{ type: "text", text: "Key" }], + }, + ], + }, + { + type: "th", + content: [ + { + type: "paragraph", + content: [{ type: "text", text: "Value" }], + }, + ], + }, + ], + }, + { + type: "tr", + content: [ + { + type: "td", + content: [ + { + type: "paragraph", + content: [{ type: "text", text: "Alpha" }], + }, + ], + }, + { + type: "td", + content: [ + { + type: "paragraph", + content: [{ type: "text", text: "Keep this row" }], + }, + ], + }, + ], + }, + ], + }, + ...fillerParagraphs, + { + type: "paragraph", + content: [ + { type: "text", text: "See " }, + { + type: "text", + marks: [ + { + type: "link", + attrs: { href: "https://example.com/reference" }, + }, + ], + text: "Reference", + }, + { type: "text", text: "." }, + ], + }, + { + type: "paragraph", + content: [{ type: "text", text: "Tail sentinel." }], + }, + ], + }, + { + type: "paragraph", + content: [{ type: "text", text: "After quote" }], + }, + ], + }; + await document.save(); + + const beforeDoc = DocumentHelper.toProsemirror(document).toJSON(); + const expected = structuredClone(beforeDoc); + expected.content[1].content[244].content[1].marks[0].attrs.href = + "https://example.com/reference#h-target"; + + const result = DocumentHelper.applyMarkdownToDocument( + document, + "> See [Reference](https://example.com/reference#h-target).", + TextEditMode.Patch, + "> See [Reference](https://example.com/reference)." + ); + + expect(result.content).toEqual(expected); + }); + it("should always patch the first occurrence when findText appears multiple times", async () => { const user = await buildUser(); let document = await buildDocument({ diff --git a/shared/editor/lib/markdown/serializer.ts b/shared/editor/lib/markdown/serializer.ts index 83612816c4..476bfe25dd 100644 --- a/shared/editor/lib/markdown/serializer.ts +++ b/shared/editor/lib/markdown/serializer.ts @@ -482,10 +482,12 @@ export class MarkdownSerializerState { }); // Ensure there is an empty newline above all tables + this.write(); this.append("\n"); // Render rows node.forEach((row, _, i) => { + this.write(); row.forEach((cell, _, j) => { this.append(j === 0 ? "| " : " | "); @@ -528,6 +530,7 @@ export class MarkdownSerializerState { // Header separator after first row if (i === 0) { + this.write(); headerRow.forEach((cell, _, j) => { const width = columnWidths[j]; if (cell.attrs.alignment === "center") { From d9f78bbeb1414c6d11a7ac28d92759bc76347fab Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Tue, 1 Sep 2026 08:51:00 -0400 Subject: [PATCH 035/181] fix: Deadlock on cleanup task retry (#13598) * fix: Deadlock on cleanup task retry * Add transaction advisory lock around team deletion --- server/commands/teamPermanentDeleter.ts | 14 +++++ .../tasks/CleanupDeletedDocumentsTask.ts | 7 ++- .../queues/tasks/CleanupDeletedTeamsTask.ts | 11 +++- server/storage/LockHelper.test.ts | 55 +++++++++++++++++++ server/storage/LockHelper.ts | 29 ++++++++++ 5 files changed, 112 insertions(+), 4 deletions(-) diff --git a/server/commands/teamPermanentDeleter.ts b/server/commands/teamPermanentDeleter.ts index 5408d7ef72..67943d5373 100644 --- a/server/commands/teamPermanentDeleter.ts +++ b/server/commands/teamPermanentDeleter.ts @@ -19,6 +19,7 @@ import { Share, } from "@server/models"; import { sequelize } from "@server/storage/database"; +import { LockHelper } from "@server/storage/LockHelper"; /** * Permanently deletes a team and all related data from the database. Note that this does not happen @@ -109,6 +110,19 @@ async function teamPermanentDeleter(team: Team) { // Destory team-relation models await sequelize.transaction(async (transaction) => { + const acquired = await LockHelper.tryAcquire( + sequelize, + `teamPermanentDeleter:${teamId}`, + transaction + ); + if (!acquired) { + Logger.info( + "commands", + `Team ${teamId} is already being destroyed, skipping` + ); + return; + } + await AuthenticationProvider.destroy({ where: { teamId, diff --git a/server/queues/tasks/CleanupDeletedDocumentsTask.ts b/server/queues/tasks/CleanupDeletedDocumentsTask.ts index 42224c3219..21c537b6b4 100644 --- a/server/queues/tasks/CleanupDeletedDocumentsTask.ts +++ b/server/queues/tasks/CleanupDeletedDocumentsTask.ts @@ -31,7 +31,12 @@ export default class CleanupDeletedDocumentsTask extends CronTask { public get options() { return { - attempts: 1, + attempts: 3, + backoff: { + type: "exponential", + // Wait until the active partition window has ended before retrying. + delay: 15 * Minute.ms, + }, priority: TaskPriority.Background, }; } diff --git a/server/queues/tasks/CleanupDeletedTeamsTask.ts b/server/queues/tasks/CleanupDeletedTeamsTask.ts index fb5e6eb83b..9dbeaf3e02 100644 --- a/server/queues/tasks/CleanupDeletedTeamsTask.ts +++ b/server/queues/tasks/CleanupDeletedTeamsTask.ts @@ -27,9 +27,14 @@ export default class CleanupDeletedTeamsTask extends CronTask { }); for (const team of teams) { - await new CleanupDeletedTeamTask().schedule({ - teamId: team.id, - }); + await new CleanupDeletedTeamTask().schedule( + { + teamId: team.id, + }, + { + jobId: `cleanup-team:${team.id}`, + } + ); } } diff --git a/server/storage/LockHelper.test.ts b/server/storage/LockHelper.test.ts index 46a9122a3b..cd143aa792 100644 --- a/server/storage/LockHelper.test.ts +++ b/server/storage/LockHelper.test.ts @@ -59,4 +59,59 @@ describe("LockHelper", () => { ).resolves.toBeUndefined(); }); }); + + describe("tryAcquire", () => { + it("should return false rather than block when the lock is held", async () => { + let release: () => void = () => undefined; + const held = new Promise((resolve) => { + release = resolve; + }); + let acquired = false; + + const first = sequelize.transaction(async (transaction) => { + await LockHelper.acquire(sequelize, "try:one", transaction); + acquired = true; + await held; + }); + + while (!acquired) { + await sleep(10); + } + + await expect( + sequelize.transaction((transaction) => + LockHelper.tryAcquire(sequelize, "try:one", transaction) + ) + ).resolves.toBe(false); + + release(); + await first; + }); + + it("should return true when the lock is free", async () => { + await expect( + sequelize.transaction((transaction) => + LockHelper.tryAcquire(sequelize, "try:two", transaction) + ) + ).resolves.toBe(true); + }); + + it("should release the lock when the transaction ends", async () => { + await sequelize.transaction((transaction) => + LockHelper.tryAcquire(sequelize, "try:three", transaction) + ); + + await expect( + sequelize.transaction((transaction) => + LockHelper.tryAcquire(sequelize, "try:three", transaction) + ) + ).resolves.toBe(true); + }); + + it("should allow the caller to proceed without a transaction", async () => { + await expect(LockHelper.tryAcquire(sequelize, "try:four")).resolves.toBe( + true + ); + }); + }); }); diff --git a/server/storage/LockHelper.ts b/server/storage/LockHelper.ts index c860c2dabb..08f5e475a9 100644 --- a/server/storage/LockHelper.ts +++ b/server/storage/LockHelper.ts @@ -37,4 +37,33 @@ export class LockHelper { transaction, }); } + + /** + * Attempts to acquire a transaction advisory lock without waiting. + * + * @param sequelize the database connection. + * @param name the lock name. + * @param transaction the lock transaction. + * @returns true if the lock was acquired. + */ + public static async tryAcquire( + sequelize: Sequelize, + name: string, + transaction?: Transaction | null + ): Promise { + if (!transaction) { + return true; + } + + const rows = await sequelize.query<{ locked: boolean }>( + "SELECT pg_try_advisory_xact_lock(hashtext(:name)) AS locked", + { + replacements: { name }, + type: QueryTypes.SELECT, + transaction, + } + ); + + return rows[0]?.locked ?? false; + } } From 2420d8eb8bfa6bdf6dd5b41ba779d2896b168448 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 1 Sep 2026 18:46:20 -0400 Subject: [PATCH 036/181] chore(deps-dev): bump @vitest/ui from 4.1.10 to 4.1.11 (#13593) Bumps [@vitest/ui](https://github.com/vitest-dev/vitest/tree/HEAD/packages/ui) from 4.1.10 to 4.1.11. - [Release notes](https://github.com/vitest-dev/vitest/releases) - [Changelog](https://github.com/vitest-dev/vitest/blob/main/docs/releases.md) - [Commits](https://github.com/vitest-dev/vitest/commits/v4.1.11/packages/ui) --- updated-dependencies: - dependency-name: "@vitest/ui" dependency-version: 4.1.11 dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 34 +++++++++++++++++++++++++++------- 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index bf258decfe..ada938dd91 100644 --- a/package.json +++ b/package.json @@ -349,7 +349,7 @@ "@types/validator": "^13.15.10", "@types/yauzl": "^2.10.3", "@types/yazl": "^3.3.1", - "@vitest/ui": "^4.1.10", + "@vitest/ui": "^4.1.11", "browserslist-to-esbuild": "^1.2.0", "concurrently": "^8.2.2", "discord-api-types": "^0.38.48", diff --git a/yarn.lock b/yarn.lock index 9997b80164..cd175134b8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7658,6 +7658,15 @@ __metadata: languageName: node linkType: hard +"@vitest/pretty-format@npm:4.1.11": + version: 4.1.11 + resolution: "@vitest/pretty-format@npm:4.1.11" + dependencies: + tinyrainbow: "npm:^3.1.0" + checksum: 10c0/ad32525c73807c0b72f38dc29bc51fd5a17879dc650f37995a9c5adbb8526e15f787691f76aa8768448ec7ed5bf5ba2b12329eac8fda1428b4d6b8c036390f71 + languageName: node + linkType: hard + "@vitest/runner@npm:4.1.10": version: 4.1.10 resolution: "@vitest/runner@npm:4.1.10" @@ -7687,11 +7696,11 @@ __metadata: languageName: node linkType: hard -"@vitest/ui@npm:^4.1.10": - version: 4.1.10 - resolution: "@vitest/ui@npm:4.1.10" +"@vitest/ui@npm:^4.1.11": + version: 4.1.11 + resolution: "@vitest/ui@npm:4.1.11" dependencies: - "@vitest/utils": "npm:4.1.10" + "@vitest/utils": "npm:4.1.11" fflate: "npm:^0.8.2" flatted: "npm:^3.4.2" pathe: "npm:^2.0.3" @@ -7699,8 +7708,8 @@ __metadata: tinyglobby: "npm:^0.2.15" tinyrainbow: "npm:^3.1.0" peerDependencies: - vitest: 4.1.10 - checksum: 10c0/59cd54e3a3c512de00828f0b739323d0c076dc3577fd13678b270f716120d92d10f4922a55363ab9e1de78c42a6b68831f6b7eaaad2d3df86ed9ab856e17b469 + vitest: 4.1.11 + checksum: 10c0/8e6099bab10c1f713f83cbdf1543147824a4312478c96967da8dcb72b5f2a9133574543dd7f3659259046ccdbaec727cc097003e47046c81ef5a2c6c02c5b7c1 languageName: node linkType: hard @@ -7715,6 +7724,17 @@ __metadata: languageName: node linkType: hard +"@vitest/utils@npm:4.1.11": + version: 4.1.11 + resolution: "@vitest/utils@npm:4.1.11" + dependencies: + "@vitest/pretty-format": "npm:4.1.11" + convert-source-map: "npm:^2.0.0" + tinyrainbow: "npm:^3.1.0" + checksum: 10c0/a2c1ddc64333458c3e031465c1ee0440a7660fd1b298c54ccbf865ef1e5cf3ebdd6c5c75a5ea235d8a672498b394e7121f992b096f021f45014ab25e9abd1b52 + languageName: node + linkType: hard + "@xhmikosr/archive-type@npm:^8.0.1": version: 8.1.0 resolution: "@xhmikosr/archive-type@npm:8.1.0" @@ -15689,7 +15709,7 @@ __metadata: "@types/yauzl": "npm:^2.10.3" "@types/yazl": "npm:^3.3.1" "@vitejs/plugin-react": "npm:^6.0.5" - "@vitest/ui": "npm:^4.1.10" + "@vitest/ui": "npm:^4.1.11" addressparser: "npm:^1.0.1" async-sema: "npm:^3.1.1" browserslist-to-esbuild: "npm:^1.2.0" From 656b7f6e6419fc42283cadee7a2a4e8af60cc21d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 1 Sep 2026 18:46:33 -0400 Subject: [PATCH 037/181] chore(deps): bump ws from 7.5.11 to 7.5.13 (#13592) Bumps [ws](https://github.com/websockets/ws) from 7.5.11 to 7.5.13. - [Release notes](https://github.com/websockets/ws/releases) - [Commits](https://github.com/websockets/ws/compare/7.5.11...7.5.13) --- updated-dependencies: - dependency-name: ws dependency-version: 7.5.13 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 19 +++++++++++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index ada938dd91..d0c89a0012 100644 --- a/package.json +++ b/package.json @@ -273,7 +273,7 @@ "vite": "^8.1.5", "vite-plugin-pwa": "1.3.0", "winston": "^3.17.0", - "ws": "^7.5.11", + "ws": "^7.5.13", "y-prosemirror": "^1.3.7", "y-protocols": "^1.0.7", "yauzl": "^3.3.1", diff --git a/yarn.lock b/yarn.lock index cd175134b8..6b1f3220f5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -15889,7 +15889,7 @@ __metadata: vite-tsconfig-paths: "npm:^6.1.1" vitest: "npm:^4.1.10" winston: "npm:^3.17.0" - ws: "npm:^7.5.11" + ws: "npm:^7.5.13" y-prosemirror: "npm:^1.3.7" y-protocols: "npm:^1.0.7" yauzl: "npm:^3.3.1" @@ -21391,7 +21391,22 @@ __metadata: languageName: node linkType: hard -"ws@npm:^7.5.11, ws@npm:^7.5.5": +"ws@npm:^7.5.13": + version: 7.5.13 + resolution: "ws@npm:7.5.13" + peerDependencies: + bufferutil: ^4.0.1 + utf-8-validate: ^5.0.2 + peerDependenciesMeta: + bufferutil: + optional: true + utf-8-validate: + optional: true + checksum: 10c0/e223726bbda5768ed58ec9252d04eda7018ef380ea122bb94e595a4d7a02b5baeb423933936576fddb8fa51b642375f7ae814bf0f6f5d9a3ce290566578a8c5a + languageName: node + linkType: hard + +"ws@npm:^7.5.5": version: 7.5.11 resolution: "ws@npm:7.5.11" peerDependencies: From 30e96d9e6fb26703f7619a19dcf9a88513282bd3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 1 Sep 2026 18:47:05 -0400 Subject: [PATCH 038/181] chore(deps-dev): bump @types/node from 20.19.39 to 20.19.43 (#13591) Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 20.19.39 to 20.19.43. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) --- updated-dependencies: - dependency-name: "@types/node" dependency-version: 20.19.43 dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index d0c89a0012..49978df490 100644 --- a/package.json +++ b/package.json @@ -318,7 +318,7 @@ "@types/markdown-it-emoji": "^3.0.1", "@types/mime-types": "^3.0.1", "@types/natural-sort": "^0.0.24", - "@types/node": "20.19.39", + "@types/node": "20.19.43", "@types/node-fetch": "^2.6.13", "@types/nodemailer": "^6.4.23", "@types/passport-oauth2": "^1.8.0", diff --git a/yarn.lock b/yarn.lock index 6b1f3220f5..49ccc24b1b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7152,12 +7152,12 @@ __metadata: languageName: node linkType: hard -"@types/node@npm:20.19.39": - version: 20.19.39 - resolution: "@types/node@npm:20.19.39" +"@types/node@npm:20.19.43": + version: 20.19.43 + resolution: "@types/node@npm:20.19.43" dependencies: undici-types: "npm:~6.21.0" - checksum: 10c0/1d16da7b5f47a7415b827fcf3b94d279febf4c14671afec74a03e47856b5270023d9beb1b9aeab4d3b622fd97d61a60206cfc2cca588663181331bc592468289 + checksum: 10c0/9bcec3b5295bdd77ff0b44a528a69f7e22028c347507ba2c69be47ec84e30299f45043b222e9c86c510e138c9c53b2419dd5cd34920602a4a5a381c288075318 languageName: node linkType: hard @@ -15675,7 +15675,7 @@ __metadata: "@types/markdown-it-emoji": "npm:^3.0.1" "@types/mime-types": "npm:^3.0.1" "@types/natural-sort": "npm:^0.0.24" - "@types/node": "npm:20.19.39" + "@types/node": "npm:20.19.43" "@types/node-fetch": "npm:^2.6.13" "@types/nodemailer": "npm:^6.4.23" "@types/pako": "npm:^2.0.4" From c0c93527360f9fddaa431d62c4588b75a9626786 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 1 Sep 2026 18:48:06 -0400 Subject: [PATCH 039/181] chore(deps): bump the sentry group with 2 updates (#13589) Bumps the sentry group with 2 updates: [@sentry/node](https://github.com/getsentry/sentry-javascript) and [@sentry/react](https://github.com/getsentry/sentry-javascript). Updates `@sentry/node` from 10.70.0 to 10.72.0 - [Release notes](https://github.com/getsentry/sentry-javascript/releases) - [Changelog](https://github.com/getsentry/sentry-javascript/blob/10.72.0/CHANGELOG.md) - [Commits](https://github.com/getsentry/sentry-javascript/compare/10.70.0...10.72.0) Updates `@sentry/react` from 10.70.0 to 10.72.0 - [Release notes](https://github.com/getsentry/sentry-javascript/releases) - [Changelog](https://github.com/getsentry/sentry-javascript/blob/10.72.0/CHANGELOG.md) - [Commits](https://github.com/getsentry/sentry-javascript/compare/10.70.0...10.72.0) --- updated-dependencies: - dependency-name: "@sentry/node" dependency-version: 10.72.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: sentry - dependency-name: "@sentry/react" dependency-version: 10.72.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: sentry ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 4 +- yarn.lock | 221 ++++++++++++++++----------------------------------- 2 files changed, 72 insertions(+), 153 deletions(-) diff --git a/package.json b/package.json index 49978df490..f9ad8f726f 100644 --- a/package.json +++ b/package.json @@ -105,8 +105,8 @@ "@radix-ui/react-toolbar": "^1.1.19", "@radix-ui/react-tooltip": "^1.2.16", "@radix-ui/react-visually-hidden": "^1.2.11", - "@sentry/node": "^10.70.0", - "@sentry/react": "^10.70.0", + "@sentry/node": "^10.72.0", + "@sentry/react": "^10.72.0", "@simplewebauthn/browser": "^13.3.0", "@simplewebauthn/server": "^13.3.1", "@tanstack/react-table": "^8.21.3", diff --git a/yarn.lock b/yarn.lock index 49ccc24b1b..f903cc6188 100644 --- a/yarn.lock +++ b/yarn.lock @@ -28,45 +28,6 @@ __metadata: languageName: node linkType: hard -"@apm-js-collab/code-transformer-bundler-plugins@npm:^0.7.3": - version: 0.7.3 - resolution: "@apm-js-collab/code-transformer-bundler-plugins@npm:0.7.3" - dependencies: - "@apm-js-collab/code-transformer": "npm:^0.18.0" - es-module-lexer: "npm:^2.1.0" - magic-string: "npm:^0.30.21" - module-details-from-path: "npm:^1.0.4" - checksum: 10c0/e7882a3c14f5f52fc2e21347fc5777672305520a1707c2ce4bc6ba1a070519ebf256b3f2a49a2a4ee78d30b23ebfdcd2a0122d75dd42260e9fbc221e65cd1b74 - languageName: node - linkType: hard - -"@apm-js-collab/code-transformer@npm:^0.18.0": - version: 0.18.1 - resolution: "@apm-js-collab/code-transformer@npm:0.18.1" - dependencies: - "@types/estree": "npm:^1.0.8" - astring: "npm:^1.9.0" - esquery: "npm:^1.7.0" - meriyah: "npm:^6.1.4" - semifies: "npm:^1.0.0" - source-map: "npm:^0.6.0" - bin: - code-transformer: cli.js - checksum: 10c0/253ba76f7efec39a337327e5f23029ab5a8c5b3e3db4e1c41b97636b8e842372c285301f7a3e3a19d344eb9a680091926f6f38e06bdd6233f33a958777094322 - languageName: node - linkType: hard - -"@apm-js-collab/tracing-hooks@npm:^0.13.0": - version: 0.13.0 - resolution: "@apm-js-collab/tracing-hooks@npm:0.13.0" - dependencies: - "@apm-js-collab/code-transformer": "npm:^0.18.0" - debug: "npm:^4.4.1" - module-details-from-path: "npm:^1.0.4" - checksum: 10c0/2891fc52b8aa2b68d59674f40f1340ce71ac68f6aff07394146565a5afcc10d99b8efe2d05af1346c188d440fcbb53c9d48eb017012417109740207e8a85e390 - languageName: node - linkType: hard - "@aws-sdk/checksums@npm:^3.1000.28": version: 3.1000.28 resolution: "@aws-sdk/checksums@npm:3.1000.28" @@ -5733,27 +5694,27 @@ __metadata: languageName: node linkType: hard -"@sentry/browser-utils@npm:10.70.0": - version: 10.70.0 - resolution: "@sentry/browser-utils@npm:10.70.0" +"@sentry/browser-utils@npm:10.72.0": + version: 10.72.0 + resolution: "@sentry/browser-utils@npm:10.72.0" dependencies: "@sentry/conventions": "npm:^0.16.0" - "@sentry/core": "npm:10.70.0" - checksum: 10c0/fd08a54bb43a674714786a0d8b7e80e6b72025347907c581cdddb37b42bca9d08c4091fed9877ff0e596fb95a1d4f98ed74dcd4702ccf1bccaef9feded6c64a5 + "@sentry/core": "npm:10.72.0" + checksum: 10c0/2ec35c405a83aa24bc455178db04ec30b0784508ed129cefb7321aa7da2a4e5f966494fbac6c3a658db3dfa90d6d849784257bc82d7afe7e574d312368efd9ca languageName: node linkType: hard -"@sentry/browser@npm:10.70.0": - version: 10.70.0 - resolution: "@sentry/browser@npm:10.70.0" +"@sentry/browser@npm:10.72.0": + version: 10.72.0 + resolution: "@sentry/browser@npm:10.72.0" dependencies: - "@sentry/browser-utils": "npm:10.70.0" + "@sentry/browser-utils": "npm:10.72.0" "@sentry/conventions": "npm:^0.16.0" - "@sentry/core": "npm:10.70.0" - "@sentry/feedback": "npm:10.70.0" - "@sentry/replay": "npm:10.70.0" - "@sentry/replay-canvas": "npm:10.70.0" - checksum: 10c0/bdd88eab14b5b61612fabcfc2857b5f83211f5729d4a72eb1e441b0aff65ce8b5ff2577eead1ae4eb38b883071c1478c4f8087ee547f0454602a1f5f952ac3c1 + "@sentry/core": "npm:10.72.0" + "@sentry/feedback": "npm:10.72.0" + "@sentry/replay": "npm:10.72.0" + "@sentry/replay-canvas": "npm:10.72.0" + checksum: 10c0/86facf754ab024407b12ca57e00ba8b8a1495c3f58bcdc17491209264fe6173285d9920dde7134a700a52f5d57bf4bfd860a31eab788baf07d710f76d3c549f1 languageName: node linkType: hard @@ -5764,31 +5725,31 @@ __metadata: languageName: node linkType: hard -"@sentry/core@npm:10.70.0": - version: 10.70.0 - resolution: "@sentry/core@npm:10.70.0" +"@sentry/core@npm:10.72.0": + version: 10.72.0 + resolution: "@sentry/core@npm:10.72.0" dependencies: "@sentry/conventions": "npm:^0.16.0" - checksum: 10c0/4625428ed269c00375d2436968d7a24e5235a9c83c2968dc237543bba606d42326b5922e2d8d08a76a15e5f8734b940c607b1d911da8906987e1259763d36e21 + checksum: 10c0/6b923a7d89c746ac87b9f1037ab08017d3c22ca1c8d295ac19bac580f58d5c354d16bd6c017c4834ded7f7a9c124c3dd876dbf256430ee6eabfed8f808b417b9 languageName: node linkType: hard -"@sentry/feedback@npm:10.70.0": - version: 10.70.0 - resolution: "@sentry/feedback@npm:10.70.0" +"@sentry/feedback@npm:10.72.0": + version: 10.72.0 + resolution: "@sentry/feedback@npm:10.72.0" dependencies: - "@sentry/core": "npm:10.70.0" - checksum: 10c0/c88d07c16454692955b6018feb93f9898384b682acfc5eb83d2813c424cad9f0beab060696dcf11fc76a50ed20bdaf0e7d77a8fef47b87b2ee83f69a718cc086 + "@sentry/core": "npm:10.72.0" + checksum: 10c0/fcfb4820c67bf1684d46a295c60e711123be518ee5d5e917efc0da36fffe4701ffaa4fc7065d1064e58f4f5af0ef84c01f18dbbc51a7fe4705c1b0919fb09278 languageName: node linkType: hard -"@sentry/node-core@npm:10.70.0": - version: 10.70.0 - resolution: "@sentry/node-core@npm:10.70.0" +"@sentry/node-core@npm:10.72.0": + version: 10.72.0 + resolution: "@sentry/node-core@npm:10.72.0" dependencies: "@sentry/conventions": "npm:^0.16.0" - "@sentry/core": "npm:10.70.0" - "@sentry/opentelemetry": "npm:10.70.0" + "@sentry/core": "npm:10.72.0" + "@sentry/opentelemetry": "npm:10.72.0" import-in-the-middle: "npm:^3.0.0" peerDependencies: "@opentelemetry/api": ^1.9.0 @@ -5807,84 +5768,81 @@ __metadata: optional: true "@opentelemetry/sdk-trace-base": optional: true - checksum: 10c0/1dfe79bb0c290bc8623d037262e1e22c70acf7ca76be29379e4f32900b48cce5219ac73d8dd765722d8325b69b4a2333a4a75f5c6135adae62105009e810ea45 + checksum: 10c0/b1d25d00a8c6ec1f21700d9a7e4146830b66f311362fae51162be8b702990d4b883c9ed449d55c0ae57a410b6d440e8384cb65dfa9dccab6eb6ceabafb66974d languageName: node linkType: hard -"@sentry/node@npm:^10.70.0": - version: 10.70.0 - resolution: "@sentry/node@npm:10.70.0" +"@sentry/node@npm:^10.72.0": + version: 10.72.0 + resolution: "@sentry/node@npm:10.72.0" dependencies: "@opentelemetry/api": "npm:^1.9.1" "@opentelemetry/instrumentation": "npm:^0.220.0" "@opentelemetry/sdk-trace-base": "npm:^2.9.0" "@sentry/conventions": "npm:^0.16.0" - "@sentry/core": "npm:10.70.0" - "@sentry/node-core": "npm:10.70.0" - "@sentry/opentelemetry": "npm:10.70.0" - "@sentry/server-utils": "npm:10.70.0" + "@sentry/core": "npm:10.72.0" + "@sentry/node-core": "npm:10.72.0" + "@sentry/opentelemetry": "npm:10.72.0" + "@sentry/server-utils": "npm:10.72.0" import-in-the-middle: "npm:^3.0.0" - checksum: 10c0/3cb3b3fcab412528b27045d87b8e42a9b1af4eb845ac515e3eda77cbcbf61e534c7589b54980d6076b4ed869ec536c477b66c74a563cc9409dbe83287cfcb8b0 + checksum: 10c0/5c687a074d5b16611edede72cd46276644527fd9e99265f07c5739684900c4ba6ea4b0238739859d10088bcfd494a89e860442b505c9bab92982c626445f9a88 languageName: node linkType: hard -"@sentry/opentelemetry@npm:10.70.0": - version: 10.70.0 - resolution: "@sentry/opentelemetry@npm:10.70.0" +"@sentry/opentelemetry@npm:10.72.0": + version: 10.72.0 + resolution: "@sentry/opentelemetry@npm:10.72.0" dependencies: "@sentry/conventions": "npm:^0.16.0" - "@sentry/core": "npm:10.70.0" + "@sentry/core": "npm:10.72.0" peerDependencies: "@opentelemetry/api": ^1.9.0 "@opentelemetry/core": ^1.30.1 || ^2.1.0 "@opentelemetry/sdk-trace-base": ^1.30.1 || ^2.1.0 - checksum: 10c0/fd20e1696571ec13aff345e2eaa0a385a50627436ed1b0bb01b7aa0ba91c8fc2d8ca0e0192fb33c543f40116ca43af739f54ec41972036f1108b57d285687673 + checksum: 10c0/5e54a591ea9b361b36b95e45344c5a5c036798959bd03fe8664bda4dce3434476734be58d0e1228e0dd28b397c0ba83e022a73999363d61999abe570babce99f languageName: node linkType: hard -"@sentry/react@npm:^10.70.0": - version: 10.70.0 - resolution: "@sentry/react@npm:10.70.0" +"@sentry/react@npm:^10.72.0": + version: 10.72.0 + resolution: "@sentry/react@npm:10.72.0" dependencies: - "@sentry/browser": "npm:10.70.0" + "@sentry/browser": "npm:10.72.0" "@sentry/conventions": "npm:^0.16.0" - "@sentry/core": "npm:10.70.0" + "@sentry/core": "npm:10.72.0" peerDependencies: react: ^16.14.0 || 17.x || 18.x || 19.x - checksum: 10c0/4aa5d80609fd6188a1957a605c31c2c38e93b09add9a713b3972fb25f4b86f0b140fcd5cfdc7a40457d32c69ce26cd20bac2c58ec2640bb6bbb005d74377a315 + checksum: 10c0/b593a0bd7579ef95acf94c96a129bb2156140e758635a8e3a196c01dae635f192052f98a9a00677644e08fdb5ff827edfc6858f2b86d135be1e1a31d413f522b languageName: node linkType: hard -"@sentry/replay-canvas@npm:10.70.0": - version: 10.70.0 - resolution: "@sentry/replay-canvas@npm:10.70.0" +"@sentry/replay-canvas@npm:10.72.0": + version: 10.72.0 + resolution: "@sentry/replay-canvas@npm:10.72.0" dependencies: - "@sentry/core": "npm:10.70.0" - "@sentry/replay": "npm:10.70.0" - checksum: 10c0/a78d7bfe87cdd12718e85024dabcd25c2fcc03f051275a2d4252c8b7f827a3fe39db9093ee250e1843e1f316ffee6565dd31340d3a8220ea6ac44f683dadd417 + "@sentry/core": "npm:10.72.0" + "@sentry/replay": "npm:10.72.0" + checksum: 10c0/514081d5972dab76a09649457788ab9f58d819c62208c32f415e9531b33c246488b6135f44f12be8ceeb47f585ee48f0d08df24f66f4794553f15bebdf8e5c69 languageName: node linkType: hard -"@sentry/replay@npm:10.70.0": - version: 10.70.0 - resolution: "@sentry/replay@npm:10.70.0" +"@sentry/replay@npm:10.72.0": + version: 10.72.0 + resolution: "@sentry/replay@npm:10.72.0" dependencies: - "@sentry/browser-utils": "npm:10.70.0" - "@sentry/core": "npm:10.70.0" - checksum: 10c0/9d00373df75095d9b25c421f68945dd4df182c1d0fad541fe43ee8cd6a3cde78174b82e404677cb839e14ddcb63f0c3ad4b38e99453f54238a7712fc4bf07cd1 + "@sentry/browser-utils": "npm:10.72.0" + "@sentry/core": "npm:10.72.0" + checksum: 10c0/5a3dbe1c6e4aee63187a9705d824014a44121ac87c4daa297ff12ad8f91199f4d3dac3c61b467f579f400e63aa6e4e5ffaf46a3e47dc07bb9ead8cee22b70bfb languageName: node linkType: hard -"@sentry/server-utils@npm:10.70.0": - version: 10.70.0 - resolution: "@sentry/server-utils@npm:10.70.0" +"@sentry/server-utils@npm:10.72.0": + version: 10.72.0 + resolution: "@sentry/server-utils@npm:10.72.0" dependencies: - "@apm-js-collab/code-transformer-bundler-plugins": "npm:^0.7.3" - "@apm-js-collab/tracing-hooks": "npm:^0.13.0" "@sentry/conventions": "npm:^0.16.0" - "@sentry/core": "npm:10.70.0" - meriyah: "npm:^6.1.4" - checksum: 10c0/9d9b76920dba534db40bbfb904a1bb2bf3bf8260afd6788c1ec4a143241d9ee16e7b91572bb7fcc48192d4f2a063fa28a1779dc9c4d0d7c93be0e626c30ae145 + "@sentry/core": "npm:10.72.0" + checksum: 10c0/99e9133c80f280c744fe8a0507a5a07f9d34a4a064ec43e9017b2c0d2979f513079ebe0ff62957276f64591f406d1068b8cb5b782d7bd77bad66b7b2ce26afc2 languageName: node linkType: hard @@ -6737,7 +6695,7 @@ __metadata: languageName: node linkType: hard -"@types/estree@npm:^1.0.0, @types/estree@npm:^1.0.8": +"@types/estree@npm:^1.0.0": version: 1.0.9 resolution: "@types/estree@npm:1.0.9" checksum: 10c0/3ad3286ca2988cd550dafb8f2ad599c8474868e954fa601a36655bdfefd8039f7c714b8c1c7f2ae219ffbd58bd4660e66fa7479a0120fc02d4777057d4865387 @@ -8135,15 +8093,6 @@ __metadata: languageName: node linkType: hard -"astring@npm:^1.9.0": - version: 1.9.0 - resolution: "astring@npm:1.9.0" - bin: - astring: bin/astring - checksum: 10c0/e7519544d9824494e80ef0e722bb3a0c543a31440d59691c13aeaceb75b14502af536b23f08db50aa6c632dafaade54caa25f0788aa7550b6b2d6e2df89e0830 - languageName: node - linkType: hard - "async-function@npm:^1.0.0": version: 1.0.0 resolution: "async-function@npm:1.0.0" @@ -10114,7 +10063,7 @@ __metadata: languageName: node linkType: hard -"debug@npm:4, debug@npm:4.4.3, debug@npm:^4, debug@npm:^4.0.1, debug@npm:^4.1.0, debug@npm:^4.1.1, debug@npm:^4.3.1, debug@npm:^4.3.4, debug@npm:^4.3.5, debug@npm:^4.3.6, debug@npm:^4.4.0, debug@npm:^4.4.1, debug@npm:^4.4.3, debug@npm:~4.4.1": +"debug@npm:4, debug@npm:4.4.3, debug@npm:^4, debug@npm:^4.0.1, debug@npm:^4.1.0, debug@npm:^4.1.1, debug@npm:^4.3.1, debug@npm:^4.3.4, debug@npm:^4.3.5, debug@npm:^4.3.6, debug@npm:^4.4.0, debug@npm:^4.4.3, debug@npm:~4.4.1": version: 4.4.3 resolution: "debug@npm:4.4.3" dependencies: @@ -10850,7 +10799,7 @@ __metadata: languageName: node linkType: hard -"es-module-lexer@npm:^2.0.0, es-module-lexer@npm:^2.1.0, es-module-lexer@npm:^2.2.0": +"es-module-lexer@npm:^2.0.0, es-module-lexer@npm:^2.2.0": version: 2.3.1 resolution: "es-module-lexer@npm:2.3.1" checksum: 10c0/ada8b222772b5b8ea92eb6054c383233207418621855a07b480fdd36979b658a41414be09e793fcdd8a67a182741475f47830a01ff2ebd4353d7f6965c7c45f9 @@ -11020,22 +10969,6 @@ __metadata: languageName: node linkType: hard -"esquery@npm:^1.7.0": - version: 1.7.0 - resolution: "esquery@npm:1.7.0" - dependencies: - estraverse: "npm:^5.1.0" - checksum: 10c0/77d5173db450b66f3bc685d11af4c90cffeedb340f34a39af96d43509a335ce39c894fd79233df32d38f5e4e219fa0f7076f6ec90bae8320170ba082c0db4793 - languageName: node - linkType: hard - -"estraverse@npm:^5.1.0": - version: 5.3.0 - resolution: "estraverse@npm:5.3.0" - checksum: 10c0/1ff9447b96263dec95d6d67431c5e0771eb9776427421260a3e2f0fdd5d6bd4f8e37a7338f5ad2880c9f143450c9b1e4fc2069060724570a49cf9cf0312bd107 - languageName: node - linkType: hard - "estree-walker@npm:^2.0.2": version: 2.0.2 resolution: "estree-walker@npm:2.0.2" @@ -14636,13 +14569,6 @@ __metadata: languageName: node linkType: hard -"meriyah@npm:^6.1.4": - version: 6.1.4 - resolution: "meriyah@npm:6.1.4" - checksum: 10c0/d792a12df453b9e86c2bb70e73adf41b2d0fa88125381143e4d339d309ddcbb7aeb108e286411dcb19be82539d29b881279c613ae03ce514b7c296c72e9a8d00 - languageName: node - linkType: hard - "mermaid@npm:11.17.1": version: 11.17.1 resolution: "mermaid@npm:11.17.1" @@ -15633,8 +15559,8 @@ __metadata: "@radix-ui/react-tooltip": "npm:^1.2.16" "@radix-ui/react-visually-hidden": "npm:^1.2.11" "@relative-ci/agent": "npm:^4.3.1" - "@sentry/node": "npm:^10.70.0" - "@sentry/react": "npm:^10.70.0" + "@sentry/node": "npm:^10.72.0" + "@sentry/react": "npm:^10.72.0" "@simplewebauthn/browser": "npm:^13.3.0" "@simplewebauthn/server": "npm:^13.3.1" "@swc/cli": "npm:^0.8.1" @@ -18475,13 +18401,6 @@ __metadata: languageName: node linkType: hard -"semifies@npm:^1.0.0": - version: 1.0.0 - resolution: "semifies@npm:1.0.0" - checksum: 10c0/d93d5e8d2c0b7d5f972b9378736ed5cc1f2ab40d043234b4156665872f08cb0da914ee8c8b35c59dc6b17880a4c5502588c7515c6bb4dbc3ce5565746428d31d - languageName: node - linkType: hard - "semver-regex@npm:^4.0.5": version: 4.0.5 resolution: "semver-regex@npm:4.0.5" From 5f35f43c9e0d93c5ba806e2a8cbf9096bd4870fc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 1 Sep 2026 19:03:20 -0400 Subject: [PATCH 040/181] chore(deps): bump browserslist from 4.28.2 to 4.28.8 (#13606) Bumps [browserslist](https://github.com/browserslist/browserslist) from 4.28.2 to 4.28.8. - [Release notes](https://github.com/browserslist/browserslist/releases) - [Changelog](https://github.com/browserslist/browserslist/blob/main/CHANGELOG.md) - [Commits](https://github.com/browserslist/browserslist/compare/4.28.2...4.28.8) --- updated-dependencies: - dependency-name: browserslist dependency-version: 4.28.8 dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- yarn.lock | 56 +++++++++++++++++++++++++++---------------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/yarn.lock b/yarn.lock index f903cc6188..5cd3bbfbcc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8314,12 +8314,12 @@ __metadata: languageName: node linkType: hard -"baseline-browser-mapping@npm:^2.10.12": - version: 2.10.18 - resolution: "baseline-browser-mapping@npm:2.10.18" +"baseline-browser-mapping@npm:^2.11.12": + version: 2.11.20 + resolution: "baseline-browser-mapping@npm:2.11.20" bin: baseline-browser-mapping: dist/cli.cjs - checksum: 10c0/cab0138dd70b3aefe83e27cd03013bfdea772d2329e6458178cceed34b7e3fde72b697c9e4c21fb3c796bcfb831d348bc947b017d8b64417045a34bf014c87b7 + checksum: 10c0/67588b7edafa4e6c52996ec4b96b6e007312961cefc5a179cb49232f6681a38ba68d4d43990081e9d0e1dcadcbd28f13105ee7dc3e43b267385d0beb14824ecc languageName: node linkType: hard @@ -8544,17 +8544,17 @@ __metadata: linkType: hard "browserslist@npm:^4.17.3, browserslist@npm:^4.24.0, browserslist@npm:^4.28.1": - version: 4.28.2 - resolution: "browserslist@npm:4.28.2" + version: 4.28.8 + resolution: "browserslist@npm:4.28.8" dependencies: - baseline-browser-mapping: "npm:^2.10.12" - caniuse-lite: "npm:^1.0.30001782" - electron-to-chromium: "npm:^1.5.328" - node-releases: "npm:^2.0.36" - update-browserslist-db: "npm:^1.2.3" + baseline-browser-mapping: "npm:^2.11.12" + caniuse-lite: "npm:^1.0.30001809" + electron-to-chromium: "npm:^1.5.402" + node-releases: "npm:^2.0.53" + update-browserslist-db: "npm:^1.3.0" bin: browserslist: cli.js - checksum: 10c0/c0228b6330f785b7fa59d2d360124ec6d9322f96ed9f3ee1f873e33ecc9503a6f0ffc3b71191a28c4ff6e930b753b30043da1c33844a9548f3018d491f09ce60 + checksum: 10c0/047dd517c8d1f1f56a253d752c3127b8ad01c58e4cbb7e21cb5cd07ebd13e083a2237c3afb13eb60674282c9132bd4534aea2c3ff7c6f7d29be0687a00cbd537 languageName: node linkType: hard @@ -8725,10 +8725,10 @@ __metadata: languageName: node linkType: hard -"caniuse-lite@npm:^1.0.30001782": - version: 1.0.30001788 - resolution: "caniuse-lite@npm:1.0.30001788" - checksum: 10c0/d3c4695d0e7a1e95194cc5072e26db59cbcd25adfff64253859213c1a04ce9bc17f7b8ec8b11908ac1ecc6c1a0caf95fae0aec064a64b8df03286dffa629ce8a +"caniuse-lite@npm:^1.0.30001809": + version: 1.0.30001810 + resolution: "caniuse-lite@npm:1.0.30001810" + checksum: 10c0/d29bc73f33c888025d54c7ff2984372d3b350b15a6a9e174884fb40976175e9177f202e2a72c2d428dddfc032784bc8ba635a31d168fcab9fac65756d7b3d6b4 languageName: node linkType: hard @@ -10494,10 +10494,10 @@ __metadata: languageName: node linkType: hard -"electron-to-chromium@npm:^1.5.328": - version: 1.5.336 - resolution: "electron-to-chromium@npm:1.5.336" - checksum: 10c0/8d4f4422f7360e22d7faa308259b74ec66bf92450db5d8da3a26c7976d158b23d4abfdf7ee87377e2ddc551e2288906ea7eca187b1216bd771fc13f172ffa183 +"electron-to-chromium@npm:^1.5.402": + version: 1.5.420 + resolution: "electron-to-chromium@npm:1.5.420" + checksum: 10c0/0c4a4932991cefc9aa655cbb00b3b693680709df9e4eb2fc1a51cab851b735a2be9510c345b5ed6cad571e58e6d27867731607741df82de9535a7eb041fceda2 languageName: node linkType: hard @@ -15173,10 +15173,10 @@ __metadata: languageName: node linkType: hard -"node-releases@npm:^2.0.36": - version: 2.0.37 - resolution: "node-releases@npm:2.0.37" - checksum: 10c0/306df89190b3225d0cb001260de52f0befd225a782ec85311ce97b0aa3b2e22f5e4e4c00395c6dc9bc9ef440c64723f6205fe1e27d32b8dd1d140891fbadf901 +"node-releases@npm:^2.0.53": + version: 2.0.54 + resolution: "node-releases@npm:2.0.54" + checksum: 10c0/196b54ab06fd03b742816b6ca8185c69af42735b283083036e2579682c430b8f9ff89046891fe8c625557e5885793a2032d28070100bb2e57e6d6586b2f483c1 languageName: node linkType: hard @@ -20440,9 +20440,9 @@ __metadata: languageName: node linkType: hard -"update-browserslist-db@npm:^1.2.3": - version: 1.2.3 - resolution: "update-browserslist-db@npm:1.2.3" +"update-browserslist-db@npm:^1.3.0": + version: 1.3.2 + resolution: "update-browserslist-db@npm:1.3.2" dependencies: escalade: "npm:^3.2.0" picocolors: "npm:^1.1.1" @@ -20450,7 +20450,7 @@ __metadata: browserslist: ">= 4.21.0" bin: update-browserslist-db: cli.js - checksum: 10c0/13a00355ea822388f68af57410ce3255941d5fb9b7c49342c4709a07c9f230bbef7f7499ae0ca7e0de532e79a82cc0c4edbd125f1a323a1845bf914efddf8bec + checksum: 10c0/837b4ea8c4934228c5c2a922ea747a54b0ec9d1c408d2fbc9220a9b98327c04109776e6ea1206fa056ea61ed8534863af472d9f2cfce569d35f04e98c95db739 languageName: node linkType: hard From 65be53c3eb093a535ce260eb2f2da897bb07a29e Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Wed, 2 Sep 2026 08:36:36 +0900 Subject: [PATCH 041/181] v1.10.0 --- LICENSE | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/LICENSE b/LICENSE index e3cc6c8ba5..3ba5896f6a 100644 --- a/LICENSE +++ b/LICENSE @@ -3,7 +3,7 @@ Business Source License 1.1 Parameters Licensor: General Outline, Inc. -Licensed Work: Outline 1.9.1 +Licensed Work: Outline 1.10.0 The Licensed Work is (c) 2026 General Outline, Inc. Additional Use Grant: You may make use of the Licensed Work, provided that you may not use the Licensed Work for a Document @@ -15,7 +15,7 @@ Additional Use Grant: You may make use of the Licensed Work, provided that Licensed Work by creating teams and documents controlled by such third parties. -Change Date: 2030-07-13 +Change Date: 2030-09-01 Change License: Apache License, Version 2.0 diff --git a/package.json b/package.json index f9ad8f726f..25cfb90e2b 100644 --- a/package.json +++ b/package.json @@ -388,6 +388,6 @@ "deepmerge-ts@npm:^7.1.5": "^8.0.1", "i18next-parser/i18next": "^23.16.8" }, - "version": "1.9.1", + "version": "1.10.0", "packageManager": "yarn@4.11.0" } From 7c34b797f35520a218c29475546c33cd00629f8d Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Tue, 1 Sep 2026 21:29:36 -0400 Subject: [PATCH 042/181] chore: Upgrade query-string (#13608) --- package.json | 2 +- yarn.lock | 48 ++++++++++++++++++++---------------------------- 2 files changed, 21 insertions(+), 29 deletions(-) diff --git a/package.json b/package.json index 25cfb90e2b..8ef92e29e8 100644 --- a/package.json +++ b/package.json @@ -215,7 +215,7 @@ "prosemirror-transform": "1.10.5", "prosemirror-view": "^1.41.8", "proxy-from-env": "^1.1.0", - "query-string": "^7.1.3", + "query-string": "^9.5.0", "rate-limiter-flexible": "^2.4.2", "react": "^17.0.2", "react-avatar-editor": "^13.0.2", diff --git a/yarn.lock b/yarn.lock index 5cd3bbfbcc..fd18a6450d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10124,10 +10124,10 @@ __metadata: languageName: node linkType: hard -"decode-uri-component@npm:^0.2.2": - version: 0.2.2 - resolution: "decode-uri-component@npm:0.2.2" - checksum: 10c0/1f4fa54eb740414a816b3f6c24818fbfcabd74ac478391e9f4e2282c994127db02010ce804f3d08e38255493cfe68608b3f5c8e09fd6efc4ae46c807691f7a31 +"decode-uri-component@npm:^0.5.0": + version: 0.5.0 + resolution: "decode-uri-component@npm:0.5.0" + checksum: 10c0/b913bb2ec3a83b4c96d961dcd7808c538f2f69f9a8581ab1bfbbb3d48c90e36779cc4580334198315d4c17f9c32d88ae4467c96582419a70b5f35df2c5a05cb1 languageName: node linkType: hard @@ -11404,10 +11404,10 @@ __metadata: languageName: node linkType: hard -"filter-obj@npm:^1.1.0": - version: 1.1.0 - resolution: "filter-obj@npm:1.1.0" - checksum: 10c0/071e0886b2b50238ca5026c5bbf58c26a7c1a1f720773b8c7813d16ba93d0200de977af14ac143c5ac18f666b2cfc83073f3a5fe6a4e996c49e0863d5500fccf +"filter-obj@npm:^5.1.0": + version: 5.1.0 + resolution: "filter-obj@npm:5.1.0" + checksum: 10c0/716e8ad2bc352e206556b3e5695b3cdff8aab80c53ea4b00c96315bbf467b987df3640575100aef8b84e812cf5ea4251db4cd672bbe33b1e78afea88400c67dd languageName: node linkType: hard @@ -15749,7 +15749,7 @@ __metadata: prosemirror-transform: "npm:1.10.5" prosemirror-view: "npm:^1.41.8" proxy-from-env: "npm:^1.1.0" - query-string: "npm:^7.1.3" + query-string: "npm:^9.5.0" rate-limiter-flexible: "npm:^2.4.2" react: "npm:^17.0.2" react-avatar-editor: "npm:^13.0.2" @@ -17168,15 +17168,14 @@ __metadata: languageName: node linkType: hard -"query-string@npm:^7.1.3": - version: 7.1.3 - resolution: "query-string@npm:7.1.3" +"query-string@npm:^9.5.0": + version: 9.5.0 + resolution: "query-string@npm:9.5.0" dependencies: - decode-uri-component: "npm:^0.2.2" - filter-obj: "npm:^1.1.0" - split-on-first: "npm:^1.0.0" - strict-uri-encode: "npm:^2.0.0" - checksum: 10c0/a896c08e9e0d4f8ffd89a572d11f668c8d0f7df9c27c6f49b92ab31366d3ba0e9c331b9a620ee747893436cd1f2f821a6327e2bc9776bde2402ac6c270b801b2 + decode-uri-component: "npm:^0.5.0" + filter-obj: "npm:^5.1.0" + split-on-first: "npm:^3.0.0" + checksum: 10c0/a5b71d4541f1b8e8b02e69d5a687fa8749a34fd259343cdeb617bc3a4651d626285f458f3f312ac5d7eda58587ac58b908c9f13c2c9381706d6cbf72b4650021 languageName: node linkType: hard @@ -19002,10 +19001,10 @@ __metadata: languageName: node linkType: hard -"split-on-first@npm:^1.0.0": - version: 1.1.0 - resolution: "split-on-first@npm:1.1.0" - checksum: 10c0/56df8344f5a5de8521898a5c090023df1d8b8c75be6228f56c52491e0fc1617a5236f2ac3a066adb67a73231eac216ccea7b5b4a2423a543c277cb2f48d24c29 +"split-on-first@npm:^3.0.0": + version: 3.0.0 + resolution: "split-on-first@npm:3.0.0" + checksum: 10c0/a1262eae12b68de235e1a08e011bf5b42c42621985ddf807e6221fb1e2b3304824913ae7019f18436b96b8fab8aef5f1ad80dedd2385317fdc51b521c3882cd0 languageName: node linkType: hard @@ -19151,13 +19150,6 @@ __metadata: languageName: node linkType: hard -"strict-uri-encode@npm:^2.0.0": - version: 2.0.0 - resolution: "strict-uri-encode@npm:2.0.0" - checksum: 10c0/010cbc78da0e2cf833b0f5dc769e21ae74cdc5d5f5bd555f14a4a4876c8ad2c85ab8b5bdf9a722dc71a11dcd3184085e1c3c0bd50ec6bb85fffc0f28cf82597d - languageName: node - linkType: hard - "strictdom@npm:^1.0.1": version: 1.0.1 resolution: "strictdom@npm:1.0.1" From b2a1e10e483e657b988ccac812be8ae45d89236c Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Wed, 2 Sep 2026 06:12:12 -0400 Subject: [PATCH 043/181] Batch large table deletes in teamPermanentDeleter (#13610) * fix: batch large deletes in teamPermanentDeleter to shorten lock time Delete events, collections, and documents in batches of ids outside the final transaction so row locks are held briefly instead of for the whole team deletion, which blocked the hourly old-events cleanup for hours. * fix: type batched destroy helper structurally Co-Authored-By: Claude Fable 5.1 * fix: guard whole team deletion with a non-blocking mutex Move the concurrency guard from the final transaction to the whole routine so a second worker skips before running the batched deletes. Co-Authored-By: Claude Fable 5.1 --------- Co-authored-by: Claude Fable 5.1 --- server/commands/teamPermanentDeleter.ts | 109 +++++++++++++++--------- server/utils/MutexLock.ts | 31 +++++++ server/utils/__mocks__/MutexLock.ts | 22 +++++ 3 files changed, 124 insertions(+), 38 deletions(-) diff --git a/server/commands/teamPermanentDeleter.ts b/server/commands/teamPermanentDeleter.ts index 67943d5373..735f351665 100644 --- a/server/commands/teamPermanentDeleter.ts +++ b/server/commands/teamPermanentDeleter.ts @@ -1,3 +1,4 @@ +import type { WhereOptions } from "sequelize"; import Logger from "@server/logging/Logger"; import { traceFunction } from "@server/logging/tracing"; import type { Team } from "@server/models"; @@ -18,8 +19,10 @@ import { SearchQuery, Share, } from "@server/models"; +import type Model from "@server/models/base/Model"; import { sequelize } from "@server/storage/database"; -import { LockHelper } from "@server/storage/LockHelper"; +import { MutexLock } from "@server/utils/MutexLock"; +import { Minute } from "@shared/utils/time"; /** * Permanently deletes a team and all related data from the database. Note that this does not happen @@ -35,11 +38,32 @@ async function teamPermanentDeleter(team: Team) { ); } + const teamId = team.id; + + // A non-blocking lock so that concurrent runs for the same team skip rather + // than repeat the batched deletes below. + const ran = await MutexLock.tryUsing( + `teamPermanentDeleter:${teamId}`, + 5 * Minute.ms, + async () => { + await destroyTeamData(team); + return true; + } + ); + if (!ran) { + Logger.info( + "commands", + `Team ${teamId} is already being destroyed, skipping` + ); + } +} + +async function destroyTeamData(team: Team) { + const teamId = team.id; Logger.info( "commands", - `Permanently destroying team ${team.name} (${team.id})` + `Permanently destroying team ${team.name} (${teamId})` ); - const teamId = team.id; // Attachments are destroyed as individual instances (rather than a bulk // delete) so the BeforeDestroy hook runs and removes the associated file from @@ -108,21 +132,15 @@ async function teamPermanentDeleter(team: Team) { } ); + // The largest tables are destroyed in batches outside of a transaction so + // that row locks are held briefly, rather than for the whole deletion. + // events must be first due to db constraints + await destroyInBatches(Event, { teamId }); + await destroyInBatches(Collection, { teamId }); + await destroyInBatches(Document.unscoped(), { teamId }); + // Destory team-relation models await sequelize.transaction(async (transaction) => { - const acquired = await LockHelper.tryAcquire( - sequelize, - `teamPermanentDeleter:${teamId}`, - transaction - ); - if (!acquired) { - Logger.info( - "commands", - `Team ${teamId} is already being destroyed, skipping` - ); - return; - } - await AuthenticationProvider.destroy({ where: { teamId, @@ -130,28 +148,6 @@ async function teamPermanentDeleter(team: Team) { force: true, transaction, }); - // events must be first due to db constraints - await Event.destroy({ - where: { - teamId, - }, - force: true, - transaction, - }); - await Collection.destroy({ - where: { - teamId, - }, - force: true, - transaction, - }); - await Document.unscoped().destroy({ - where: { - teamId, - }, - force: true, - transaction, - }); await FileOperation.destroy({ where: { teamId, @@ -217,6 +213,43 @@ async function teamPermanentDeleter(team: Team) { }); } +interface BatchDestroyable { + findAllInBatches: typeof Model.findAllInBatches; + destroy(options: { + where: { id: string[] }; + force: boolean; + }): Promise; +} + +/** + * Permanently deletes every row of a model matching the where clause, in + * batches of ids so that each statement is short and locks few rows. + */ +async function destroyInBatches( + model: BatchDestroyable, + where: WhereOptions +): Promise { + await model.findAllInBatches( + { + attributes: ["id"], + where, + batchLimit: 1000, + paranoid: false, + }, + async (rows) => { + if (rows.length === 0) { + return; + } + await model.destroy({ + where: { + id: rows.map((row) => row.id), + }, + force: true, + }); + } + ); +} + export default traceFunction({ spanName: "teamPermanentDeleter", })(teamPermanentDeleter); diff --git a/server/utils/MutexLock.ts b/server/utils/MutexLock.ts index 081c3b1f3d..f56603e577 100644 --- a/server/utils/MutexLock.ts +++ b/server/utils/MutexLock.ts @@ -109,6 +109,37 @@ export class MutexLock { return this.lock.using([resource], timeout, routine); } + /** + * Execute a routine in the context of an auto-extending lock, without + * waiting when the lock is already held elsewhere. Use this for long + * routines that must never run concurrently but can be skipped. + * + * @param resource The resource to lock. + * @param timeout The initial lock duration in milliseconds (auto-extended while running). + * @param routine The async routine to execute while holding the lock. + * @returns A promise that resolves with the routine's return value, or + * undefined if the lock was held elsewhere and the routine did not run. + */ + public static async tryUsing( + resource: string, + timeout: number, + routine: (signal: RedlockAbortSignal) => Promise + ): Promise { + try { + return await this.lock.using( + [resource], + timeout, + { retryCount: 0 }, + routine + ); + } catch (err) { + if (err instanceof ExecutionError || err instanceof ResourceLockedError) { + return undefined; + } + throw err; + } + } + /** * Safely release a lock. Releasing is best-effort – a lock that has already * expired or been taken over by another process cannot be released, and that diff --git a/server/utils/__mocks__/MutexLock.ts b/server/utils/__mocks__/MutexLock.ts index 2e1a5f9af5..cc5f094f53 100644 --- a/server/utils/__mocks__/MutexLock.ts +++ b/server/utils/__mocks__/MutexLock.ts @@ -12,6 +12,28 @@ export class MutexLock { expiration: Date.now() + 10000, }); + /** + * Runs the routine without a lock. + */ + public static using = vi.fn( + ( + _resource: string, + _timeout: number, + routine: (signal: never) => unknown + ) => routine(undefined as never) + ); + + /** + * Runs the routine without a lock. + */ + public static tryUsing = vi.fn( + ( + _resource: string, + _timeout: number, + routine: (signal: never) => unknown + ) => routine(undefined as never) + ); + /** * Releases a mock lock. */ From 00b83901fd305921b00db374f36c33b2164f397d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 2 Sep 2026 06:12:24 -0400 Subject: [PATCH 044/181] chore(deps): bump the aws group across 1 directory with 6 updates (#13590) Bumps the aws group with 6 updates in the / directory: | Package | From | To | | --- | --- | --- | | [@aws-sdk/client-s3](https://github.com/aws/aws-sdk-js-v3/tree/HEAD/clients/client-s3) | `3.1115.0` | `3.1121.0` | | [@aws-sdk/cloudfront-signer](https://github.com/aws/aws-sdk-js-v3/tree/HEAD/packages/cloudfront-signer) | `3.1111.0` | `3.1116.0` | | [@aws-sdk/lib-storage](https://github.com/aws/aws-sdk-js-v3/tree/HEAD/lib/lib-storage) | `3.1115.0` | `3.1121.0` | | [@aws-sdk/s3-presigned-post](https://github.com/aws/aws-sdk-js-v3/tree/HEAD/packages/s3-presigned-post) | `3.1115.0` | `3.1121.0` | | [@aws-sdk/s3-request-presigner](https://github.com/aws/aws-sdk-js-v3/tree/HEAD/packages/s3-request-presigner) | `3.1115.0` | `3.1121.0` | | [@aws-sdk/signature-v4-crt](https://github.com/aws/aws-sdk-js-v3/tree/HEAD/packages/signature-v4-crt) | `3.1115.0` | `3.1121.0` | Updates `@aws-sdk/client-s3` from 3.1115.0 to 3.1121.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.1121.0/clients/client-s3) Updates `@aws-sdk/cloudfront-signer` from 3.1111.0 to 3.1116.0 - [Release notes](https://github.com/aws/aws-sdk-js-v3/releases) - [Changelog](https://github.com/aws/aws-sdk-js-v3/blob/main/packages/cloudfront-signer/CHANGELOG.md) - [Commits](https://github.com/aws/aws-sdk-js-v3/commits/v3.1116.0/packages/cloudfront-signer) Updates `@aws-sdk/lib-storage` from 3.1115.0 to 3.1121.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.1121.0/lib/lib-storage) Updates `@aws-sdk/s3-presigned-post` from 3.1115.0 to 3.1121.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.1121.0/packages/s3-presigned-post) Updates `@aws-sdk/s3-request-presigner` from 3.1115.0 to 3.1121.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.1121.0/packages/s3-request-presigner) Updates `@aws-sdk/signature-v4-crt` from 3.1115.0 to 3.1121.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.1121.0/packages/signature-v4-crt) --- updated-dependencies: - dependency-name: "@aws-sdk/client-s3" dependency-version: 3.1120.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: aws - dependency-name: "@aws-sdk/cloudfront-signer" dependency-version: 3.1116.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: aws - dependency-name: "@aws-sdk/lib-storage" dependency-version: 3.1120.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: aws - dependency-name: "@aws-sdk/s3-presigned-post" dependency-version: 3.1120.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: aws - dependency-name: "@aws-sdk/s3-request-presigner" dependency-version: 3.1120.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: aws - dependency-name: "@aws-sdk/signature-v4-crt" dependency-version: 3.1120.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: aws ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 12 +- yarn.lock | 497 ++++++++++++++++++++++++++------------------------- 2 files changed, 264 insertions(+), 245 deletions(-) diff --git a/package.json b/package.json index 8ef92e29e8..fcceefca7d 100644 --- a/package.json +++ b/package.json @@ -52,12 +52,12 @@ "> 0.25%, not dead" ], "dependencies": { - "@aws-sdk/client-s3": "^3.1115.0", - "@aws-sdk/cloudfront-signer": "^3.1111.0", - "@aws-sdk/lib-storage": "^3.1115.0", - "@aws-sdk/s3-presigned-post": "^3.1115.0", - "@aws-sdk/s3-request-presigner": "^3.1115.0", - "@aws-sdk/signature-v4-crt": "^3.1115.0", + "@aws-sdk/client-s3": "^3.1121.0", + "@aws-sdk/cloudfront-signer": "^3.1116.0", + "@aws-sdk/lib-storage": "^3.1121.0", + "@aws-sdk/s3-presigned-post": "^3.1121.0", + "@aws-sdk/s3-request-presigner": "^3.1121.0", + "@aws-sdk/signature-v4-crt": "^3.1121.0", "@benrbray/prosemirror-math": "^0.2.2", "@bull-board/api": "^6.21.3", "@bull-board/koa": "^6.21.3", diff --git a/yarn.lock b/yarn.lock index fd18a6450d..ab58494ce9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -28,322 +28,322 @@ __metadata: languageName: node linkType: hard -"@aws-sdk/checksums@npm:^3.1000.28": - version: 3.1000.28 - resolution: "@aws-sdk/checksums@npm:3.1000.28" +"@aws-sdk/checksums@npm:^3.1000.29": + version: 3.1000.29 + resolution: "@aws-sdk/checksums@npm:3.1000.29" dependencies: - "@aws-sdk/core": "npm:^3.977.8" - "@aws-sdk/types": "npm:^3.974.4" - "@smithy/core": "npm:^3.31.1" - "@smithy/types": "npm:^4.16.1" + "@aws-sdk/core": "npm:^3.977.9" + "@aws-sdk/types": "npm:^3.974.5" + "@smithy/core": "npm:^3.33.3" + "@smithy/types": "npm:^4.17.2" tslib: "npm:^2.6.2" - checksum: 10c0/d609a809f6886245e81854ecb7886100810feb3e1e7ea5d7fc1475eea21dc7e1fbecf520c45f2b73f7aa21134f746d0a7dea4960301246853ad0447e6df475c7 + checksum: 10c0/efa6dfb66366f8f1591cde5669d40153e2caff11c06b19a3aa3957e38084cc6a7df133c0485e10c3d6fdc5b6d7022e90b0c6816dd2c0c08574424f9429c4f9c0 languageName: node linkType: hard -"@aws-sdk/client-s3@npm:3.1115.0, @aws-sdk/client-s3@npm:^3.1115.0": - version: 3.1115.0 - resolution: "@aws-sdk/client-s3@npm:3.1115.0" +"@aws-sdk/client-s3@npm:3.1121.0, @aws-sdk/client-s3@npm:^3.1121.0": + version: 3.1121.0 + resolution: "@aws-sdk/client-s3@npm:3.1121.0" dependencies: - "@aws-sdk/checksums": "npm:^3.1000.28" - "@aws-sdk/core": "npm:^3.977.8" - "@aws-sdk/credential-provider-node": "npm:^3.972.80" - "@aws-sdk/middleware-sdk-s3": "npm:^3.972.74" - "@aws-sdk/signature-v4-multi-region": "npm:^3.996.45" - "@aws-sdk/types": "npm:^3.974.4" - "@smithy/core": "npm:^3.31.1" - "@smithy/fetch-http-handler": "npm:^5.6.13" - "@smithy/node-http-handler": "npm:^4.9.13" - "@smithy/types": "npm:^4.16.1" + "@aws-sdk/checksums": "npm:^3.1000.29" + "@aws-sdk/core": "npm:^3.977.9" + "@aws-sdk/credential-provider-node": "npm:^3.972.81" + "@aws-sdk/middleware-sdk-s3": "npm:^3.972.75" + "@aws-sdk/signature-v4-multi-region": "npm:^3.996.46" + "@aws-sdk/types": "npm:^3.974.5" + "@smithy/core": "npm:^3.33.3" + "@smithy/fetch-http-handler": "npm:^5.7.2" + "@smithy/node-http-handler": "npm:^4.11.3" + "@smithy/types": "npm:^4.17.2" tslib: "npm:^2.6.2" - checksum: 10c0/ecad08091e9fc61c2f1ba7f71a7f65c0a8861870db8bf3ef02977378f056e00040427918d520d17e3d0608fea07248f73c7a3180d12401a94964461c970a1fe7 + checksum: 10c0/ed715f4e8a25c22da391ed984d489664c3e1e575f35cda0e8c17adacedfd33b6265ec811824dadf28c2f001e55c6847369cbf9774b03dc05175e4e56f5111b45 languageName: node linkType: hard -"@aws-sdk/cloudfront-signer@npm:^3.1111.0": - version: 3.1111.0 - resolution: "@aws-sdk/cloudfront-signer@npm:3.1111.0" +"@aws-sdk/cloudfront-signer@npm:^3.1116.0": + version: 3.1116.0 + resolution: "@aws-sdk/cloudfront-signer@npm:3.1116.0" dependencies: - "@smithy/core": "npm:^3.31.1" + "@smithy/core": "npm:^3.33.3" tslib: "npm:^2.6.2" - checksum: 10c0/5f20ad4b1499dbf1ac591d8263ce152d2ef747f23902b3b7ff4159e4df57bafa5080c4139a699e879fd268919ff357a866a234e997afec46b8e38f313180b2a3 + checksum: 10c0/15692d584f2498c549b68cdebf4b774f0fac70c12c2a7924c2c0701665e29c9df5f3e387b5570f84712fdf9807fd0997e83310ee50c4d43d0925d067367d0e9b languageName: node linkType: hard -"@aws-sdk/core@npm:^3.977.8": - version: 3.977.8 - resolution: "@aws-sdk/core@npm:3.977.8" +"@aws-sdk/core@npm:^3.977.9": + version: 3.977.9 + resolution: "@aws-sdk/core@npm:3.977.9" dependencies: - "@aws-sdk/types": "npm:^3.974.4" - "@aws-sdk/xml-builder": "npm:^3.972.39" + "@aws-sdk/types": "npm:^3.974.5" + "@aws-sdk/xml-builder": "npm:^3.972.40" "@aws/lambda-invoke-store": "npm:^0.3.0" - "@smithy/core": "npm:^3.31.1" + "@smithy/core": "npm:^3.33.3" "@smithy/signature-v4": "npm:^5.6.12" - "@smithy/types": "npm:^4.16.1" + "@smithy/types": "npm:^4.17.2" bowser: "npm:^2.11.0" tslib: "npm:^2.6.2" - checksum: 10c0/54eb6fb07240ffe0af5d9dbf401b6b5de2da019be5f4aa82aa8326a2fcc2403ffe857dee801039bff54bf9aa1829533d228eff27192aeff80cda840b46f6dbc4 + checksum: 10c0/9118a8d05b7c27fe55fb5e793840193d1b311b6c0c2958e591bcada391a71783536ed9c8f4913cc9c4b7258dba650d625ed782669a12875348544c33f35aa8d6 languageName: node linkType: hard -"@aws-sdk/credential-provider-env@npm:^3.972.69": - version: 3.972.69 - resolution: "@aws-sdk/credential-provider-env@npm:3.972.69" +"@aws-sdk/credential-provider-env@npm:^3.972.70": + version: 3.972.70 + resolution: "@aws-sdk/credential-provider-env@npm:3.972.70" dependencies: - "@aws-sdk/core": "npm:^3.977.8" - "@aws-sdk/types": "npm:^3.974.4" - "@smithy/core": "npm:^3.31.1" - "@smithy/types": "npm:^4.16.1" + "@aws-sdk/core": "npm:^3.977.9" + "@aws-sdk/types": "npm:^3.974.5" + "@smithy/core": "npm:^3.33.3" + "@smithy/types": "npm:^4.17.2" tslib: "npm:^2.6.2" - checksum: 10c0/c81fd8fb18ecd49db7ee2b0793bfbf0ab232c5e4dca3d4b9529df88b830cd5bbc86fa6a52c8f2baabb1b6ebbe1a0e07134e2132e2b32f2bd55aa1e125bcacdec + checksum: 10c0/f5d8f3f1021a83911f617dd6b36277486d0bdb174c107c4f7776a7e2c609a101aa03ada1cca9d97229ac79aea7797ec6392fe449029b87f7cd013360592bddf3 languageName: node linkType: hard -"@aws-sdk/credential-provider-http@npm:^3.972.71": - version: 3.972.71 - resolution: "@aws-sdk/credential-provider-http@npm:3.972.71" +"@aws-sdk/credential-provider-http@npm:^3.972.72": + version: 3.972.72 + resolution: "@aws-sdk/credential-provider-http@npm:3.972.72" dependencies: - "@aws-sdk/core": "npm:^3.977.8" - "@aws-sdk/types": "npm:^3.974.4" - "@smithy/core": "npm:^3.31.1" - "@smithy/fetch-http-handler": "npm:^5.6.13" - "@smithy/node-http-handler": "npm:^4.9.13" - "@smithy/types": "npm:^4.16.1" + "@aws-sdk/core": "npm:^3.977.9" + "@aws-sdk/types": "npm:^3.974.5" + "@smithy/core": "npm:^3.33.3" + "@smithy/fetch-http-handler": "npm:^5.7.2" + "@smithy/node-http-handler": "npm:^4.11.3" + "@smithy/types": "npm:^4.17.2" tslib: "npm:^2.6.2" - checksum: 10c0/b57f2fea7cb6fc38f3ce0369cb6b3a39f2789757838c25b44c0797676353a9ccbcb215ad9c3d5288ce5d8fbea0c34c04d0b884c6adcee1c6d7ebced986b0dd15 + checksum: 10c0/aaa67dc42ce00713d92f931c620e36cb199533e6f1f892a6be76553986c86977442924e76f3743732a7b65e6f6777271789a6edbc70d5a86e0a9b6b5a3ef25f3 languageName: node linkType: hard -"@aws-sdk/credential-provider-ini@npm:^3.973.14": +"@aws-sdk/credential-provider-ini@npm:^3.973.15": + version: 3.973.15 + resolution: "@aws-sdk/credential-provider-ini@npm:3.973.15" + dependencies: + "@aws-sdk/core": "npm:^3.977.9" + "@aws-sdk/credential-provider-env": "npm:^3.972.70" + "@aws-sdk/credential-provider-http": "npm:^3.972.72" + "@aws-sdk/credential-provider-login": "npm:^3.972.77" + "@aws-sdk/credential-provider-process": "npm:^3.972.70" + "@aws-sdk/credential-provider-sso": "npm:^3.973.14" + "@aws-sdk/credential-provider-web-identity": "npm:^3.972.76" + "@aws-sdk/nested-clients": "npm:^3.997.44" + "@aws-sdk/types": "npm:^3.974.5" + "@smithy/core": "npm:^3.33.3" + "@smithy/credential-provider-imds": "npm:^4.4.16" + "@smithy/types": "npm:^4.17.2" + tslib: "npm:^2.6.2" + checksum: 10c0/1fe5f8c84cb9877a62084f9cbedebaed605ecc34891c44254d979ccd1282a5e164840d6dbb340773c311c028568f9ea642649bebf4b38cebb2d6d0039ad9de12 + languageName: node + linkType: hard + +"@aws-sdk/credential-provider-login@npm:^3.972.77": + version: 3.972.77 + resolution: "@aws-sdk/credential-provider-login@npm:3.972.77" + dependencies: + "@aws-sdk/core": "npm:^3.977.9" + "@aws-sdk/nested-clients": "npm:^3.997.44" + "@aws-sdk/types": "npm:^3.974.5" + "@smithy/core": "npm:^3.33.3" + "@smithy/types": "npm:^4.17.2" + tslib: "npm:^2.6.2" + checksum: 10c0/9be54fdf406325d462abdc0a2a182ba1ed39009fa18b60035705e6c3fae92dfe1afe5dba24a4fa3c8376f7cd2e1dad7a91152909f3b96dde0b215a88dfcd5330 + languageName: node + linkType: hard + +"@aws-sdk/credential-provider-node@npm:^3.972.81": + version: 3.972.81 + resolution: "@aws-sdk/credential-provider-node@npm:3.972.81" + dependencies: + "@aws-sdk/credential-provider-env": "npm:^3.972.70" + "@aws-sdk/credential-provider-http": "npm:^3.972.72" + "@aws-sdk/credential-provider-ini": "npm:^3.973.15" + "@aws-sdk/credential-provider-process": "npm:^3.972.70" + "@aws-sdk/credential-provider-sso": "npm:^3.973.14" + "@aws-sdk/credential-provider-web-identity": "npm:^3.972.76" + "@aws-sdk/types": "npm:^3.974.5" + "@smithy/core": "npm:^3.33.3" + "@smithy/credential-provider-imds": "npm:^4.4.16" + "@smithy/types": "npm:^4.17.2" + tslib: "npm:^2.6.2" + checksum: 10c0/b0e60a641a4648dcae0e20b3f2fe3866bb1b5aeba64617146888b4208d94878a8421cd74bbf1f8b921a50cc1e8410fa707ca30af0349ec54be43ce5e8004a748 + languageName: node + linkType: hard + +"@aws-sdk/credential-provider-process@npm:^3.972.70": + version: 3.972.70 + resolution: "@aws-sdk/credential-provider-process@npm:3.972.70" + dependencies: + "@aws-sdk/core": "npm:^3.977.9" + "@aws-sdk/types": "npm:^3.974.5" + "@smithy/core": "npm:^3.33.3" + "@smithy/types": "npm:^4.17.2" + tslib: "npm:^2.6.2" + checksum: 10c0/87ea5f575f611461a538312b6c502baf86ce33eef6974bb2f9e85bd32147cb8f6b518e80f5a5d8ef371fceb03d517f4d3b6c07ddeb7f15d5a2f56c6dcbf8e8ba + languageName: node + linkType: hard + +"@aws-sdk/credential-provider-sso@npm:^3.973.14": version: 3.973.14 - resolution: "@aws-sdk/credential-provider-ini@npm:3.973.14" + resolution: "@aws-sdk/credential-provider-sso@npm:3.973.14" dependencies: - "@aws-sdk/core": "npm:^3.977.8" - "@aws-sdk/credential-provider-env": "npm:^3.972.69" - "@aws-sdk/credential-provider-http": "npm:^3.972.71" - "@aws-sdk/credential-provider-login": "npm:^3.972.76" - "@aws-sdk/credential-provider-process": "npm:^3.972.69" - "@aws-sdk/credential-provider-sso": "npm:^3.973.13" - "@aws-sdk/credential-provider-web-identity": "npm:^3.972.75" - "@aws-sdk/nested-clients": "npm:^3.997.43" - "@aws-sdk/types": "npm:^3.974.4" - "@smithy/core": "npm:^3.31.1" - "@smithy/credential-provider-imds": "npm:^4.4.16" - "@smithy/types": "npm:^4.16.1" + "@aws-sdk/core": "npm:^3.977.9" + "@aws-sdk/nested-clients": "npm:^3.997.44" + "@aws-sdk/token-providers": "npm:3.1116.0" + "@aws-sdk/types": "npm:^3.974.5" + "@smithy/core": "npm:^3.33.3" + "@smithy/types": "npm:^4.17.2" tslib: "npm:^2.6.2" - checksum: 10c0/1925d730eb675cb1ef95e35e58964ed61a8ff817e6297176eaf59e3d51cdbf0e8d3f5725637785edf097143bf7ecddd83b4a5b9fbcdeded627d0239738a290e6 + checksum: 10c0/12132e57c07277b4c115c835bb7a14b2a62e4f30a69998eca501a171d46be469439b3e7b33c970165362bd261b8689389dd06ba0a959657d97330f3e5172ec52 languageName: node linkType: hard -"@aws-sdk/credential-provider-login@npm:^3.972.76": +"@aws-sdk/credential-provider-web-identity@npm:^3.972.76": version: 3.972.76 - resolution: "@aws-sdk/credential-provider-login@npm:3.972.76" + resolution: "@aws-sdk/credential-provider-web-identity@npm:3.972.76" dependencies: - "@aws-sdk/core": "npm:^3.977.8" - "@aws-sdk/nested-clients": "npm:^3.997.43" - "@aws-sdk/types": "npm:^3.974.4" - "@smithy/core": "npm:^3.31.1" - "@smithy/types": "npm:^4.16.1" + "@aws-sdk/core": "npm:^3.977.9" + "@aws-sdk/nested-clients": "npm:^3.997.44" + "@aws-sdk/types": "npm:^3.974.5" + "@smithy/core": "npm:^3.33.3" + "@smithy/types": "npm:^4.17.2" tslib: "npm:^2.6.2" - checksum: 10c0/15fb81fb904a47aee0f2954b66b21c5e3358499b7f33dea3546de5d6d82793bac1774bb53f57c8c396a277861d20a13b4bcf22df5dcae39559825938eed1f307 + checksum: 10c0/5efcf6a4b10e49b5b3f9bf76b638ff0b0ce84d26126197f0d28cecbd01458f5d84a074a4cdc8817a7310a940a36a8ad164c1531eb031713bd1485d52bef8c877 languageName: node linkType: hard -"@aws-sdk/credential-provider-node@npm:^3.972.80": - version: 3.972.80 - resolution: "@aws-sdk/credential-provider-node@npm:3.972.80" +"@aws-sdk/crt-loader@npm:^3.972.74": + version: 3.972.74 + resolution: "@aws-sdk/crt-loader@npm:3.972.74" dependencies: - "@aws-sdk/credential-provider-env": "npm:^3.972.69" - "@aws-sdk/credential-provider-http": "npm:^3.972.71" - "@aws-sdk/credential-provider-ini": "npm:^3.973.14" - "@aws-sdk/credential-provider-process": "npm:^3.972.69" - "@aws-sdk/credential-provider-sso": "npm:^3.973.13" - "@aws-sdk/credential-provider-web-identity": "npm:^3.972.75" - "@aws-sdk/types": "npm:^3.974.4" - "@smithy/core": "npm:^3.31.1" - "@smithy/credential-provider-imds": "npm:^4.4.16" - "@smithy/types": "npm:^4.16.1" - tslib: "npm:^2.6.2" - checksum: 10c0/e3c679e83bb81e9946a67f67578f9b81813c03d8ebea80d811f3cabb7bbf4c87659be9bbe4de2ad95b4da180189e949d99c632141c9964162ca6c3a8d69aa601 - languageName: node - linkType: hard - -"@aws-sdk/credential-provider-process@npm:^3.972.69": - version: 3.972.69 - resolution: "@aws-sdk/credential-provider-process@npm:3.972.69" - dependencies: - "@aws-sdk/core": "npm:^3.977.8" - "@aws-sdk/types": "npm:^3.974.4" - "@smithy/core": "npm:^3.31.1" - "@smithy/types": "npm:^4.16.1" - tslib: "npm:^2.6.2" - checksum: 10c0/73216e292ee76085c92108237e52c4c6ec9f6fdcfcb87ad9388a829fe590e0464b6b7887dd8365f4ecb0db1f4a35eb14c0874c908b9e79a6de5003d6b72d2551 - languageName: node - linkType: hard - -"@aws-sdk/credential-provider-sso@npm:^3.973.13": - version: 3.973.13 - resolution: "@aws-sdk/credential-provider-sso@npm:3.973.13" - dependencies: - "@aws-sdk/core": "npm:^3.977.8" - "@aws-sdk/nested-clients": "npm:^3.997.43" - "@aws-sdk/token-providers": "npm:3.1111.0" - "@aws-sdk/types": "npm:^3.974.4" - "@smithy/core": "npm:^3.31.1" - "@smithy/types": "npm:^4.16.1" - tslib: "npm:^2.6.2" - checksum: 10c0/b9b628c2dd54770f6e54687c73745f33eb6f4baf53dc48f8b340cc6b245f0759ee5801f5d2446da4f8a8c17b4665d5e5da489381947ef1d997ae511d79bd8e4d - languageName: node - linkType: hard - -"@aws-sdk/credential-provider-web-identity@npm:^3.972.75": - version: 3.972.75 - resolution: "@aws-sdk/credential-provider-web-identity@npm:3.972.75" - dependencies: - "@aws-sdk/core": "npm:^3.977.8" - "@aws-sdk/nested-clients": "npm:^3.997.43" - "@aws-sdk/types": "npm:^3.974.4" - "@smithy/core": "npm:^3.31.1" - "@smithy/types": "npm:^4.16.1" - tslib: "npm:^2.6.2" - checksum: 10c0/2b84691ae132f0cb146a8240991fa31295f6112423a1314979a424c2408124fc92b8b76bf74ce1d442777e7dc39dcc910ab29bacd26e02af49ac6b0e7330e538 - languageName: node - linkType: hard - -"@aws-sdk/crt-loader@npm:^3.972.73": - version: 3.972.73 - resolution: "@aws-sdk/crt-loader@npm:3.972.73" - dependencies: - "@aws-sdk/core": "npm:^3.977.8" + "@aws-sdk/core": "npm:^3.977.9" aws-crt: "npm:^1.31.0" tslib: "npm:^2.6.2" - checksum: 10c0/1bf80d52cf6a77efd556f5409be0ecd4099cb6e62e52b3ba6bd52e63d657d9902290245a04b9b053c2f0cfe29a66fe57d73741e00ddc2a2c3539f66017ab1b19 + checksum: 10c0/cc9ac8f7249c24191d614341aeb1b003b7b135f97179d6b7ba4e9765197d3e5156e36a1f0a56010855140d866770b71c4f0ccd19672a1b05ca6d1373bab45dc6 languageName: node linkType: hard -"@aws-sdk/lib-storage@npm:^3.1115.0": - version: 3.1115.0 - resolution: "@aws-sdk/lib-storage@npm:3.1115.0" +"@aws-sdk/lib-storage@npm:^3.1121.0": + version: 3.1121.0 + resolution: "@aws-sdk/lib-storage@npm:3.1121.0" dependencies: - "@smithy/core": "npm:^3.31.1" - "@smithy/types": "npm:^4.16.1" + "@smithy/core": "npm:^3.33.3" + "@smithy/types": "npm:^4.17.2" buffer: "npm:5.6.0" events: "npm:3.3.0" stream-browserify: "npm:3.0.0" tslib: "npm:^2.6.2" peerDependencies: - "@aws-sdk/client-s3": ^3.1115.0 - checksum: 10c0/678be35f73bbe2c97dd16f53969a332fdf19bae7de765b41e9efe9922ce832afa758a68e6a29dab9e5d36d2134f283db52b190cd29a9461c7d640ea360646dcc + "@aws-sdk/client-s3": ^3.1121.0 + checksum: 10c0/50b139eae0d78bab254aa2fd6c1ae3a3f183e72ee1442f11b8a91cfc199437bf19da083f60752968b6dc5f7f02f44437ece1fbcc5f5bda048a34e7ab6bcd1f66 languageName: node linkType: hard -"@aws-sdk/middleware-sdk-s3@npm:^3.972.74": - version: 3.972.74 - resolution: "@aws-sdk/middleware-sdk-s3@npm:3.972.74" +"@aws-sdk/middleware-sdk-s3@npm:^3.972.75": + version: 3.972.75 + resolution: "@aws-sdk/middleware-sdk-s3@npm:3.972.75" dependencies: - "@aws-sdk/core": "npm:^3.977.8" - "@aws-sdk/signature-v4-multi-region": "npm:^3.996.45" - "@aws-sdk/types": "npm:^3.974.4" - "@smithy/core": "npm:^3.31.1" - "@smithy/types": "npm:^4.16.1" + "@aws-sdk/core": "npm:^3.977.9" + "@aws-sdk/signature-v4-multi-region": "npm:^3.996.46" + "@aws-sdk/types": "npm:^3.974.5" + "@smithy/core": "npm:^3.33.3" + "@smithy/types": "npm:^4.17.2" tslib: "npm:^2.6.2" - checksum: 10c0/6c4008031d66a97add7c44c8e5d9f148a966236ed0a1cb15f1c92255db3dfaa87ba02a876ada7265e30a0f3ec9b85427e772d600f5f7fb6c75838ff746af7d36 + checksum: 10c0/a78eab5895803f3763bf09da2fdcabcd3008c35a57b339523868b84e028a836b1e065af57780975041eb8fb2d2420da5d462e3e1638a956c79777f1ec940d220 languageName: node linkType: hard -"@aws-sdk/nested-clients@npm:^3.997.43": - version: 3.997.43 - resolution: "@aws-sdk/nested-clients@npm:3.997.43" +"@aws-sdk/nested-clients@npm:^3.997.44": + version: 3.997.44 + resolution: "@aws-sdk/nested-clients@npm:3.997.44" dependencies: - "@aws-sdk/core": "npm:^3.977.8" - "@aws-sdk/signature-v4-multi-region": "npm:^3.996.45" - "@aws-sdk/types": "npm:^3.974.4" - "@smithy/core": "npm:^3.31.1" - "@smithy/fetch-http-handler": "npm:^5.6.13" - "@smithy/node-http-handler": "npm:^4.9.13" - "@smithy/types": "npm:^4.16.1" + "@aws-sdk/core": "npm:^3.977.9" + "@aws-sdk/signature-v4-multi-region": "npm:^3.996.46" + "@aws-sdk/types": "npm:^3.974.5" + "@smithy/core": "npm:^3.33.3" + "@smithy/fetch-http-handler": "npm:^5.7.2" + "@smithy/node-http-handler": "npm:^4.11.3" + "@smithy/types": "npm:^4.17.2" tslib: "npm:^2.6.2" - checksum: 10c0/ed4ed90c77b2538dc2a356d2d8dd9b9ac56d3a92e7230541a0d7c6879449c41553c1b680263fb7bc783ad2898b5b31bd321c0eb7c05719f446d8662268ed4a98 + checksum: 10c0/947c2049a69a02399f600bd448f34bcaaf3a97b5bbb9b43e9ce932e84d4e9c3131687d330b9c48391da4365582890dd72bf4b8dfafe0693c041e48aa0f5c972d languageName: node linkType: hard -"@aws-sdk/s3-presigned-post@npm:^3.1115.0": - version: 3.1115.0 - resolution: "@aws-sdk/s3-presigned-post@npm:3.1115.0" +"@aws-sdk/s3-presigned-post@npm:^3.1121.0": + version: 3.1121.0 + resolution: "@aws-sdk/s3-presigned-post@npm:3.1121.0" dependencies: - "@aws-sdk/client-s3": "npm:3.1115.0" - "@aws-sdk/core": "npm:^3.977.8" - "@aws-sdk/types": "npm:^3.974.4" - "@smithy/core": "npm:^3.31.1" + "@aws-sdk/client-s3": "npm:3.1121.0" + "@aws-sdk/core": "npm:^3.977.9" + "@aws-sdk/types": "npm:^3.974.5" + "@smithy/core": "npm:^3.33.3" "@smithy/signature-v4": "npm:^5.6.12" - "@smithy/types": "npm:^4.16.1" + "@smithy/types": "npm:^4.17.2" tslib: "npm:^2.6.2" - checksum: 10c0/7ec194e073e0e310072f7c69f3e6f339db14abdf4d338a1b2f14a2f6288c947b5f710a00a2933fa02854a9a0130add94d26cee30cb28bf545a6495398b16a08f + checksum: 10c0/927f53e0824329ab8f1756e49d38b89a2b13ba119f2f926ae732b3b9e5bd86e4fe909f1a61b83f2537317fb7b434860e2091f917bb016bdbc27b2019804220ef languageName: node linkType: hard -"@aws-sdk/s3-request-presigner@npm:^3.1115.0": - version: 3.1115.0 - resolution: "@aws-sdk/s3-request-presigner@npm:3.1115.0" +"@aws-sdk/s3-request-presigner@npm:^3.1121.0": + version: 3.1121.0 + resolution: "@aws-sdk/s3-request-presigner@npm:3.1121.0" dependencies: - "@aws-sdk/core": "npm:^3.977.8" - "@aws-sdk/signature-v4-multi-region": "npm:^3.996.45" - "@aws-sdk/types": "npm:^3.974.4" - "@smithy/core": "npm:^3.31.1" - "@smithy/types": "npm:^4.16.1" + "@aws-sdk/core": "npm:^3.977.9" + "@aws-sdk/signature-v4-multi-region": "npm:^3.996.46" + "@aws-sdk/types": "npm:^3.974.5" + "@smithy/core": "npm:^3.33.3" + "@smithy/types": "npm:^4.17.2" tslib: "npm:^2.6.2" - checksum: 10c0/97a4114101609473e79dbc1175f971957ce9a3dc1bc982c8ae3116044ccf01317d8701e191ed1abca40b21414af61d468a0149732ffae9cc62355d7a01b7e1b0 + checksum: 10c0/416e9de4a9e2e7bfeb9e97d95bdb15664880b485eb429ed812641f3555878e9577948e695cf05ecdb191283033200c7ee9388c71069b34670e514d98be039b52 languageName: node linkType: hard -"@aws-sdk/signature-v4-crt@npm:^3.1115.0": - version: 3.1115.0 - resolution: "@aws-sdk/signature-v4-crt@npm:3.1115.0" +"@aws-sdk/signature-v4-crt@npm:^3.1121.0": + version: 3.1121.0 + resolution: "@aws-sdk/signature-v4-crt@npm:3.1121.0" dependencies: - "@aws-sdk/crt-loader": "npm:^3.972.73" - "@aws-sdk/signature-v4-multi-region": "npm:^3.996.45" - "@aws-sdk/types": "npm:^3.974.4" - "@smithy/core": "npm:^3.31.1" + "@aws-sdk/crt-loader": "npm:^3.972.74" + "@aws-sdk/signature-v4-multi-region": "npm:^3.996.46" + "@aws-sdk/types": "npm:^3.974.5" + "@smithy/core": "npm:^3.33.3" "@smithy/signature-v4": "npm:^5.6.12" - "@smithy/types": "npm:^4.16.1" + "@smithy/types": "npm:^4.17.2" tslib: "npm:^2.6.2" - checksum: 10c0/4f4e26b05dfe71d813d82151248b3f42534f13a801c8dad516b52925e2890a498ed01a70a1c88b2615cc0a590a007c46911e8c08aeda569387d675e0fc6f877e + checksum: 10c0/f4c3eddd670e30b26ef7dd9ad8995cccc885dd0fc97d1aa06da93e69d406e8a9a39b9fdf09cf5674e1ea0767a25790a899390c8a95e7efc3fcc90c75c0718a40 languageName: node linkType: hard -"@aws-sdk/signature-v4-multi-region@npm:^3.996.45": - version: 3.996.45 - resolution: "@aws-sdk/signature-v4-multi-region@npm:3.996.45" +"@aws-sdk/signature-v4-multi-region@npm:^3.996.46": + version: 3.996.46 + resolution: "@aws-sdk/signature-v4-multi-region@npm:3.996.46" dependencies: - "@aws-sdk/types": "npm:^3.974.4" + "@aws-sdk/types": "npm:^3.974.5" "@smithy/signature-v4": "npm:^5.6.12" - "@smithy/types": "npm:^4.16.1" + "@smithy/types": "npm:^4.17.2" tslib: "npm:^2.6.2" - checksum: 10c0/ffa87cfef6a90a9f2b122eb9c1cb88cc70062f9ad22f8a2b88d16ea6d52b5a26fc5d3a85647feab7c4938bce1d7d0d749c7793120d7781045281a2b6221740cb + checksum: 10c0/069dfb7a95663cad2e0aec1d87df8a800abad33cb49dfbe9412dad2d63ab6350328c6165166b12d50e609d8dbe5a5536aa6b1101be4d91584fbca76b2fea4d00 languageName: node linkType: hard -"@aws-sdk/token-providers@npm:3.1111.0": - version: 3.1111.0 - resolution: "@aws-sdk/token-providers@npm:3.1111.0" +"@aws-sdk/token-providers@npm:3.1116.0": + version: 3.1116.0 + resolution: "@aws-sdk/token-providers@npm:3.1116.0" dependencies: - "@aws-sdk/core": "npm:^3.977.8" - "@aws-sdk/nested-clients": "npm:^3.997.43" - "@aws-sdk/types": "npm:^3.974.4" - "@smithy/core": "npm:^3.31.1" - "@smithy/types": "npm:^4.16.1" + "@aws-sdk/core": "npm:^3.977.9" + "@aws-sdk/nested-clients": "npm:^3.997.44" + "@aws-sdk/types": "npm:^3.974.5" + "@smithy/core": "npm:^3.33.3" + "@smithy/types": "npm:^4.17.2" tslib: "npm:^2.6.2" - checksum: 10c0/845dae0fac654149f733dc3ae740d8745b586b2abfc848d20b11ab044a51506a972ebdc29ee402e160b359c2f1a2d61c723ed676022b65ff97af2e3266b843af + checksum: 10c0/e720401f6b6d5682984cf1927d3e4c86663b750086bac3b58827a3b9b8585c8b06fb93af82a03a40d5a8ca48c89c0f47c1ac48ea81822c52ddecc3e36ef7cf17 languageName: node linkType: hard -"@aws-sdk/types@npm:^3.974.4": - version: 3.974.4 - resolution: "@aws-sdk/types@npm:3.974.4" +"@aws-sdk/types@npm:^3.974.5": + version: 3.974.5 + resolution: "@aws-sdk/types@npm:3.974.5" dependencies: - "@smithy/types": "npm:^4.16.1" + "@smithy/types": "npm:^4.17.2" tslib: "npm:^2.6.2" - checksum: 10c0/64f6ed62d7da705c6af02ec3579f49a9dee800d198fcbdf5b2b6a11cc5f03f64f5105429edc5a454fc3c8672237dfa851d6002ec24a25914267750f63e184e1b + checksum: 10c0/803aaaa1c0675dcb564803993f3c47d96302fad461af8af80e75afc40c72228ebf669593c18e44ca09fc5acf0d1bd25966261de07844d8f11ad82aa2650252d0 languageName: node linkType: hard @@ -356,13 +356,13 @@ __metadata: languageName: node linkType: hard -"@aws-sdk/xml-builder@npm:^3.972.39": - version: 3.972.39 - resolution: "@aws-sdk/xml-builder@npm:3.972.39" +"@aws-sdk/xml-builder@npm:^3.972.40": + version: 3.972.40 + resolution: "@aws-sdk/xml-builder@npm:3.972.40" dependencies: - "@smithy/types": "npm:^4.16.1" + "@smithy/types": "npm:^4.17.2" tslib: "npm:^2.6.2" - checksum: 10c0/0f217f53264c943aaeba61450b95a479adaf435bfb19716a2cefb9f6f2b90848e202eb210ecc9371616138c9c0ae931294033582ee1aaa8288790684bef75514 + checksum: 10c0/5b06fa0466b5ddb0e33138dc16f6a30e11e52fc5ea71f3ed72af7b24621d29c9e8103df3eed9c4f14cef50f4d345dd9e7021242a8c155a67869ee4ce79982bb4 languageName: node linkType: hard @@ -5893,6 +5893,16 @@ __metadata: languageName: node linkType: hard +"@smithy/core@npm:^3.33.2, @smithy/core@npm:^3.33.3": + version: 3.33.3 + resolution: "@smithy/core@npm:3.33.3" + dependencies: + "@smithy/types": "npm:^4.17.2" + tslib: "npm:^2.6.2" + checksum: 10c0/57c5c6c1834d84eddfff905932350973afa20e1006024b82d6599af4c8d1e75b243e06b93c998acc95946399f1342ddc298c6941e0030384e6541ceec4007376 + languageName: node + linkType: hard + "@smithy/credential-provider-imds@npm:^4.4.16": version: 4.4.16 resolution: "@smithy/credential-provider-imds@npm:4.4.16" @@ -5904,25 +5914,25 @@ __metadata: languageName: node linkType: hard -"@smithy/fetch-http-handler@npm:^5.6.13": - version: 5.6.13 - resolution: "@smithy/fetch-http-handler@npm:5.6.13" +"@smithy/fetch-http-handler@npm:^5.7.2": + version: 5.7.2 + resolution: "@smithy/fetch-http-handler@npm:5.7.2" dependencies: - "@smithy/core": "npm:^3.31.1" - "@smithy/types": "npm:^4.16.1" + "@smithy/core": "npm:^3.33.2" + "@smithy/types": "npm:^4.17.2" tslib: "npm:^2.6.2" - checksum: 10c0/028ba8794a6c487ebefae7f40d0124f70e51a1f4e0e465457845c1a44fd607320cd3c64d4a961f159aef59470f0fd43f0d2011b44ee5ef753b7e1dccbdf32ca3 + checksum: 10c0/9f4541cb743a5207f33d6abd135642a5310cc24f0ed5d46836bf3692901110216f64e09df977488a652762332156fe914b934c780f6a95ef8b1c7d3235c99c7f languageName: node linkType: hard -"@smithy/node-http-handler@npm:^4.9.13": - version: 4.9.13 - resolution: "@smithy/node-http-handler@npm:4.9.13" +"@smithy/node-http-handler@npm:^4.11.3": + version: 4.11.3 + resolution: "@smithy/node-http-handler@npm:4.11.3" dependencies: - "@smithy/core": "npm:^3.31.1" - "@smithy/types": "npm:^4.16.1" + "@smithy/core": "npm:^3.33.3" + "@smithy/types": "npm:^4.17.2" tslib: "npm:^2.6.2" - checksum: 10c0/2f1cdef7a300ad49c3bb698c2ca4773af5e9202d291cfcd855c1b21ab08b3c4ddf56f3722d3251db4e9b7ac39ec1ebc551b156abf3fa70f74c5491bec421f6b5 + checksum: 10c0/b1ec5956281d7ab5a5d1d4ca890b5d9f84f6540bb80c07e5b0eb31426bad27ff03ae56851e95c3fc8efb52ac9d432df86f9735e1be01db7ecdd1559a85683589 languageName: node linkType: hard @@ -5946,6 +5956,15 @@ __metadata: languageName: node linkType: hard +"@smithy/types@npm:^4.17.2": + version: 4.17.2 + resolution: "@smithy/types@npm:4.17.2" + dependencies: + tslib: "npm:^2.6.2" + checksum: 10c0/7a11f38e6dacdf2247c17bcd50a68ce6200a09dc6a7ecd8d563de94855a25c1da45c4d98f586e3c6fe94727ddbbde6d88ff212ac8eabf7d49779902d1a99a715 + languageName: node + linkType: hard + "@so-ric/colorspace@npm:^1.1.6": version: 1.1.6 resolution: "@so-ric/colorspace@npm:1.1.6" @@ -15504,12 +15523,12 @@ __metadata: version: 0.0.0-use.local resolution: "outline@workspace:." dependencies: - "@aws-sdk/client-s3": "npm:^3.1115.0" - "@aws-sdk/cloudfront-signer": "npm:^3.1111.0" - "@aws-sdk/lib-storage": "npm:^3.1115.0" - "@aws-sdk/s3-presigned-post": "npm:^3.1115.0" - "@aws-sdk/s3-request-presigner": "npm:^3.1115.0" - "@aws-sdk/signature-v4-crt": "npm:^3.1115.0" + "@aws-sdk/client-s3": "npm:^3.1121.0" + "@aws-sdk/cloudfront-signer": "npm:^3.1116.0" + "@aws-sdk/lib-storage": "npm:^3.1121.0" + "@aws-sdk/s3-presigned-post": "npm:^3.1121.0" + "@aws-sdk/s3-request-presigner": "npm:^3.1121.0" + "@aws-sdk/signature-v4-crt": "npm:^3.1121.0" "@benrbray/prosemirror-math": "npm:^0.2.2" "@bull-board/api": "npm:^6.21.3" "@bull-board/koa": "npm:^6.21.3" From 9e6b98e12b54f8e289267b54ef46f3cc72c716f0 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Wed, 2 Sep 2026 09:10:21 -0400 Subject: [PATCH 045/181] perf: limit document search trigger updates (#13615) --- ...5149-limit-document-search-trigger-columns.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 server/migrations/20260902125149-limit-document-search-trigger-columns.js diff --git a/server/migrations/20260902125149-limit-document-search-trigger-columns.js b/server/migrations/20260902125149-limit-document-search-trigger-columns.js new file mode 100644 index 0000000000..b3fbfe172f --- /dev/null +++ b/server/migrations/20260902125149-limit-document-search-trigger-columns.js @@ -0,0 +1,16 @@ +"use strict"; + +/** @type {import('sequelize-cli').Migration} */ +module.exports = { + async up(queryInterface) { + await queryInterface.sequelize.query( + 'CREATE OR REPLACE TRIGGER documents_tsvectorupdate BEFORE INSERT OR UPDATE OF title, text, "previousTitles" ON documents FOR EACH ROW EXECUTE PROCEDURE documents_search_trigger();' + ); + }, + + async down(queryInterface) { + await queryInterface.sequelize.query( + "CREATE OR REPLACE TRIGGER documents_tsvectorupdate BEFORE INSERT OR UPDATE ON documents FOR EACH ROW EXECUTE PROCEDURE documents_search_trigger();" + ); + }, +}; From 8b799966b75d4c7522b037fe6a3ea54f78bc21e4 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Wed, 2 Sep 2026 19:02:57 -0400 Subject: [PATCH 046/181] perf: move cleanup reads to follower (#13616) * perf: run cleanup scans on follower * perf: move document cleanup reads to follower --- server/commands/documentPermanentDeleter.ts | 21 ++++++---- .../tasks/CleanupDeletedDocumentsTask.ts | 24 ++++++----- server/queues/tasks/CleanupOldEventsTask.ts | 42 ++++++++++--------- .../tasks/CleanupOldSearchQueriesTask.ts | 42 ++++++++++--------- 4 files changed, 72 insertions(+), 57 deletions(-) diff --git a/server/commands/documentPermanentDeleter.ts b/server/commands/documentPermanentDeleter.ts index 6432d055e7..a52a3aee65 100644 --- a/server/commands/documentPermanentDeleter.ts +++ b/server/commands/documentPermanentDeleter.ts @@ -6,7 +6,7 @@ import { Document, Attachment } from "@server/models"; import { DocumentHelper } from "@server/models/helpers/DocumentHelper"; import { ProsemirrorHelper } from "@server/models/helpers/ProsemirrorHelper"; import DeleteAttachmentTask from "@server/queues/tasks/DeleteAttachmentTask"; -import { sequelize } from "@server/storage/database"; +import { sequelizeReadOnly } from "@server/storage/database"; export default async function documentPermanentDeleter(documents: Document[]) { const activeDocument = documents.find((doc) => !doc.deletedAt); @@ -52,14 +52,17 @@ export default async function documentPermanentDeleter(documents: Document[]) { // Check if the attachment is referenced in any other documents – this // is needed as it's easy to copy and paste content between documents. // An uploaded attachment may end up referenced in multiple documents. - const [{ count }] = await sequelize.query<{ count: string }>(query, { - type: QueryTypes.SELECT, - replacements: { - documentId: document.id, - teamId: document.teamId, - query: attachmentId, - }, - }); + const [{ count }] = await sequelizeReadOnly.query<{ count: string }>( + query, + { + type: QueryTypes.SELECT, + replacements: { + documentId: document.id, + teamId: document.teamId, + query: attachmentId, + }, + } + ); // If the attachment is not referenced in any other documents then // delete it from the database and the storage provider. diff --git a/server/queues/tasks/CleanupDeletedDocumentsTask.ts b/server/queues/tasks/CleanupDeletedDocumentsTask.ts index 21c537b6b4..f5b3f06074 100644 --- a/server/queues/tasks/CleanupDeletedDocumentsTask.ts +++ b/server/queues/tasks/CleanupDeletedDocumentsTask.ts @@ -3,6 +3,7 @@ import { Op } from "sequelize"; import documentPermanentDeleter from "@server/commands/documentPermanentDeleter"; import Logger from "@server/logging/Logger"; import { Document } from "@server/models"; +import { sequelizeReadOnly } from "@server/storage/database"; import { TaskPriority } from "./base/BaseTask"; import { Minute } from "@shared/utils/time"; import type { Props } from "./base/CronTask"; @@ -14,17 +15,20 @@ export default class CleanupDeletedDocumentsTask extends CronTask { "task", `Permanently destroying upto ${limit} documents older than 30 days…` ); - const documents = await Document.unscoped().findAll({ - attributes: ["id", "teamId", "deletedAt", "content", "state", "text"], - where: { - deletedAt: { - [Op.lt]: subDays(new Date(), 30), + const documents = await sequelizeReadOnly.transaction((transaction) => + Document.unscoped().findAll({ + attributes: ["id", "teamId", "deletedAt", "content", "state", "text"], + where: { + deletedAt: { + [Op.lt]: subDays(new Date(), 30), + }, + ...this.getPartitionWhereClause("id", partition), }, - ...this.getPartitionWhereClause("id", partition), - }, - paranoid: false, - limit, - }); + paranoid: false, + limit, + transaction, + }) + ); const countDeletedDocument = await documentPermanentDeleter(documents); Logger.info("task", `Destroyed ${countDeletedDocument} documents`); } diff --git a/server/queues/tasks/CleanupOldEventsTask.ts b/server/queues/tasks/CleanupOldEventsTask.ts index c1183c7719..f0609a467d 100644 --- a/server/queues/tasks/CleanupOldEventsTask.ts +++ b/server/queues/tasks/CleanupOldEventsTask.ts @@ -2,6 +2,7 @@ import { subDays } from "date-fns"; import { Op } from "sequelize"; import Logger from "@server/logging/Logger"; import { Event } from "@server/models"; +import { sequelizeReadOnly } from "@server/storage/database"; import { TaskPriority } from "./base/BaseTask"; import type { Props } from "./base/CronTask"; import { CronTask, TaskInterval } from "./base/CronTask"; @@ -16,28 +17,31 @@ export default class CleanupOldEventsTask extends CronTask { let totalEventsDeleted = 0; try { - await Event.findAllInBatches( - { - attributes: ["id"], - where: { - createdAt: { - [Op.lt]: cutoffDate, - }, - ...this.getPartitionWhereClause("id", partition), - }, - batchLimit: 1000, - totalLimit: maxEventsPerTask, - order: [["createdAt", "ASC"]], - }, - async (events) => { - totalEventsDeleted += await Event.destroy({ + await sequelizeReadOnly.transaction(async (transaction) => + Event.findAllInBatches( + { + attributes: ["id"], where: { - id: { - [Op.in]: events.map((event) => event.id), + createdAt: { + [Op.lt]: cutoffDate, }, + ...this.getPartitionWhereClause("id", partition), }, - }); - } + batchLimit: 1000, + totalLimit: maxEventsPerTask, + order: [["createdAt", "ASC"]], + transaction, + }, + async (events) => { + totalEventsDeleted += await Event.destroy({ + where: { + id: { + [Op.in]: events.map((event) => event.id), + }, + }, + }); + } + ) ); } finally { if (totalEventsDeleted > 0) { diff --git a/server/queues/tasks/CleanupOldSearchQueriesTask.ts b/server/queues/tasks/CleanupOldSearchQueriesTask.ts index 9c21137a80..4a48efd393 100644 --- a/server/queues/tasks/CleanupOldSearchQueriesTask.ts +++ b/server/queues/tasks/CleanupOldSearchQueriesTask.ts @@ -2,6 +2,7 @@ import { subDays } from "date-fns"; import { Op } from "sequelize"; import Logger from "@server/logging/Logger"; import { SearchQuery } from "@server/models"; +import { sequelizeReadOnly } from "@server/storage/database"; import { TaskPriority } from "./base/BaseTask"; import type { Props } from "./base/CronTask"; import { CronTask, TaskInterval } from "./base/CronTask"; @@ -16,28 +17,31 @@ export default class CleanupOldSearchQueriesTask extends CronTask { let totalSearchQueriesDeleted = 0; try { - await SearchQuery.findAllInBatches( - { - attributes: ["id"], - where: { - createdAt: { - [Op.lt]: cutoffDate, - }, - ...this.getPartitionWhereClause("id", partition), - }, - batchLimit: 1000, - totalLimit: maxSearchQueriesPerTask, - order: [["createdAt", "ASC"]], - }, - async (searchQueries) => { - totalSearchQueriesDeleted += await SearchQuery.destroy({ + await sequelizeReadOnly.transaction(async (transaction) => + SearchQuery.findAllInBatches( + { + attributes: ["id"], where: { - id: { - [Op.in]: searchQueries.map((searchQuery) => searchQuery.id), + createdAt: { + [Op.lt]: cutoffDate, }, + ...this.getPartitionWhereClause("id", partition), }, - }); - } + batchLimit: 1000, + totalLimit: maxSearchQueriesPerTask, + order: [["createdAt", "ASC"]], + transaction, + }, + async (searchQueries) => { + totalSearchQueriesDeleted += await SearchQuery.destroy({ + where: { + id: { + [Op.in]: searchQueries.map((searchQuery) => searchQuery.id), + }, + }, + }); + } + ) ); } finally { if (totalSearchQueriesDeleted > 0) { From 495f2a5830bc3c4f3570deacb461ae7933b6a7f7 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Wed, 2 Sep 2026 19:06:15 -0400 Subject: [PATCH 047/181] perf: Use follower for exports (#13617) * perf: Use follower for exports * fix: Skip empty attachment queries in JSON exports --- server/queues/tasks/ExportDocumentTreeTask.ts | 44 +++++++----- server/queues/tasks/ExportJSONTask.test.ts | 50 +++++++++++++ server/queues/tasks/ExportJSONTask.ts | 72 ++++++++++++------- server/queues/tasks/ExportTask.ts | 30 ++++---- 4 files changed, 143 insertions(+), 53 deletions(-) create mode 100644 server/queues/tasks/ExportJSONTask.test.ts diff --git a/server/queues/tasks/ExportDocumentTreeTask.ts b/server/queues/tasks/ExportDocumentTreeTask.ts index e9a405f235..e803fae5d7 100644 --- a/server/queues/tasks/ExportDocumentTreeTask.ts +++ b/server/queues/tasks/ExportDocumentTreeTask.ts @@ -12,6 +12,7 @@ import { DocumentHelper } from "@server/models/helpers/DocumentHelper"; import HTMLHelper from "@server/models/helpers/HTMLHelper"; import { ProsemirrorHelper } from "@server/models/helpers/ProsemirrorHelper"; import TextBundleHelper from "@server/models/helpers/TextBundleHelper"; +import { sequelizeReadOnly } from "@server/storage/database"; import ZipHelper from "@server/utils/ZipHelper"; import { serializeFilename } from "@server/utils/fs"; import ExportTask from "./ExportTask"; @@ -60,11 +61,36 @@ export default abstract class ExportDocumentTreeTask extends ExportTask { pathMap: Map; }) { Logger.debug("task", `Adding document to archive`, { documentId }); - const document = await Document.findByPk(documentId); - if (!document) { + const result = await sequelizeReadOnly.transaction(async (transaction) => { + const document = await Document.findByPk(documentId, { transaction }); + if (!document) { + return; + } + + const attachmentIds = includeAttachments + ? ProsemirrorHelper.parseAttachmentIds( + DocumentHelper.toProsemirror(document) + ) + : []; + const attachments = attachmentIds.length + ? await Attachment.findAll({ + where: { + teamId: document.teamId, + id: attachmentIds, + }, + transaction, + }) + : []; + + return { attachments, document }; + }); + + if (!result) { return; } + const { attachments, document } = result; + let text = format === FileOperationFormat.HTMLZip ? await DocumentHelper.toHTML(document, { centered: true }) @@ -79,20 +105,6 @@ export default abstract class ExportDocumentTreeTask extends ExportTask { : pathInZip; const usedAssetNames = new Set(); - const attachmentIds = includeAttachments - ? ProsemirrorHelper.parseAttachmentIds( - DocumentHelper.toProsemirror(document) - ) - : []; - const attachments = attachmentIds.length - ? await Attachment.findAll({ - where: { - teamId: document.teamId, - id: attachmentIds, - }, - }) - : []; - // Add any referenced attachments to the zip file and replace the // reference in the document with the path to the attachment in the zip for (const attachment of attachments) { diff --git a/server/queues/tasks/ExportJSONTask.test.ts b/server/queues/tasks/ExportJSONTask.test.ts new file mode 100644 index 0000000000..ed8b4b58a7 --- /dev/null +++ b/server/queues/tasks/ExportJSONTask.test.ts @@ -0,0 +1,50 @@ +import fs from "fs-extra"; +import { vi } from "vitest"; +import { Attachment } from "@server/models"; +import { + buildCollection, + buildDocument, + buildFileOperation, + buildTeam, + buildUser, +} from "@server/test/factories"; +import ExportJSONTask from "./ExportJSONTask"; + +describe("ExportJSONTask", () => { + afterEach(() => { + vi.restoreAllMocks(); + }); + + it("should not query attachments when no attachment IDs are present", async () => { + const team = await buildTeam(); + const user = await buildUser({ teamId: team.id }); + const collection = await buildCollection({ + teamId: team.id, + userId: user.id, + description: "No attachments", + }); + const document = await buildDocument({ + teamId: team.id, + userId: user.id, + collectionId: collection.id, + text: "No attachments", + }); + await collection.addDocumentToStructure(document); + const fileOperation = await buildFileOperation({ + teamId: team.id, + userId: user.id, + }); + const findAll = vi.spyOn(Attachment, "findAll"); + + const filePath = await new ExportJSONTask().exportCollections( + [collection], + fileOperation + ); + + try { + expect(findAll).not.toHaveBeenCalled(); + } finally { + await fs.remove(filePath); + } + }); +}); diff --git a/server/queues/tasks/ExportJSONTask.ts b/server/queues/tasks/ExportJSONTask.ts index 6761d80321..9023b38192 100644 --- a/server/queues/tasks/ExportJSONTask.ts +++ b/server/queues/tasks/ExportJSONTask.ts @@ -7,6 +7,7 @@ import { Attachment, Document } from "@server/models"; import { DocumentHelper } from "@server/models/helpers/DocumentHelper"; import { ProsemirrorHelper } from "@server/models/helpers/ProsemirrorHelper"; import { presentAttachment, presentCollection } from "@server/presenters"; +import { sequelizeReadOnly } from "@server/storage/database"; import type { CollectionJSONExport, JSONExportMetadata } from "@server/types"; import ZipHelper from "@server/utils/ZipHelper"; import { serializeFilename } from "@server/utils/fs"; @@ -97,26 +98,43 @@ export default class ExportJSONTask extends ExportTask { const addDocumentTree = async (nodes: NavigationNode[]) => { for (const node of nodes) { - const document = await Document.findByPk(node.id, { - includeState: true, - }); + const result = await sequelizeReadOnly.transaction( + async (transaction) => { + const document = await Document.findByPk(node.id, { + includeState: true, + transaction, + }); - if (!document) { + if (!document) { + return; + } + + const attachmentIds = includeAttachments + ? ProsemirrorHelper.parseAttachmentIds( + DocumentHelper.toProsemirror(document) + ) + : []; + const attachments = attachmentIds.length + ? await Attachment.findAll({ + where: { + teamId: document.teamId, + id: attachmentIds, + }, + transaction, + }) + : []; + + return { attachments, document }; + } + ); + + if (!result) { continue; } - const documentAttachments = includeAttachments - ? await Attachment.findAll({ - where: { - teamId: document.teamId, - id: ProsemirrorHelper.parseAttachmentIds( - DocumentHelper.toProsemirror(document) - ), - }, - }) - : []; + const { attachments, document } = result; - addAttachments(documentAttachments); + addAttachments(attachments); output.documents[document.id] = { id: document.id, @@ -143,15 +161,21 @@ export default class ExportJSONTask extends ExportTask { } }; - const collectionAttachments = includeAttachments - ? await Attachment.findAll({ - where: { - teamId: collection.teamId, - id: ProsemirrorHelper.parseAttachmentIds( - DocumentHelper.toProsemirror(collection) - ), - }, - }) + const collectionAttachmentIds = includeAttachments + ? ProsemirrorHelper.parseAttachmentIds( + DocumentHelper.toProsemirror(collection) + ) + : []; + const collectionAttachments = collectionAttachmentIds.length + ? await sequelizeReadOnly.transaction((transaction) => + Attachment.findAll({ + where: { + teamId: collection.teamId, + id: collectionAttachmentIds, + }, + transaction, + }) + ) : []; addAttachments(collectionAttachments); diff --git a/server/queues/tasks/ExportTask.ts b/server/queues/tasks/ExportTask.ts index 4054f2bd01..2a927b240a 100644 --- a/server/queues/tasks/ExportTask.ts +++ b/server/queues/tasks/ExportTask.ts @@ -1,6 +1,8 @@ import { Readable } from "node:stream"; import fs from "fs-extra"; import { truncate } from "es-toolkit/compat"; +import { Op } from "sequelize"; +import type { WhereOptions } from "sequelize"; import type { ZipFile } from "yazl"; import { toError } from "@shared/utils/error"; import type { NavigationNode } from "@shared/types"; @@ -21,11 +23,9 @@ import { User, } from "@server/models"; import fileOperationPresenter from "@server/presenters/fileOperation"; +import { sequelizeReadOnly } from "@server/storage/database"; import FileStorage from "@server/storage/files"; import { BaseTask, TaskPriority } from "./base/BaseTask"; -import { Op } from "sequelize"; -import { sequelizeReadOnly } from "@server/storage/database"; -import type { WhereOptions } from "sequelize"; type Props = { fileOperationId: string; @@ -126,13 +126,16 @@ export default abstract class ExportTask extends BaseTask { user: User ): Promise { if (fileOperation.documentId) { - const document = await Document.findByPk(fileOperation.documentId!, { - include: { - model: Collection.scope("withDocumentStructure"), - as: "collection", - }, - rejectOnEmpty: true, - }); + const document = await sequelizeReadOnly.transaction((transaction) => + Document.findByPk(fileOperation.documentId!, { + include: { + model: Collection.scope("withDocumentStructure"), + as: "collection", + }, + rejectOnEmpty: true, + transaction, + }) + ); const documentStructure = document.collection?.getDocumentTree( document.id @@ -189,10 +192,11 @@ export default abstract class ExportTask extends BaseTask { }; } - const collections = await Collection.scope("withDocumentStructure").findAll( - { + const collections = await sequelizeReadOnly.transaction((transaction) => + Collection.scope("withDocumentStructure").findAll({ where, - } + transaction, + }) ); return this.exportCollections(collections, fileOperation); From 1eee828f73a69f70a60e56c9bdfe31ca13d545d2 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Wed, 2 Sep 2026 19:09:14 -0400 Subject: [PATCH 048/181] fix: Allow null webhook subscription secrets (#13622) --- plugins/webhooks/server/api/schema.ts | 4 +-- .../server/api/webhookSubscriptions.test.ts | 25 +++++++++++++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/plugins/webhooks/server/api/schema.ts b/plugins/webhooks/server/api/schema.ts index 88c2fe3b2c..a9ec09ab44 100644 --- a/plugins/webhooks/server/api/schema.ts +++ b/plugins/webhooks/server/api/schema.ts @@ -45,7 +45,7 @@ export const WebhookSubscriptionsCreateSchema = z.object({ body: z.object({ name: z.string(), url: webhookUrl, - secret: z.string().optional(), + secret: z.string().nullish(), events: z.array(z.string()), }), }); @@ -59,7 +59,7 @@ export const WebhookSubscriptionsUpdateSchema = z.object({ id: z.uuid(), name: z.string(), url: webhookUrl, - secret: z.string().optional(), + secret: z.string().nullish(), events: z.array(z.string()), }), }); diff --git a/plugins/webhooks/server/api/webhookSubscriptions.test.ts b/plugins/webhooks/server/api/webhookSubscriptions.test.ts index 7d3cf3783e..c855be6ad1 100644 --- a/plugins/webhooks/server/api/webhookSubscriptions.test.ts +++ b/plugins/webhooks/server/api/webhookSubscriptions.test.ts @@ -256,6 +256,31 @@ describe("#webhookSubscriptions.update", () => { expect(webhook.enabled).toEqual(true); }); + it("should update a webhook subscription without a signing secret", async () => { + const user = await buildAdmin(); + const name = "Updated webhook name"; + const existingWebhook = await buildWebhookSubscription({ + createdById: user.id, + teamId: user.teamId, + secret: null, + }); + + const res = await server.post("/api/webhookSubscriptions.update", user, { + body: { + id: existingWebhook.id, + name, + url: existingWebhook.url, + events: existingWebhook.events, + secret: null, + }, + }); + const body = await res.json(); + + expect(res.status).toEqual(200); + expect(body.data.name).toEqual(name); + expect(body.data.secret).toBeNull(); + }); + it("should activate a disabled webhook subscription when it's updated", async () => { const user = await buildAdmin(); const name = "Updated webhook name"; From 182c60c6960a55df967534c7538de66a47ad2b9e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 2 Sep 2026 23:20:23 +0000 Subject: [PATCH 049/181] chore(deps-dev): bump @faker-js/faker from 8.4.1 to 10.5.0 (#13618) * chore(deps-dev): bump @faker-js/faker from 8.4.1 to 10.5.0 Bumps [@faker-js/faker](https://github.com/faker-js/faker) from 8.4.1 to 10.5.0. - [Release notes](https://github.com/faker-js/faker/releases) - [Changelog](https://github.com/faker-js/faker/blob/next/CHANGELOG.md) - [Commits](https://github.com/faker-js/faker/compare/v8.4.1...v10.5.0) --- updated-dependencies: - dependency-name: "@faker-js/faker" dependency-version: 10.5.0 dependency-type: direct:development ... Signed-off-by: dependabot[bot] * faker.name -> faker.person * chore: update vulnerable transitive dependencies --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Tom Moor --- package.json | 2 +- .../models/helpers/ProseMirrorHelper.test.ts | 6 +- server/test/factories.ts | 2 +- yarn.lock | 62 +++++-------------- 4 files changed, 19 insertions(+), 53 deletions(-) diff --git a/package.json b/package.json index fcceefca7d..fc95ef598e 100644 --- a/package.json +++ b/package.json @@ -282,7 +282,7 @@ "zod": "^4.4.3" }, "devDependencies": { - "@faker-js/faker": "^8.4.1", + "@faker-js/faker": "^10.5.0", "@relative-ci/agent": "^4.3.1", "@swc/cli": "^0.8.1", "@swc/core": "^1.15.32", diff --git a/server/models/helpers/ProseMirrorHelper.test.ts b/server/models/helpers/ProseMirrorHelper.test.ts index 005ac55049..aa55c6dec6 100644 --- a/server/models/helpers/ProseMirrorHelper.test.ts +++ b/server/models/helpers/ProseMirrorHelper.test.ts @@ -157,7 +157,7 @@ describe("ProsemirrorHelper", () => { }; await user.update({ - name: faker.name.firstName(), + name: faker.person.firstName(), }); const mentionedParagraph: DeepPartial = { @@ -215,8 +215,8 @@ describe("ProsemirrorHelper", () => { modelId: secondUser.id, }; - const firstNewName = faker.name.firstName(); - const secondNewName = faker.name.firstName(); + const firstNewName = faker.person.firstName(); + const secondNewName = faker.person.firstName(); await firstUser.update({ name: firstNewName, diff --git a/server/test/factories.ts b/server/test/factories.ts index 2c4b252850..098b707640 100644 --- a/server/test/factories.ts +++ b/server/test/factories.ts @@ -961,7 +961,7 @@ export function buildMention(overrides: { attrs: { id: overrides.id ?? randomUUID(), type: overrides.type ?? MentionType.User, - label: overrides.label ?? faker.name.fullName(), + label: overrides.label ?? faker.person.fullName(), modelId: overrides.modelId, actorId: overrides.actorId, }, diff --git a/yarn.lock b/yarn.lock index ab58494ce9..f7fdbcb834 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2089,10 +2089,10 @@ __metadata: languageName: node linkType: hard -"@faker-js/faker@npm:^8.4.1": - version: 8.4.1 - resolution: "@faker-js/faker@npm:8.4.1" - checksum: 10c0/4f2aecddcfdc2cc8b50b2d15d1e37302a7c7a5bbd184ae910a9d271bc11248533ca74dcdd4a9ccbe20410553e7af0f6a4d334c5b955635e09a32ddf4a64942d4 +"@faker-js/faker@npm:^10.5.0": + version: 10.5.0 + resolution: "@faker-js/faker@npm:10.5.0" + checksum: 10c0/2de3c7b8f41592d52cefc3ab4c99536656249bca78d5ad184a3b7ac43ecc9d946056cef2c4d37060373ef06ad992d82530de08479fabe16fdbe77b911d842446 languageName: node linkType: hard @@ -5883,17 +5883,7 @@ __metadata: languageName: node linkType: hard -"@smithy/core@npm:^3.31.1": - version: 3.31.1 - resolution: "@smithy/core@npm:3.31.1" - dependencies: - "@smithy/types": "npm:^4.16.1" - tslib: "npm:^2.6.2" - checksum: 10c0/b953c792dea2c13249b58c1799e4d6aaf21eb1a61e203b83e8e3a9156bebe14ca0585f0ca1ffdf65a193294dddff92a06fbe5c3fbd63ff0c174c88130b47a128 - languageName: node - linkType: hard - -"@smithy/core@npm:^3.33.2, @smithy/core@npm:^3.33.3": +"@smithy/core@npm:^3.31.1, @smithy/core@npm:^3.33.2, @smithy/core@npm:^3.33.3": version: 3.33.3 resolution: "@smithy/core@npm:3.33.3" dependencies: @@ -5947,16 +5937,7 @@ __metadata: languageName: node linkType: hard -"@smithy/types@npm:^4.16.1": - version: 4.16.1 - resolution: "@smithy/types@npm:4.16.1" - dependencies: - tslib: "npm:^2.6.2" - checksum: 10c0/e024d9d148deca7bd21d032a9316db109bbe7cf256ffbb8d3981655b9f4f7695c08ec9b87f5a8cf1442e783ba26cb27e4f09603c5bfa3ba1e526c41b1b3e94d2 - languageName: node - linkType: hard - -"@smithy/types@npm:^4.17.2": +"@smithy/types@npm:^4.16.1, @smithy/types@npm:^4.17.2": version: 4.17.2 resolution: "@smithy/types@npm:4.17.2" dependencies: @@ -10167,9 +10148,9 @@ __metadata: linkType: hard "deepmerge-ts@npm:^8.0.1": - version: 8.0.1 - resolution: "deepmerge-ts@npm:8.0.1" - checksum: 10c0/5d41e24ac88f652698179f1ddad02269ac7f91af216a359e528bf35d60fa660046d82001a500a1fa984fc895a8c505249f348a414215da88722fca90108ac083 + version: 8.0.2 + resolution: "deepmerge-ts@npm:8.0.2" + checksum: 10c0/2be1628a305b8621e4e1abec9ec397aba9745d3c50da714a12e1ac60dc3eb32ee4ea8e1be4c240baf18bbc26f6c6c3e75a4492cfa74cebef70321e5a4ad4f1c2 languageName: node linkType: hard @@ -11266,9 +11247,9 @@ __metadata: linkType: hard "fast-uri@npm:^3.0.1": - version: 3.1.5 - resolution: "fast-uri@npm:3.1.5" - checksum: 10c0/2bf60eb800dd610c65e17be436425dcb21c92aff3a87d442a8bccab0b7b071e88cf1a5d7d1ea946370b937e6fc0375c405c0296c10587e57de4f78be4646d1d0 + version: 3.1.6 + resolution: "fast-uri@npm:3.1.6" + checksum: 10c0/77fa4f966f7d2cf83c34af2d3eb88882872fe90634f27a6bd309551db65377d3ca55616467c7cb4dcc57e33523d149e2fec1952d51cc2f00bfce68a66c3711ea languageName: node linkType: hard @@ -15539,7 +15520,7 @@ __metadata: "@dnd-kit/sortable": "npm:^7.0.2" "@dotenvx/dotenvx": "npm:^1.75.1" "@emoji-mart/data": "npm:^1.2.1" - "@faker-js/faker": "npm:^8.4.1" + "@faker-js/faker": "npm:^10.5.0" "@fast-csv/parse": "npm:^5.0.7" "@firecrawl/pdf-inspector": "npm:^1.11.2" "@fortawesome/fontawesome-svg-core": "npm:^7.3.1" @@ -21321,7 +21302,7 @@ __metadata: languageName: node linkType: hard -"ws@npm:^7.5.13": +"ws@npm:^7.5.13, ws@npm:^7.5.5": version: 7.5.13 resolution: "ws@npm:7.5.13" peerDependencies: @@ -21336,21 +21317,6 @@ __metadata: languageName: node linkType: hard -"ws@npm:^7.5.5": - version: 7.5.11 - resolution: "ws@npm:7.5.11" - peerDependencies: - bufferutil: ^4.0.1 - utf-8-validate: ^5.0.2 - peerDependenciesMeta: - bufferutil: - optional: true - utf-8-validate: - optional: true - checksum: 10c0/7972670b676fb1ccba73b0899ca3c2e04e8c2075629c2614cced7f556536f96a672bbf4619fc5a06c8b8720bb839a47ca88c69c95dc14c9c61a99fbecba1c866 - languageName: node - linkType: hard - "xcase@npm:^2.0.1": version: 2.0.1 resolution: "xcase@npm:2.0.1" From 33f2b9353087718722ed61808b633bcd9b122563 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Wed, 2 Sep 2026 19:20:53 -0400 Subject: [PATCH 050/181] fix: Escape MCP attachment PUT upload command arguments (#13613) Applies the same shell quoting introduced for the POST branch in #13597 to the presigned PUT branch, so user-supplied content type and filename values cannot break out of the suggested curl command's quoting. Claude-Session: https://claude.ai/code/session_011rde2HKVLJC4GWU4wHcrKz Co-authored-by: Claude --- server/tools/attachments.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/server/tools/attachments.ts b/server/tools/attachments.ts index 24e4325e71..aa36e62e26 100644 --- a/server/tools/attachments.ts +++ b/server/tools/attachments.ts @@ -113,10 +113,10 @@ export function attachmentTools(server: McpServer, scopes: string[]) { const curlCommand = `curl -X PUT ${Object.entries( presignedPut.headers ) - .map(([k, v]) => `-H '${k}: ${v}'`) - .join( - " " - )} --data-binary '@/path/to/file' '${presignedPut.url}'`; + .map(([k, v]) => `-H ${quoteShellArgument(`${k}: ${v}`)}`) + .join(" ")} --data-binary '@/path/to/file' ${quoteShellArgument( + presignedPut.url + )}`; return success({ mode: "put", From a4066aedd2cd253f8ac3f6bfd4d7d8a69e109b9a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 2 Sep 2026 19:21:14 -0400 Subject: [PATCH 051/181] chore(deps): bump fast-uri from 3.1.5 to 3.1.6 (#13623) Bumps [fast-uri](https://github.com/fastify/fast-uri) from 3.1.5 to 3.1.6. - [Release notes](https://github.com/fastify/fast-uri/releases) - [Commits](https://github.com/fastify/fast-uri/compare/v3.1.5...v3.1.6) --- updated-dependencies: - dependency-name: fast-uri dependency-version: 3.1.6 dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> From b123af7e2102a747c08bee0f51f57918d01d27b8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 2 Sep 2026 19:28:05 -0400 Subject: [PATCH 052/181] chore(deps): bump @xmldom/xmldom from 0.8.13 to 0.8.15 (#13624) Bumps [@xmldom/xmldom](https://github.com/xmldom/xmldom) from 0.8.13 to 0.8.15. - [Release notes](https://github.com/xmldom/xmldom/releases) - [Changelog](https://github.com/xmldom/xmldom/blob/master/CHANGELOG.md) - [Commits](https://github.com/xmldom/xmldom/compare/0.8.13...0.8.15) --- updated-dependencies: - dependency-name: "@xmldom/xmldom" dependency-version: 0.8.15 dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index f7fdbcb834..b5b84f3bc8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7809,9 +7809,9 @@ __metadata: linkType: hard "@xmldom/xmldom@npm:^0.8.6": - version: 0.8.13 - resolution: "@xmldom/xmldom@npm:0.8.13" - checksum: 10c0/06405ee6fffba631abf715a305ace338420ebcea8baf1317f19f2752f5c505952b7df45159908e7be8451a42faa54326b780616ab4d08242b20477b2973da24b + version: 0.8.15 + resolution: "@xmldom/xmldom@npm:0.8.15" + checksum: 10c0/59d09b85824b684fba5a0a224d5b43abea1a0d745e8d8b8136a7013e996eb6da122fdbb3deb32ed1621923a10e1937b1f7917cea43481d9d5b976e8c1ff836c1 languageName: node linkType: hard From bf831f365ec9ebaa6d78878c9a244d2c17d4af60 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 2 Sep 2026 19:28:22 -0400 Subject: [PATCH 053/181] chore(deps): bump qs from 6.15.3 to 6.16.0 (#13625) Bumps [qs](https://github.com/ljharb/qs) from 6.15.3 to 6.16.0. - [Changelog](https://github.com/ljharb/qs/blob/main/CHANGELOG.md) - [Commits](https://github.com/ljharb/qs/compare/v6.15.3...v6.16.0) --- updated-dependencies: - dependency-name: qs dependency-version: 6.16.0 dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index b5b84f3bc8..26688d1743 100644 --- a/yarn.lock +++ b/yarn.lock @@ -17159,12 +17159,12 @@ __metadata: linkType: hard "qs@npm:^6.11.0, qs@npm:^6.14.0, qs@npm:^6.15.2, qs@npm:^6.5.2": - version: 6.15.3 - resolution: "qs@npm:6.15.3" + version: 6.16.0 + resolution: "qs@npm:6.16.0" dependencies: es-define-property: "npm:^1.0.1" side-channel: "npm:^1.1.1" - checksum: 10c0/8f3f6e45ece255347d57696628401cde29e9ec649fff698b53bd3150dea7cefdf33036e1bc1826b9f110bfa7cb0ec4ab9f5297eca628ce216c55af82c304e08e + checksum: 10c0/eb3e31992fbd70e31a1791e571ed817d70975de7d3bfcbbbec93d77d1dd305877e9e8fdbcc62303c228ee5c3606685622cd6231c042dbc4790bb4e7c65fcbe18 languageName: node linkType: hard From 7483b23cb7259db848ced7227f50a5e2d614657d Mon Sep 17 00:00:00 2001 From: Translate-O-Tron <75237327+outline-translations@users.noreply.github.com> Date: Wed, 2 Sep 2026 20:17:27 -0400 Subject: [PATCH 054/181] New Crowdin updates (#13539) * fix: New Spanish translations * fix: New Catalan translations * fix: New Czech translations * fix: New Danish translations * fix: New German translations * fix: New Hebrew translations * fix: New Hungarian translations * fix: New Italian translations * fix: New Japanese translations * fix: New Korean translations * fix: New Dutch translations * fix: New Polish translations * fix: New Portuguese translations * fix: New Swedish translations * fix: New Turkish translations * fix: New Ukrainian translations * fix: New Chinese Simplified translations * fix: New Chinese Traditional translations * fix: New Vietnamese translations * fix: New Portuguese, Brazilian translations * fix: New Indonesian translations * fix: New Persian translations * fix: New Thai translations * fix: New English, United Kingdom translations * fix: New Norwegian Bokmal translations * fix: New French translations * fix: New Spanish translations * fix: New Catalan translations * fix: New Czech translations * fix: New Danish translations * fix: New German translations * fix: New Hebrew translations * fix: New Hungarian translations * fix: New Italian translations * fix: New Japanese translations * fix: New Korean translations * fix: New Dutch translations * fix: New Polish translations * fix: New Portuguese translations * fix: New Swedish translations * fix: New Turkish translations * fix: New Ukrainian translations * fix: New Vietnamese translations * fix: New Portuguese, Brazilian translations * fix: New Indonesian translations * fix: New Persian translations * fix: New Thai translations * fix: New Norwegian Bokmal translations * fix: New French translations * fix: New Spanish translations * fix: New Catalan translations * fix: New Czech translations * fix: New Danish translations * fix: New German translations * fix: New Hebrew translations * fix: New Hungarian translations * fix: New Italian translations * fix: New Japanese translations * fix: New Korean translations * fix: New Dutch translations * fix: New Polish translations * fix: New Portuguese translations * fix: New Swedish translations * fix: New Turkish translations * fix: New Ukrainian translations * fix: New Chinese Simplified translations * fix: New Chinese Traditional translations * fix: New Vietnamese translations * fix: New Portuguese, Brazilian translations * fix: New Indonesian translations * fix: New Persian translations * fix: New Thai translations * fix: New English, United Kingdom translations * fix: New Norwegian Bokmal translations * fix: New French translations * fix: New Swedish translations --- shared/i18n/locales/ca_ES/translation.json | 21 ++++--- shared/i18n/locales/cs_CZ/translation.json | 21 ++++--- shared/i18n/locales/da_DK/translation.json | 21 ++++--- shared/i18n/locales/de_DE/translation.json | 21 ++++--- shared/i18n/locales/en_GB/translation.json | 21 ++++--- shared/i18n/locales/es_ES/translation.json | 21 ++++--- shared/i18n/locales/fa_IR/translation.json | 21 ++++--- shared/i18n/locales/fr_FR/translation.json | 21 ++++--- shared/i18n/locales/he_IL/translation.json | 21 ++++--- shared/i18n/locales/hu_HU/translation.json | 21 ++++--- shared/i18n/locales/id_ID/translation.json | 21 ++++--- shared/i18n/locales/it_IT/translation.json | 21 ++++--- shared/i18n/locales/ja_JP/translation.json | 21 ++++--- shared/i18n/locales/ko_KR/translation.json | 21 ++++--- shared/i18n/locales/nb_NO/translation.json | 21 ++++--- shared/i18n/locales/nl_NL/translation.json | 21 ++++--- shared/i18n/locales/pl_PL/translation.json | 21 ++++--- shared/i18n/locales/pt_BR/translation.json | 21 ++++--- shared/i18n/locales/pt_PT/translation.json | 21 ++++--- shared/i18n/locales/sv_SE/translation.json | 65 ++++++++++++---------- shared/i18n/locales/th_TH/translation.json | 21 ++++--- shared/i18n/locales/tr_TR/translation.json | 21 ++++--- shared/i18n/locales/uk_UA/translation.json | 21 ++++--- shared/i18n/locales/vi_VN/translation.json | 21 ++++--- shared/i18n/locales/zh_CN/translation.json | 21 ++++--- shared/i18n/locales/zh_TW/translation.json | 21 ++++--- 26 files changed, 386 insertions(+), 204 deletions(-) diff --git a/shared/i18n/locales/ca_ES/translation.json b/shared/i18n/locales/ca_ES/translation.json index 2498cbd1c8..90db034031 100644 --- a/shared/i18n/locales/ca_ES/translation.json +++ b/shared/i18n/locales/ca_ES/translation.json @@ -744,6 +744,12 @@ "Warning notice": "Avís d'alerta", "Tip notice": "Avís de recomanació", "Wrap text": "Ajusta el text", + "Heading": "Capçalera", + "Subheading": "Subtítol", + "Merge cells": "Fusiona les cel·les", + "Split cell": "Divideix la cel·la", + "Outdent": "Redueix el sagnat", + "Indent": "Sagnat", "Placeholder": "Marcador de posició", "Bold": "Negreta", "Italic": "Cursiva", @@ -751,12 +757,6 @@ "Background color": "Color de fons", "Highlight": "Ressalta", "Code": "Codi", - "Heading": "Capçalera", - "Subheading": "Subtítol", - "Merge cells": "Fusiona les cel·les", - "Split cell": "Divideix la cel·la", - "Outdent": "Redueix el sagnat", - "Indent": "Sagnat", "Create link": "Crea un enllaç", "Comment": "Comentar", "Align left": "Alinea a l'esquerra", @@ -855,6 +855,13 @@ "No expiration": "Sense data de venciment", "The document archive is empty at the moment.": "L'arxiu de documents està buit en aquest moment", "Done editing": "Edició finalitzada", + "Only members with access can view": "Només els membres amb accés poden visualitzar-ho", + "All members in the workspace can view": "Tots els membres de l'espai de treball poden visualitzar-ho", + "Private": "Privat", + "Anyone with the link can view": "Qualsevol persona amb l'enllaç pot visualitzar-ho", + "Publicly shared": "Compartit públicament", + "{{ count }} document": "{{ count }} document", + "{{ count }} document_plural": "{{ count }} documents", "Drop documents to import": "Deixeu anar els documents a importar", "{{ collectionName }} doesn’t contain any\n documents yet.": "{{ collectionName }} no conté cap\n document encara.", "{{ usersCount }} users and {{ groupsCount }} groups with access": "{{ usersCount }} usuari i {{ groupsCount }} grups amb accés", @@ -1318,6 +1325,7 @@ "Synced <2>": "Sincronitzat <2>", "Date created": "Data de creació", "Crop Image": "Retalla la imatge", + "Your browser cannot read HEIC images, please convert it to JPEG or PNG first": "El vostre navegador no pot llegir imatges HEIC; convertiu-les primer a JPEG o PNG", "Crop image": "Retalla la imatge", "You can import a zip file that was previously exported from the JSON option in another instance. In {{ appName }}, open Export in the Settings sidebar and click on Export Data.": "Podeu importar un fitxer ZIP que s'ha exportat prèviament des de l'opció JSON en una altra instància. A {{ appName }}, obriu Exporta a la barra lateral de configuració i feu clic a Exporta les dades.", "Drag and drop the zip file from the JSON export option in {{appName}}, or click to upload": "Arrossegueu i deixeu anar el fitxer ZIP des de l'opció d'exportació JSON a {{appName}}, o feu clic per penjar", @@ -1592,7 +1600,6 @@ "IP": "IP", "a group": "un grup", "All users": "Tots els usuaris", - "Private": "Privat", "View and edit": "Visualitzar i editar", "Sharing enabled": "Compartició activada", "Date archived": "Data d'arxivat", diff --git a/shared/i18n/locales/cs_CZ/translation.json b/shared/i18n/locales/cs_CZ/translation.json index 0568bf2a9e..c7af2b44ee 100644 --- a/shared/i18n/locales/cs_CZ/translation.json +++ b/shared/i18n/locales/cs_CZ/translation.json @@ -744,6 +744,12 @@ "Warning notice": "Varování", "Tip notice": "Tip", "Wrap text": "Zalamovat text", + "Heading": "Nadpis", + "Subheading": "Podnadpis", + "Merge cells": "Sloučit buňky", + "Split cell": "Rozdělit buňku", + "Outdent": "Zmenšit odsazení", + "Indent": "Zvětšit odsazení", "Placeholder": "Zástupný text", "Bold": "Tučné", "Italic": "Kurzíva", @@ -751,12 +757,6 @@ "Background color": "Barva pozadí", "Highlight": "Zvýraznění", "Code": "Kód", - "Heading": "Nadpis", - "Subheading": "Podnadpis", - "Merge cells": "Sloučit buňky", - "Split cell": "Rozdělit buňku", - "Outdent": "Zmenšit odsazení", - "Indent": "Zvětšit odsazení", "Create link": "Vytvořit odkaz", "Comment": "Komentář", "Align left": "Zarovnat doleva", @@ -855,6 +855,13 @@ "No expiration": "Bez vypršení platnosti", "The document archive is empty at the moment.": "Archiv dokumentů je momentálně prázdný.", "Done editing": "Dokončit úpravy", + "Only members with access can view": "Zobrazit mohou pouze členové s přístupem.", + "All members in the workspace can view": "Zobrazit mohou všichni členové pracovního prostoru.", + "Private": "Soukromé", + "Anyone with the link can view": "Kdokoli s odkazem může zobrazit.", + "Publicly shared": "Veřejně sdíleno", + "{{ count }} document": "{{ count }} dokument", + "{{ count }} document_plural": "{{ count }} dokumentů", "Drop documents to import": "Přetáhněte dokumenty k importu", "{{ collectionName }} doesn’t contain any\n documents yet.": "V kolekci {{ collectionName }} zatím nejsou žádné dokumenty.", "{{ usersCount }} users and {{ groupsCount }} groups with access": "Počet uživatelů a skupin s přístupem: {{ usersCount }} uživatelů a {{ groupsCount }} skupin", @@ -1318,6 +1325,7 @@ "Synced <2>": "Synchronizováno <2>", "Date created": "Datum vytvoření", "Crop Image": "Oříznout obrázek", + "Your browser cannot read HEIC images, please convert it to JPEG or PNG first": "Váš prohlížeč neumí načíst obrázky HEIC, nejprve je převeďte do formátu JPEG nebo PNG", "Crop image": "Oříznout obrázek", "You can import a zip file that was previously exported from the JSON option in another instance. In {{ appName }}, open Export in the Settings sidebar and click on Export Data.": "Můžete importovat ZIP soubor dříve vyexportovaný jako JSON z jiné instance. V aplikaci {{ appName }} otevřete Export v nastavení a klikněte na Exportovat data.", "Drag and drop the zip file from the JSON export option in {{appName}}, or click to upload": "Přetáhněte ZIP soubor z exportu JSON aplikace {{appName}}, nebo jej nahrajte kliknutím.", @@ -1592,7 +1600,6 @@ "IP": "IP adresa", "a group": "skupinu", "All users": "Všichni uživatelé", - "Private": "Soukromé", "View and edit": "Prohlížení a úpravy", "Sharing enabled": "Sdílení povoleno", "Date archived": "Datum archivace", diff --git a/shared/i18n/locales/da_DK/translation.json b/shared/i18n/locales/da_DK/translation.json index 5d1a542404..d1c9c05b4a 100644 --- a/shared/i18n/locales/da_DK/translation.json +++ b/shared/i18n/locales/da_DK/translation.json @@ -744,6 +744,12 @@ "Warning notice": "Advarselsmeddelelse", "Tip notice": "Tipmeddelelse", "Wrap text": "Ombryd tekst", + "Heading": "Overskrift", + "Subheading": "Underoverskrift", + "Merge cells": "Flet celler", + "Split cell": "Opdel celle", + "Outdent": "Ryk ud", + "Indent": "Indryk", "Placeholder": "Pladsholder", "Bold": "Fed", "Italic": "Kursiv", @@ -751,12 +757,6 @@ "Background color": "Baggrundsfarve", "Highlight": "Fremhæv", "Code": "Kode", - "Heading": "Overskrift", - "Subheading": "Underoverskrift", - "Merge cells": "Flet celler", - "Split cell": "Opdel celle", - "Outdent": "Ryk ud", - "Indent": "Indryk", "Create link": "Opret link", "Comment": "Kommentar", "Align left": "Venstrejustér", @@ -855,6 +855,13 @@ "No expiration": "Intet udløb", "The document archive is empty at the moment.": "Dokumentarkivet er tomt i øjeblikket.", "Done editing": "Færdig med at redigere", + "Only members with access can view": "Kun medlemmer med adgang kan se", + "All members in the workspace can view": "Alle medlemmer i arbejdsområdet kan se", + "Private": "Privat", + "Anyone with the link can view": "Alle med linket kan se", + "Publicly shared": "Delt offentligt", + "{{ count }} document": "{{ count }} document", + "{{ count }} document_plural": "{{ count }} documents", "Drop documents to import": "Slip dokumenter for at importere", "{{ collectionName }} doesn’t contain any\n documents yet.": "{{ collectionName }} indeholder endnu ingen\n dokumenter.", "{{ usersCount }} users and {{ groupsCount }} groups with access": "{{ usersCount }} bruger og {{ groupsCount }} grupper med adgang", @@ -1318,6 +1325,7 @@ "Synced <2>": "Synkroniseret <2>", "Date created": "Oprettelsesdato", "Crop Image": "Beskær billede", + "Your browser cannot read HEIC images, please convert it to JPEG or PNG first": "Din browser kan ikke læse HEIC-billeder. Konvertér dem venligst først til JPEG eller PNG.", "Crop image": "Beskær billede", "You can import a zip file that was previously exported from the JSON option in another instance. In {{ appName }}, open Export in the Settings sidebar and click on Export Data.": "Du kan importere en zip-fil, der tidligere er eksporteret fra JSON-indstillingen i en anden instans. I {{ appName }} skal du åbne Eksport i indstillingssidepanelet og klikke på Eksportér data.", "Drag and drop the zip file from the JSON export option in {{appName}}, or click to upload": "Træk og slip zip-filen fra JSON-eksportindstillingen i {{appName}}, eller klik for at uploade", @@ -1592,7 +1600,6 @@ "IP": "IP", "a group": "en gruppe", "All users": "Alle brugere", - "Private": "Privat", "View and edit": "Se og redigér", "Sharing enabled": "Deling aktiveret", "Date archived": "Dato arkiveret", diff --git a/shared/i18n/locales/de_DE/translation.json b/shared/i18n/locales/de_DE/translation.json index d24f40d560..98caf0a473 100644 --- a/shared/i18n/locales/de_DE/translation.json +++ b/shared/i18n/locales/de_DE/translation.json @@ -744,6 +744,12 @@ "Warning notice": "Warnhinweis", "Tip notice": "Tipp Hinweis", "Wrap text": "Mit Text umschließen", + "Heading": "Überschrift", + "Subheading": "Untertitel", + "Merge cells": "Zellen zusammenführen", + "Split cell": "Zelle aufteilen", + "Outdent": "Ausrückung", + "Indent": "Einrückung", "Placeholder": "Platzhalter", "Bold": "Fett", "Italic": "Kursiv", @@ -751,12 +757,6 @@ "Background color": "Hintergrundfarbe", "Highlight": "Hervorheben", "Code": "Code", - "Heading": "Überschrift", - "Subheading": "Untertitel", - "Merge cells": "Zellen zusammenführen", - "Split cell": "Zelle aufteilen", - "Outdent": "Ausrückung", - "Indent": "Einrückung", "Create link": "Link erstellen", "Comment": "Kommentieren", "Align left": "Links ausrichten", @@ -855,6 +855,13 @@ "No expiration": "Ohne Ablaufdatum", "The document archive is empty at the moment.": "Das Dokumentenarchiv ist momentan leer.", "Done editing": "Bearbeitung abschließen", + "Only members with access can view": "Nur Mitglieder mit Zugriff können es ansehen.", + "All members in the workspace can view": "Alle Mitglieder im Arbeitsbereich können es ansehen.", + "Private": "Privat", + "Anyone with the link can view": "Jeder mit dem Link kann es ansehen.", + "Publicly shared": "Öffentlich geteilt", + "{{ count }} document": "{{ count }} Dokument", + "{{ count }} document_plural": "{{ count }} Dokumente", "Drop documents to import": "Dokumente zum Importieren hier ablegen", "{{ collectionName }} doesn’t contain any\n documents yet.": "{{ collectionName }} enthält noch keine\n Dokumente.", "{{ usersCount }} users and {{ groupsCount }} groups with access": "{{ usersCount }} Benutzer und {{ groupsCount }} Gruppen mit Zugriff", @@ -1318,6 +1325,7 @@ "Synced <2>": "Synchronisiert <2>", "Date created": "Erstellungsdatum", "Crop Image": "Bild zuschneiden", + "Your browser cannot read HEIC images, please convert it to JPEG or PNG first": "Ihr Browser kann HEIC-Bilder nicht lesen. Bitte konvertieren Sie sie zuerst in JPEG oder PNG.", "Crop image": "Bild zuschneiden", "You can import a zip file that was previously exported from the JSON option in another instance. In {{ appName }}, open Export in the Settings sidebar and click on Export Data.": "Du kannst eine ZIP-Datei importieren, die zuvor mithilfe der JSON-Export Funktion exportiert wurde. Öffne dazu in {{ appName }} Exportieren in der Seitenleiste Einstellungen und klicke auf Daten exportieren.", "Drag and drop the zip file from the JSON export option in {{appName}}, or click to upload": "Drag-and-Drop die Zip-Datei von JSON-Export Funktion in {{appName}}, oder klicke auf Upload", @@ -1592,7 +1600,6 @@ "IP": "IP", "a group": "eine Gruppe", "All users": "Alle Nutzer", - "Private": "Privat", "View and edit": "Anzeigen und bearbeiten", "Sharing enabled": "Freigabe aktiviert", "Date archived": "Archivierungsdatum", diff --git a/shared/i18n/locales/en_GB/translation.json b/shared/i18n/locales/en_GB/translation.json index cdae86cbcd..4dd12e789f 100644 --- a/shared/i18n/locales/en_GB/translation.json +++ b/shared/i18n/locales/en_GB/translation.json @@ -744,6 +744,12 @@ "Warning notice": "Warning notice", "Tip notice": "Tip notice", "Wrap text": "Wrap text", + "Heading": "Heading", + "Subheading": "Subheading", + "Merge cells": "Merge cells", + "Split cell": "Split cell", + "Outdent": "Outdent", + "Indent": "Indent", "Placeholder": "Placeholder", "Bold": "Bold", "Italic": "Italic", @@ -751,12 +757,6 @@ "Background color": "Background color", "Highlight": "Highlight", "Code": "Code", - "Heading": "Heading", - "Subheading": "Subheading", - "Merge cells": "Merge cells", - "Split cell": "Split cell", - "Outdent": "Outdent", - "Indent": "Indent", "Create link": "Create link", "Comment": "Comment", "Align left": "Align left", @@ -855,6 +855,13 @@ "No expiration": "No expiration", "The document archive is empty at the moment.": "The document archive is empty at the moment.", "Done editing": "Done editing", + "Only members with access can view": "Only members with access can view", + "All members in the workspace can view": "All members in the workspace can view", + "Private": "Private", + "Anyone with the link can view": "Anyone with the link can view", + "Publicly shared": "Publicly shared", + "{{ count }} document": "{{ count }} document", + "{{ count }} document_plural": "{{ count }} documents", "Drop documents to import": "Drop documents to import", "{{ collectionName }} doesn’t contain any\n documents yet.": "{{ collectionName }} doesn’t contain any\n documents yet.", "{{ usersCount }} users and {{ groupsCount }} groups with access": "{{ usersCount }} user and {{ groupsCount }} groups with access", @@ -1318,6 +1325,7 @@ "Synced <2>": "Synced <2>", "Date created": "Date created", "Crop Image": "Crop Image", + "Your browser cannot read HEIC images, please convert it to JPEG or PNG first": "Your browser cannot read HEIC images. Please convert them to JPEG or PNG first.", "Crop image": "Crop image", "You can import a zip file that was previously exported from the JSON option in another instance. In {{ appName }}, open Export in the Settings sidebar and click on Export Data.": "You can import a zip file that was previously exported from the JSON option in another instance. In {{ appName }}, open Export in the Settings sidebar and click on Export Data.", "Drag and drop the zip file from the JSON export option in {{appName}}, or click to upload": "Drag and drop the zip file from the JSON export option in {{appName}}, or click to upload", @@ -1592,7 +1600,6 @@ "IP": "IP", "a group": "a group", "All users": "All users", - "Private": "Private", "View and edit": "View and edit", "Sharing enabled": "Sharing enabled", "Date archived": "Date archived", diff --git a/shared/i18n/locales/es_ES/translation.json b/shared/i18n/locales/es_ES/translation.json index 879d485032..b0da4f5441 100644 --- a/shared/i18n/locales/es_ES/translation.json +++ b/shared/i18n/locales/es_ES/translation.json @@ -744,6 +744,12 @@ "Warning notice": "Aviso de advertencia", "Tip notice": "Aviso de sugerencia", "Wrap text": "Ajustar texto", + "Heading": "Encabezado", + "Subheading": "Sub-encabezado", + "Merge cells": "Combinar celdas", + "Split cell": "Dividir la celda", + "Outdent": "Reducir sangría", + "Indent": "Aumentar sangría", "Placeholder": "Marcador", "Bold": "Negrita", "Italic": "Cursiva", @@ -751,12 +757,6 @@ "Background color": "Color de fondo", "Highlight": "Resaltar", "Code": "Código", - "Heading": "Encabezado", - "Subheading": "Sub-encabezado", - "Merge cells": "Combinar celdas", - "Split cell": "Dividir la celda", - "Outdent": "Reducir sangría", - "Indent": "Aumentar sangría", "Create link": "Nuevo enlace", "Comment": "Comentar", "Align left": "Alinear a la izquierda", @@ -855,6 +855,13 @@ "No expiration": "Sin expiración", "The document archive is empty at the moment.": "El archivo está vacío en este momento.", "Done editing": "Edición finalizada", + "Only members with access can view": "Solo los miembros con acceso pueden ver", + "All members in the workspace can view": "Todos los miembros del espacio de trabajo pueden ver", + "Private": "Privado", + "Anyone with the link can view": "Cualquier persona con el enlace puede ver", + "Publicly shared": "Compartido públicamente", + "{{ count }} document": "{{ count }} document", + "{{ count }} document_plural": "{{ count }} documents", "Drop documents to import": "Arrastra los documentos para importar", "{{ collectionName }} doesn’t contain any\n documents yet.": "{{ collectionName }} no contiene documentos aún.", "{{ usersCount }} users and {{ groupsCount }} groups with access": "{{ usersCount }} usuario y {{ groupsCount }} grupos con acceso", @@ -1318,6 +1325,7 @@ "Synced <2>": "Sincronizado <2>", "Date created": "Fecha de creación", "Crop Image": "Recortar imagen", + "Your browser cannot read HEIC images, please convert it to JPEG or PNG first": "Tu navegador no puede leer imágenes HEIC; conviértelas primero a JPEG o PNG.", "Crop image": "Recortar imagen", "You can import a zip file that was previously exported from the JSON option in another instance. In {{ appName }}, open Export in the Settings sidebar and click on Export Data.": "Puedes importar un archivo zip que se exportó previamente desde la opción JSON en otra instancia. En {{ appName }}, abre Exportar en la barra lateral de configuración y haz clic en Exportar datos.", "Drag and drop the zip file from the JSON export option in {{appName}}, or click to upload": "Arrastra y suelta el archivo zip de la opción de exportación JSON de {{appName}}, o haz clic para cargarlo", @@ -1592,7 +1600,6 @@ "IP": "IP", "a group": "un grupo", "All users": "Todos los usuarios", - "Private": "Privado", "View and edit": "Ver y editar", "Sharing enabled": "Habilitar compartir", "Date archived": "Fecha archivado", diff --git a/shared/i18n/locales/fa_IR/translation.json b/shared/i18n/locales/fa_IR/translation.json index 4af6f2c15a..85d917afd6 100644 --- a/shared/i18n/locales/fa_IR/translation.json +++ b/shared/i18n/locales/fa_IR/translation.json @@ -744,6 +744,12 @@ "Warning notice": "بلوک هشدار", "Tip notice": "بلوک نکته", "Wrap text": "Wrap text", + "Heading": "عنوان", + "Subheading": "زیرعنوان", + "Merge cells": "ادغام سلول‌ها", + "Split cell": "تقسیم سلول", + "Outdent": "کاهش تورفتگی", + "Indent": "افزایش تورفتگی", "Placeholder": "محل نگهدارنده", "Bold": "پررنگ", "Italic": "مورب", @@ -751,12 +757,6 @@ "Background color": "Background color", "Highlight": "هایلایت", "Code": "کد", - "Heading": "عنوان", - "Subheading": "زیرعنوان", - "Merge cells": "ادغام سلول‌ها", - "Split cell": "تقسیم سلول", - "Outdent": "کاهش تورفتگی", - "Indent": "افزایش تورفتگی", "Create link": "ایجاد لینک", "Comment": "نظر", "Align left": "چپ‌چین", @@ -855,6 +855,13 @@ "No expiration": "بدون انقضا", "The document archive is empty at the moment.": "آرشیو اسناد در حال حاضر خالی است.", "Done editing": "اتمام ویرایش", + "Only members with access can view": "فقط اعضای دارای دسترسی می‌توانند مشاهده کنند.", + "All members in the workspace can view": "همه اعضای فضای کاری می‌توانند مشاهده کنند.", + "Private": "خصوصی", + "Anyone with the link can view": "هر کسی که پیوند را دارد می‌تواند مشاهده کند.", + "Publicly shared": "به‌صورت عمومی به اشتراک گذاشته شده", + "{{ count }} document": "{{ count }} سند", + "{{ count }} document_plural": "{{ count }} سند", "Drop documents to import": "اسناد را بکشید تا وارد شوند", "{{ collectionName }} doesn’t contain any\n documents yet.": "{{ collectionName }} هنوز هیچ سندی ندارد.", "{{ usersCount }} users and {{ groupsCount }} groups with access": "{{ usersCount }} کاربر و {{ groupsCount }} گروه دارای دسترسی هستند", @@ -1318,6 +1325,7 @@ "Synced <2>": "Synced <2>", "Date created": "تاریخ ایجاد", "Crop Image": "برش تصویر", + "Your browser cannot read HEIC images, please convert it to JPEG or PNG first": "مرورگر شما نمی‌تواند تصاویر HEIC را بخواند؛ لطفاً ابتدا آن‌ها را به JPEG یا PNG تبدیل کنید.", "Crop image": "برش تصویر", "You can import a zip file that was previously exported from the JSON option in another instance. In {{ appName }}, open Export in the Settings sidebar and click on Export Data.": "شما می‌توانید یک فایل zip را که قبلاً از گزینه JSON در یک نمونه دیگر خروجی شده است وارد کنید. در {{ appName }}, Export را در نوار کناری تنظیمات باز کنید و روی Export Data کلیک کنید.", "Drag and drop the zip file from the JSON export option in {{appName}}, or click to upload": "فایل zip را از گزینه خروجی ها JSON در {{appName}} بکشید و رها کنید یا برای بارگذاری کلیک کنید", @@ -1592,7 +1600,6 @@ "IP": "IP", "a group": "یک گروه", "All users": "تمام کاربران", - "Private": "خصوصی", "View and edit": "مشاهده و ویرایش", "Sharing enabled": "اشتراک گذاری فعال است", "Date archived": "تاریخ بایگانی شده", diff --git a/shared/i18n/locales/fr_FR/translation.json b/shared/i18n/locales/fr_FR/translation.json index 0f8e591fa6..53157a9c75 100644 --- a/shared/i18n/locales/fr_FR/translation.json +++ b/shared/i18n/locales/fr_FR/translation.json @@ -744,6 +744,12 @@ "Warning notice": "Avertissement", "Tip notice": "Astuce", "Wrap text": "Retour à la ligne", + "Heading": "Titre", + "Subheading": "Sous-titre", + "Merge cells": "Fusionner les cellules", + "Split cell": "Diviser la cellule", + "Outdent": "Désindenter", + "Indent": "Indenter", "Placeholder": "Indication", "Bold": "Gras", "Italic": "Italique", @@ -751,12 +757,6 @@ "Background color": "Couleur d'arrière-plan", "Highlight": "Surligné", "Code": "Code", - "Heading": "Titre", - "Subheading": "Sous-titre", - "Merge cells": "Fusionner les cellules", - "Split cell": "Diviser la cellule", - "Outdent": "Désindenter", - "Indent": "Indenter", "Create link": "Créer un lien", "Comment": "Commenter", "Align left": "Aligner à gauche", @@ -855,6 +855,13 @@ "No expiration": "Pas d'expiration", "The document archive is empty at the moment.": "Les archives sont vides pour le moment.", "Done editing": "Édition terminée", + "Only members with access can view": "Seuls les membres disposant d’un accès peuvent consulter", + "All members in the workspace can view": "Tous les membres de l’espace de travail peuvent consulter", + "Private": "Privé", + "Anyone with the link can view": "Toute personne disposant du lien peut consulter", + "Publicly shared": "Partagé publiquement", + "{{ count }} document": "{{ count }} document", + "{{ count }} document_plural": "{{ count }} documents", "Drop documents to import": "Déposer les documents à importer", "{{ collectionName }} doesn’t contain any\n documents yet.": "{{ collectionName }} ne contient aucun document.", "{{ usersCount }} users and {{ groupsCount }} groups with access": "{{ usersCount }} utilisateur et {{ groupsCount }} groupes ont accès", @@ -1318,6 +1325,7 @@ "Synced <2>": "Synchronisé <2>", "Date created": "Créé le", "Crop Image": "Rogner l'image", + "Your browser cannot read HEIC images, please convert it to JPEG or PNG first": "Votre navigateur ne peut pas lire les images HEIC, veuillez d’abord les convertir en JPEG ou PNG", "Crop image": "Rogner l’image", "You can import a zip file that was previously exported from the JSON option in another instance. In {{ appName }}, open Export in the Settings sidebar and click on Export Data.": "Vous pouvez importer un fichier zip provenant de l'export JSON d'une autre installation Outline. Dans {{ appName }}, ouvrez Exporter dans les paramètres et cliquez sur Exporter les données.", "Drag and drop the zip file from the JSON export option in {{appName}}, or click to upload": "Glissez et déposez le fichier zip provenant d'un export JSON de {{appName}}, ou cliquez pour le téléverser", @@ -1592,7 +1600,6 @@ "IP": "IP", "a group": "un groupe", "All users": "Tous les utilisateurs", - "Private": "Privé", "View and edit": "Voir et éditer", "Sharing enabled": "Partage activé", "Date archived": "Date d'archivage", diff --git a/shared/i18n/locales/he_IL/translation.json b/shared/i18n/locales/he_IL/translation.json index b1713d2c0a..9ad545de19 100644 --- a/shared/i18n/locales/he_IL/translation.json +++ b/shared/i18n/locales/he_IL/translation.json @@ -744,6 +744,12 @@ "Warning notice": "הערת אזהרה", "Tip notice": "הודעת טיפ", "Wrap text": "גלישת טקסט", + "Heading": "כּוֹתֶרֶת", + "Subheading": "כּוֹתֶרֶת מִשְׁנֶה", + "Merge cells": "מיזוג תאים", + "Split cell": "פיצול תא", + "Outdent": "Outdent", + "Indent": "לְשַׁנֵן", "Placeholder": "מציין מקום", "Bold": "נוֹעָז", "Italic": "נטוי", @@ -751,12 +757,6 @@ "Background color": "צבע רקע", "Highlight": "שִׂיא", "Code": "קוד", - "Heading": "כּוֹתֶרֶת", - "Subheading": "כּוֹתֶרֶת מִשְׁנֶה", - "Merge cells": "מיזוג תאים", - "Split cell": "פיצול תא", - "Outdent": "Outdent", - "Indent": "לְשַׁנֵן", "Create link": "צור קישור", "Comment": "הֶעָרָה", "Align left": "יישר שמאלה", @@ -855,6 +855,13 @@ "No expiration": "אין תפוגה", "The document archive is empty at the moment.": "ארכיון המסמכים ריק כרגע.", "Done editing": "סיים לערוך", + "Only members with access can view": "רק חברים בעלי גישה יכולים לצפות", + "All members in the workspace can view": "כל החברים בסביבת העבודה יכולים לצפות", + "Private": "פְּרָטִי", + "Anyone with the link can view": "כל מי שיש לו את הקישור יכול לצפות", + "Publicly shared": "שותף באופן ציבורי", + "{{ count }} document": "{{ count }} מסמך", + "{{ count }} document_plural": "{{ count }} מסמכים", "Drop documents to import": "שחרר מסמכים לייבוא", "{{ collectionName }} doesn’t contain any\n documents yet.": "{{ collectionName }} אינו מכיל\n מסמכים עדיין.", "{{ usersCount }} users and {{ groupsCount }} groups with access": "{{ usersCount }} משתמשים וקבוצות {{ groupsCount }} עם גישה", @@ -1318,6 +1325,7 @@ "Synced <2>": "מסונכרן <2>", "Date created": "תאריך יצירה", "Crop Image": "חתוך תמונה", + "Your browser cannot read HEIC images, please convert it to JPEG or PNG first": "הדפדפן שלך אינו יכול לקרוא תמונות HEIC, נא להמיר אותן תחילה ל-JPEG או PNG", "Crop image": "חתוך תמונה", "You can import a zip file that was previously exported from the JSON option in another instance. In {{ appName }}, open Export in the Settings sidebar and click on Export Data.": "אתה יכול לייבא קובץ zip שיוצא בעבר מאפשרות JSON במופע אחר. ב-{{ appName }}, פתח את יצוא בסרגל הצד של ההגדרות ולחץ על ייצא נתונים.", "Drag and drop the zip file from the JSON export option in {{appName}}, or click to upload": "גרור ושחרר את קובץ ה-zip מאפשרות הייצוא של JSON ב-{{appName}}, או לחץ כדי להעלות", @@ -1592,7 +1600,6 @@ "IP": "IP", "a group": "קבוצה", "All users": "כל המשתמשים", - "Private": "פְּרָטִי", "View and edit": "הצג וערוך", "Sharing enabled": "השיתוף מופעל", "Date archived": "תאריך הועבר לארכיון", diff --git a/shared/i18n/locales/hu_HU/translation.json b/shared/i18n/locales/hu_HU/translation.json index a2f20ca0ab..6f71c7bc2e 100644 --- a/shared/i18n/locales/hu_HU/translation.json +++ b/shared/i18n/locales/hu_HU/translation.json @@ -744,6 +744,12 @@ "Warning notice": "Figyelmeztető értesítés", "Tip notice": "Tipp értesítés", "Wrap text": "Wrap text", + "Heading": "Címsor", + "Subheading": "Alcímsor", + "Merge cells": "Merge cells", + "Split cell": "Split cell", + "Outdent": "Behúzás csökkentése", + "Indent": "Behúzás növelése", "Placeholder": "Helykitöltő", "Bold": "Félkövér", "Italic": "Dőlt", @@ -751,12 +757,6 @@ "Background color": "Background color", "Highlight": "Kiemelés", "Code": "Kód", - "Heading": "Címsor", - "Subheading": "Alcímsor", - "Merge cells": "Merge cells", - "Split cell": "Split cell", - "Outdent": "Behúzás csökkentése", - "Indent": "Behúzás növelése", "Create link": "Hivatkozás létrehozása", "Comment": "Hozzászólás", "Align left": "Balra igazítás", @@ -855,6 +855,13 @@ "No expiration": "Nincs lejárat", "The document archive is empty at the moment.": "A dokumentum archívum jelenleg üres.", "Done editing": "Változtatások mentése", + "Only members with access can view": "Csak hozzáféréssel rendelkező tagok tekinthetik meg", + "All members in the workspace can view": "A munkaterület minden tagja megtekintheti", + "Private": "Privát", + "Anyone with the link can view": "A hivatkozással bárki megtekintheti", + "Publicly shared": "Nyilvánosan megosztva", + "{{ count }} document": "{{ count }} dokumentum", + "{{ count }} document_plural": "{{ count }} dokumentum", "Drop documents to import": "Engedje el itt a dokumentumot az importáláshoz", "{{ collectionName }} doesn’t contain any\n documents yet.": "{{ collectionName }} nem tartalmaz egyetlen\n dokumentumot sem.", "{{ usersCount }} users and {{ groupsCount }} groups with access": "{{ usersCount }} felhasználó és {{ groupsCount }} csoport rendelkezik hozzáféréssel", @@ -1318,6 +1325,7 @@ "Synced <2>": "Synced <2>", "Date created": "Létrehozás dátuma", "Crop Image": "Crop Image", + "Your browser cannot read HEIC images, please convert it to JPEG or PNG first": "A böngészője nem tudja beolvasni a HEIC-képeket, először alakítsa át őket JPEG- vagy PNG-formátumba.", "Crop image": "Crop image", "You can import a zip file that was previously exported from the JSON option in another instance. In {{ appName }}, open Export in the Settings sidebar and click on Export Data.": "You can import a zip file that was previously exported from the JSON option in another instance. In {{ appName }}, open Export in the Settings sidebar and click on Export Data.", "Drag and drop the zip file from the JSON export option in {{appName}}, or click to upload": "Drag and drop the zip file from the JSON export option in {{appName}}, or click to upload", @@ -1592,7 +1600,6 @@ "IP": "IP", "a group": "a group", "All users": "All users", - "Private": "Privát", "View and edit": "Megtekintés és szerkesztés", "Sharing enabled": "Sharing enabled", "Date archived": "Date archived", diff --git a/shared/i18n/locales/id_ID/translation.json b/shared/i18n/locales/id_ID/translation.json index 928a1f4fcf..6d0961d1a7 100644 --- a/shared/i18n/locales/id_ID/translation.json +++ b/shared/i18n/locales/id_ID/translation.json @@ -744,6 +744,12 @@ "Warning notice": "Pemberitahuan peringatan", "Tip notice": "Pemberitahuan tip", "Wrap text": "Wrap text", + "Heading": "Judul", + "Subheading": "Subjudul", + "Merge cells": "Merge cells", + "Split cell": "Split cell", + "Outdent": "Outdent", + "Indent": "Indentasi", "Placeholder": "Placeholder", "Bold": "Tebal", "Italic": "Miring", @@ -751,12 +757,6 @@ "Background color": "Background color", "Highlight": "Sorot", "Code": "Kode", - "Heading": "Judul", - "Subheading": "Subjudul", - "Merge cells": "Merge cells", - "Split cell": "Split cell", - "Outdent": "Outdent", - "Indent": "Indentasi", "Create link": "Buat tautan", "Comment": "Komentari", "Align left": "Rata kiri", @@ -855,6 +855,13 @@ "No expiration": "No expiration", "The document archive is empty at the moment.": "Arsip dokumen kosong saat ini.", "Done editing": "Selesai menyunting", + "Only members with access can view": "Hanya anggota dengan akses yang dapat melihat", + "All members in the workspace can view": "Semua anggota di ruang kerja dapat melihat", + "Private": "Privat", + "Anyone with the link can view": "Siapa pun yang memiliki tautan dapat melihat", + "Publicly shared": "Dibagikan secara publik", + "{{ count }} document": "{{ count }} dokumen", + "{{ count }} document_plural": "{{ count }} dokumen", "Drop documents to import": "Dokumen untuk diimpor dengan drop", "{{ collectionName }} doesn’t contain any\n documents yet.": "{{ collectionName }} belum berisi\n dokumen.", "{{ usersCount }} users and {{ groupsCount }} groups with access": "{{ usersCount }} pengguna dan {{ groupsCount }} grup dengan akses", @@ -1318,6 +1325,7 @@ "Synced <2>": "Synced <2>", "Date created": "Date created", "Crop Image": "Crop Image", + "Your browser cannot read HEIC images, please convert it to JPEG or PNG first": "Browser Anda tidak dapat membaca gambar HEIC, harap ubah terlebih dahulu ke JPEG atau PNG", "Crop image": "Crop image", "You can import a zip file that was previously exported from the JSON option in another instance. In {{ appName }}, open Export in the Settings sidebar and click on Export Data.": "Anda dapat mengimpor file zip yang sebelumnya diekspor dari opsi JSON di contoh lain. Di {{ appName }}, buka Ekspor di sidebar Pengaturan dan klik Ekspor Data.", "Drag and drop the zip file from the JSON export option in {{appName}}, or click to upload": "Drag and drop file zip dari opsi ekspor JSON di {{appName}}, atau klik untuk mengunggah", @@ -1592,7 +1600,6 @@ "IP": "IP", "a group": "a group", "All users": "All users", - "Private": "Privat", "View and edit": "Lihat dan sunting", "Sharing enabled": "Sharing enabled", "Date archived": "Date archived", diff --git a/shared/i18n/locales/it_IT/translation.json b/shared/i18n/locales/it_IT/translation.json index d22332813b..40fdb063de 100644 --- a/shared/i18n/locales/it_IT/translation.json +++ b/shared/i18n/locales/it_IT/translation.json @@ -744,6 +744,12 @@ "Warning notice": "Nota di avviso", "Tip notice": "Nota di suggerimento", "Wrap text": "Testo a capo", + "Heading": "Titolo", + "Subheading": "Sottotitolo", + "Merge cells": "Unisci celle", + "Split cell": "Dividi cella", + "Outdent": "Riduci rientro", + "Indent": "Rientro", "Placeholder": "Segnaposto", "Bold": "Grassetto", "Italic": "Corsivo", @@ -751,12 +757,6 @@ "Background color": "Colore di sfondo", "Highlight": "In evidenza", "Code": "Codice", - "Heading": "Titolo", - "Subheading": "Sottotitolo", - "Merge cells": "Unisci celle", - "Split cell": "Dividi cella", - "Outdent": "Riduci rientro", - "Indent": "Rientro", "Create link": "Crea collegamento", "Comment": "Commenta", "Align left": "Allinea a sinistra", @@ -855,6 +855,13 @@ "No expiration": "Nessuna scadenza", "The document archive is empty at the moment.": "L'archivio documenti è vuoto al momento.", "Done editing": "Modifica Completata", + "Only members with access can view": "Solo i membri autorizzati possono visualizzare il contenuto.", + "All members in the workspace can view": "Tutti i membri dello spazio di lavoro possono visualizzare", + "Private": "Privato", + "Anyone with the link can view": "Chiunque abbia il link può visualizzare", + "Publicly shared": "Condiviso pubblicamente", + "{{ count }} document": "{{ count }} documento", + "{{ count }} document_plural": "{{ count }} documenti", "Drop documents to import": "Trascina qui i documenti oppure", "{{ collectionName }} doesn’t contain any\n documents yet.": "{{ collectionName }} non contiene ancora\n documenti.", "{{ usersCount }} users and {{ groupsCount }} groups with access": "{{ usersCount }} utente e {{ groupsCount }} gruppi con accesso", @@ -1318,6 +1325,7 @@ "Synced <2>": "Sincronizzato <2>", "Date created": "Data creazione", "Crop Image": "Ritaglia immagine", + "Your browser cannot read HEIC images, please convert it to JPEG or PNG first": "Il tuo browser non è in grado di leggere le immagini HEIC. Convertile prima in JPEG o PNG.", "Crop image": "Ritaglia immagine", "You can import a zip file that was previously exported from the JSON option in another instance. In {{ appName }}, open Export in the Settings sidebar and click on Export Data.": "È possibile importare un file zip precedentemente esportato con l'opzione JSON in un'altra istanza. Su {{ appName }} apri Esporta nella barra laterale delle impostazioni e fai clic su Esporta dati.", "Drag and drop the zip file from the JSON export option in {{appName}}, or click to upload": "Trascina e rilascia il file zip dall'export JSON in {{appName}} o fai clic per caricarlo", @@ -1592,7 +1600,6 @@ "IP": "IP", "a group": "un gruppo", "All users": "Tutti gli utenti", - "Private": "Privato", "View and edit": "Visualizza e modifica", "Sharing enabled": "Condivisione abilitata", "Date archived": "Data di archiviazione", diff --git a/shared/i18n/locales/ja_JP/translation.json b/shared/i18n/locales/ja_JP/translation.json index 176034abd2..69bcb61e06 100644 --- a/shared/i18n/locales/ja_JP/translation.json +++ b/shared/i18n/locales/ja_JP/translation.json @@ -744,6 +744,12 @@ "Warning notice": "アラート - WARNING", "Tip notice": "アラート - TIP", "Wrap text": "テキストを折り返す", + "Heading": "見出し", + "Subheading": "小見出し", + "Merge cells": "セルを結合", + "Split cell": "セルを分割", + "Outdent": "インデント解除", + "Indent": "インデント", "Placeholder": "プレースホルダー", "Bold": "太字", "Italic": "斜体", @@ -751,12 +757,6 @@ "Background color": "背景色", "Highlight": "ハイライト", "Code": "コード", - "Heading": "見出し", - "Subheading": "小見出し", - "Merge cells": "セルを結合", - "Split cell": "セルを分割", - "Outdent": "インデント解除", - "Indent": "インデント", "Create link": "リンクを作成", "Comment": "コメント", "Align left": "左揃え", @@ -855,6 +855,13 @@ "No expiration": "無期限", "The document archive is empty at the moment.": "アーカイブにはなにもありません。", "Done editing": "編集完了", + "Only members with access can view": "アクセス権を持つメンバーのみが閲覧できます", + "All members in the workspace can view": "ワークスペース内のすべてのメンバーが閲覧できます", + "Private": "非公開", + "Anyone with the link can view": "リンクを知っている全員が閲覧できます", + "Publicly shared": "公開共有済み", + "{{ count }} document": "{{ count }} 件のドキュメント", + "{{ count }} document_plural": "{{ count }} 件のドキュメント", "Drop documents to import": "インポートするドキュメントをドロップ", "{{ collectionName }} doesn’t contain any\n documents yet.": "{{ collectionName }} にはまだ\n ドキュメントがありません。", "{{ usersCount }} users and {{ groupsCount }} groups with access": "アクセス権を持つ {{ usersCount }} 人のユーザーと {{ groupsCount }} 個のグループ", @@ -1318,6 +1325,7 @@ "Synced <2>": "同期済み <2>", "Date created": "作成日時", "Crop Image": "画像をトリミング", + "Your browser cannot read HEIC images, please convert it to JPEG or PNG first": "お使いのブラウザではHEIC画像を読み込めません。先にJPEGまたはPNGに変換してください。", "Crop image": "画像を切り取る", "You can import a zip file that was previously exported from the JSON option in another instance. In {{ appName }}, open Export in the Settings sidebar and click on Export Data.": "以前にエクスポートした zip ファイルをインポートできます。 {{ appName }} で、サイドバーの エクスポート画面 を開き、 データのエクスポート をクリックします。", "Drag and drop the zip file from the JSON export option in {{appName}}, or click to upload": "{{appName}} の JSON エクスポートオプションから zip ファイルをドラッグ&ドロップするか、クリックしてアップロードします", @@ -1592,7 +1600,6 @@ "IP": "IPアドレス", "a group": "グループ", "All users": "すべてのユーザー", - "Private": "非公開", "View and edit": "表示・編集", "Sharing enabled": "共有の有効化", "Date archived": "アーカイブ日", diff --git a/shared/i18n/locales/ko_KR/translation.json b/shared/i18n/locales/ko_KR/translation.json index 776ab9324f..e3d9f0f87c 100644 --- a/shared/i18n/locales/ko_KR/translation.json +++ b/shared/i18n/locales/ko_KR/translation.json @@ -744,6 +744,12 @@ "Warning notice": "주의 공지", "Tip notice": "팁 공지", "Wrap text": "텍스트 줄바꿈", + "Heading": "제목", + "Subheading": "부제목", + "Merge cells": "셀 병합", + "Split cell": "셀 나누기", + "Outdent": "내어쓰기", + "Indent": "들여쓰기", "Placeholder": "플레이스홀더", "Bold": "굵게", "Italic": "이탤릭체", @@ -751,12 +757,6 @@ "Background color": "배경색", "Highlight": "강조", "Code": "코드", - "Heading": "제목", - "Subheading": "부제목", - "Merge cells": "셀 병합", - "Split cell": "셀 나누기", - "Outdent": "내어쓰기", - "Indent": "들여쓰기", "Create link": "링크 생성", "Comment": "댓글", "Align left": "왼쪽 정렬", @@ -855,6 +855,13 @@ "No expiration": "만료 없음", "The document archive is empty at the moment.": "현재 보관 문서함이 비어 있습니다.", "Done editing": "수정 완료", + "Only members with access can view": "액세스 권한이 있는 멤버만 볼 수 있습니다.", + "All members in the workspace can view": "워크스페이스의 모든 멤버가 볼 수 있습니다.", + "Private": "비공개", + "Anyone with the link can view": "링크가 있는 모든 사용자가 볼 수 있습니다.", + "Publicly shared": "공개 공유됨", + "{{ count }} document": "문서 {{ count }}개", + "{{ count }} document_plural": "문서 {{ count }}개", "Drop documents to import": "가져올 문서 내려놓기", "{{ collectionName }} doesn’t contain any\n documents yet.": "{{ collectionName }} 컬렉션에 문서가 없습니다.", "{{ usersCount }} users and {{ groupsCount }} groups with access": "액세스 권한이 있는 사용자 {{ usersCount }} 명 및 그룹 {{ groupsCount }} 개", @@ -1318,6 +1325,7 @@ "Synced <2>": "동기화됨<2>", "Date created": "생성 일자", "Crop Image": "이미지 자르기", + "Your browser cannot read HEIC images, please convert it to JPEG or PNG first": "브라우저에서 HEIC 이미지를 읽을 수 없습니다. 먼저 JPEG 또는 PNG로 변환해 주세요.", "Crop image": "이미지 자르기", "You can import a zip file that was previously exported from the JSON option in another instance. In {{ appName }}, open Export in the Settings sidebar and click on Export Data.": "다른 인스턴스의 JSON 옵션에서 이전에 내보낸 압축 파일을 가져올 수 있습니다. {{ appName }} 에서 설정 사이드바에서 내보내기를 열고 데이터 내보내기클릭합니다.", "Drag and drop the zip file from the JSON export option in {{appName}}, or click to upload": "{{appName}}의 JSON 내보내기 옵션에서 zip 파일을 드래그 앤 드롭하거나 클릭하여 업로드", @@ -1592,7 +1600,6 @@ "IP": "IP", "a group": "그룹", "All users": "전체 사용자", - "Private": "비공개", "View and edit": "보기 및 편집", "Sharing enabled": "공유 활성화됨", "Date archived": "보관 날짜", diff --git a/shared/i18n/locales/nb_NO/translation.json b/shared/i18n/locales/nb_NO/translation.json index e1f3269206..1da025e5f0 100644 --- a/shared/i18n/locales/nb_NO/translation.json +++ b/shared/i18n/locales/nb_NO/translation.json @@ -744,6 +744,12 @@ "Warning notice": "Advarselvarsel", "Tip notice": "Tipsvarsel", "Wrap text": "Wrap text", + "Heading": "Overskrift", + "Subheading": "Underoverskrift", + "Merge cells": "Slå sammen celler", + "Split cell": "Del celle", + "Outdent": "Utrykk", + "Indent": "Innrykk", "Placeholder": "Plassholder", "Bold": "Fet", "Italic": "Kursiv", @@ -751,12 +757,6 @@ "Background color": "Background color", "Highlight": "Uthev", "Code": "Kode", - "Heading": "Overskrift", - "Subheading": "Underoverskrift", - "Merge cells": "Slå sammen celler", - "Split cell": "Del celle", - "Outdent": "Utrykk", - "Indent": "Innrykk", "Create link": "Opprett lenke", "Comment": "Kommentar", "Align left": "Venstrejuster", @@ -855,6 +855,13 @@ "No expiration": "Ingen utløpsdato", "The document archive is empty at the moment.": "Dokumentarkivet er tomt for øyeblikket.", "Done editing": "Ferdig med redigering", + "Only members with access can view": "Bare medlemmer med tilgang kan se", + "All members in the workspace can view": "Alle medlemmer i arbeidsområdet kan se", + "Private": "Privat", + "Anyone with the link can view": "Alle med lenken kan se", + "Publicly shared": "Delt offentlig", + "{{ count }} document": "{{ count }} dokument", + "{{ count }} document_plural": "{{ count }} dokumenter", "Drop documents to import": "Slipp dokumenter for å importere", "{{ collectionName }} doesn’t contain any\n documents yet.": "{{ collectionName }} inneholder ingen\n dokumenter ennå.", "{{ usersCount }} users and {{ groupsCount }} groups with access": "{{ usersCount }} brukere og {{ groupsCount }} grupper med tilgang", @@ -1318,6 +1325,7 @@ "Synced <2>": "Synced <2>", "Date created": "Dato opprettet", "Crop Image": "Beskjær bilde", + "Your browser cannot read HEIC images, please convert it to JPEG or PNG first": "Nettleseren din kan ikke lese HEIC-bilder. Konverter dem til JPEG eller PNG først.", "Crop image": "Beskjær bilde", "You can import a zip file that was previously exported from the JSON option in another instance. In {{ appName }}, open Export in the Settings sidebar and click on Export Data.": "Du kan importere en zip-fil som tidligere ble eksportert fra JSON-alternativet i en annen instans. I {{ appName }}, åpne Eksport i innstillingssidestolpen og klikk på Eksporter Data.", "Drag and drop the zip file from the JSON export option in {{appName}}, or click to upload": "Dra og slipp zip-filen fra JSON-eksportalternativet i {{appName}}, eller klikk for å laste opp", @@ -1592,7 +1600,6 @@ "IP": "IP", "a group": "a group", "All users": "All users", - "Private": "Privat", "View and edit": "Vis og rediger", "Sharing enabled": "Sharing enabled", "Date archived": "Date archived", diff --git a/shared/i18n/locales/nl_NL/translation.json b/shared/i18n/locales/nl_NL/translation.json index 9014076b4a..3e5254997e 100644 --- a/shared/i18n/locales/nl_NL/translation.json +++ b/shared/i18n/locales/nl_NL/translation.json @@ -744,6 +744,12 @@ "Warning notice": "Waarschuwing opmerking", "Tip notice": "Tip opmerking", "Wrap text": "Tekst-terugloop", + "Heading": "Kop", + "Subheading": "Subtitel", + "Merge cells": "Cellen samenvoegen", + "Split cell": "Cel splitsen", + "Outdent": "Uitspringen", + "Indent": "Inspringen", "Placeholder": "Tijdelijke aanduiding", "Bold": "Dikgedrukt", "Italic": "Cursief", @@ -751,12 +757,6 @@ "Background color": "Achtergrondkleur", "Highlight": "Markeer", "Code": "Code", - "Heading": "Kop", - "Subheading": "Subtitel", - "Merge cells": "Cellen samenvoegen", - "Split cell": "Cel splitsen", - "Outdent": "Uitspringen", - "Indent": "Inspringen", "Create link": "Link maken", "Comment": "Reageer", "Align left": "Links uitlijnen", @@ -855,6 +855,13 @@ "No expiration": "Geen vervaldatum", "The document archive is empty at the moment.": "Het documentenarchief is momenteel leeg.", "Done editing": "Klaar met bewerken", + "Only members with access can view": "Alleen leden met toegang kunnen dit bekijken.", + "All members in the workspace can view": "Alle leden in de werkruimte kunnen dit bekijken.", + "Private": "Privé", + "Anyone with the link can view": "Iedereen met de link kan dit bekijken.", + "Publicly shared": "Openbaar gedeeld", + "{{ count }} document": "{{ count }} document", + "{{ count }} document_plural": "{{ count }} documenten", "Drop documents to import": "Sleep documenten hier naartoe om ze te importeren", "{{ collectionName }} doesn’t contain any\n documents yet.": "{{ collectionName }} bevat nog geen documenten.", "{{ usersCount }} users and {{ groupsCount }} groups with access": "{{ usersCount }} gebruikers en {{ groupsCount }} groepen met toegang", @@ -1318,6 +1325,7 @@ "Synced <2>": "Gesynchroniseerd <2>", "Date created": "Aanmaakdatum", "Crop Image": "Afbeelding bijsnijden", + "Your browser cannot read HEIC images, please convert it to JPEG or PNG first": "Uw browser kan HEIC-afbeeldingen niet lezen. Converteer deze eerst naar JPEG of PNG.", "Crop image": "Afbeelding bijsnijden", "You can import a zip file that was previously exported from the JSON option in another instance. In {{ appName }}, open Export in the Settings sidebar and click on Export Data.": "Je kunt een zipbestand importeren dat eerder is geëxporteerd vanuit de JSON-optie in een andere instantie. In {{ appName }}, open Exporteren in de zijbalk in Voorkeuren en klik op Exporteer gegevens.", "Drag and drop the zip file from the JSON export option in {{appName}}, or click to upload": "Sleep het zip-bestand vanuit de JSON exportoptie in {{appName}}, of klik om te uploaden", @@ -1592,7 +1600,6 @@ "IP": "IP", "a group": "een groep", "All users": "Alle gebruikers", - "Private": "Privé", "View and edit": "Weergeven en bewerken", "Sharing enabled": "Delen ingeschakeld", "Date archived": "Datum gearchiveerd", diff --git a/shared/i18n/locales/pl_PL/translation.json b/shared/i18n/locales/pl_PL/translation.json index ce80cef2a9..6cc73713cb 100644 --- a/shared/i18n/locales/pl_PL/translation.json +++ b/shared/i18n/locales/pl_PL/translation.json @@ -744,6 +744,12 @@ "Warning notice": "Zawiadomienie ostrzegawcze", "Tip notice": "Zawiadomienie z poradą", "Wrap text": "Wrap text", + "Heading": "Nagłówek", + "Subheading": "Podtytuł", + "Merge cells": "Scal komórki", + "Split cell": "Podziel komórkę", + "Outdent": "Zmniejsz wcięcie", + "Indent": "Wcięcie", "Placeholder": "Symbol zastępczy", "Bold": "Pogrubienie", "Italic": "Kursywa", @@ -751,12 +757,6 @@ "Background color": "Background color", "Highlight": "Wyróżnienie", "Code": "Kod", - "Heading": "Nagłówek", - "Subheading": "Podtytuł", - "Merge cells": "Scal komórki", - "Split cell": "Podziel komórkę", - "Outdent": "Zmniejsz wcięcie", - "Indent": "Wcięcie", "Create link": "Utwórz link", "Comment": "Komentarz", "Align left": "Wyrównanie do lewej", @@ -855,6 +855,13 @@ "No expiration": "Bez daty wygaśnięcia", "The document archive is empty at the moment.": "Archiwum dokumentów jest obecnie puste.", "Done editing": "Zakończ edycję", + "Only members with access can view": "Tylko członkowie z dostępem mogą wyświetlać.", + "All members in the workspace can view": "Wszyscy członkowie obszaru roboczego mogą wyświetlać.", + "Private": "Prywatne", + "Anyone with the link can view": "Każdy, kto ma link, może wyświetlać.", + "Publicly shared": "Udostępnione publicznie", + "{{ count }} document": "{{ count }} dokument", + "{{ count }} document_plural": "{{ count }} dokumentów", "Drop documents to import": "Upuść dokumenty do zaimportowania", "{{ collectionName }} doesn’t contain any\n documents yet.": "{{ collectionName }} nie zawiera jeszcze żadnych dokumentów.", "{{ usersCount }} users and {{ groupsCount }} groups with access": "{{ usersCount }} użytkownik i {{ groupsCount }} grupy z dostępem", @@ -1318,6 +1325,7 @@ "Synced <2>": "Synced <2>", "Date created": "Data utworzenia", "Crop Image": "Przytnij obraz", + "Your browser cannot read HEIC images, please convert it to JPEG or PNG first": "Twoja przeglądarka nie może odczytać obrazów HEIC. Najpierw przekonwertuj je do formatu JPEG lub PNG.", "Crop image": "Przytnij obraz", "You can import a zip file that was previously exported from the JSON option in another instance. In {{ appName }}, open Export in the Settings sidebar and click on Export Data.": "Możesz zaimportować plik zip, który został wcześniej wyeksportowany z opcji JSON w innej instancji. W {{ appName }} otwórz Eksport w pasku bocznym Ustawień i kliknij Eksportuj dane.", "Drag and drop the zip file from the JSON export option in {{appName}}, or click to upload": "Przeciągnij i upuść plik zip z opcji eksportu JSON w {{appName}} lub kliknij, aby wybrać plik do przesłania", @@ -1592,7 +1600,6 @@ "IP": "Adres IP", "a group": "grupa", "All users": "Wszyscy użytkownicy", - "Private": "Prywatne", "View and edit": "Podgląd i edycja", "Sharing enabled": "Udostępnianie włączone", "Date archived": "Data archiwizacji", diff --git a/shared/i18n/locales/pt_BR/translation.json b/shared/i18n/locales/pt_BR/translation.json index f3b700eff2..0f6a3a1d06 100644 --- a/shared/i18n/locales/pt_BR/translation.json +++ b/shared/i18n/locales/pt_BR/translation.json @@ -744,6 +744,12 @@ "Warning notice": "Aviso de atenção", "Tip notice": "Aviso de dica", "Wrap text": "Wrap text", + "Heading": "Cabeçalho", + "Subheading": "Subtítulo", + "Merge cells": "Mesclar células", + "Split cell": "Dividir célula", + "Outdent": "Remover indentação", + "Indent": "Indentar", "Placeholder": "Placeholder", "Bold": "Negrito", "Italic": "Itálico", @@ -751,12 +757,6 @@ "Background color": "Cor de fundo", "Highlight": "Destaque", "Code": "Código", - "Heading": "Cabeçalho", - "Subheading": "Subtítulo", - "Merge cells": "Mesclar células", - "Split cell": "Dividir célula", - "Outdent": "Remover indentação", - "Indent": "Indentar", "Create link": "Criar atalho", "Comment": "Comentar", "Align left": "Alinhar à esquerda", @@ -855,6 +855,13 @@ "No expiration": "Sem expiração", "The document archive is empty at the moment.": "O arquivo de documento está vazio no momento.", "Done editing": "Edição concluída", + "Only members with access can view": "Somente membros com acesso podem visualizar", + "All members in the workspace can view": "Todos os membros no espaço de trabalho podem visualizar", + "Private": "Privado", + "Anyone with the link can view": "Qualquer pessoa com o link pode visualizar", + "Publicly shared": "Compartilhado publicamente", + "{{ count }} document": "{{ count }} document", + "{{ count }} document_plural": "{{ count }} documents", "Drop documents to import": "Solte documentos para importar", "{{ collectionName }} doesn’t contain any\n documents yet.": "{{ collectionName }} não contém nenhum\n documento ainda.", "{{ usersCount }} users and {{ groupsCount }} groups with access": "{{ usersCount }} usuário e {{ groupsCount }} grupos com acesso", @@ -1318,6 +1325,7 @@ "Synced <2>": "Synced <2>", "Date created": "Data de criação", "Crop Image": "Cortar Imagem", + "Your browser cannot read HEIC images, please convert it to JPEG or PNG first": "Seu navegador não consegue ler imagens HEIC. Converta-as para JPEG ou PNG primeiro.", "Crop image": "Cortar imagem", "You can import a zip file that was previously exported from the JSON option in another instance. In {{ appName }}, open Export in the Settings sidebar and click on Export Data.": "Você pode importar um arquivo zip que foi exportado anteriormente da opção JSON em outra instância. Em {{ appName }}, abra Exportar na barra lateral de Configurações e clique em Exportar Dados.", "Drag and drop the zip file from the JSON export option in {{appName}}, or click to upload": "Arraste e solte o arquivo zip da opção de exportação JSON em {{appName}}, ou clique para realizar o upload", @@ -1592,7 +1600,6 @@ "IP": "IP", "a group": "a group", "All users": "All users", - "Private": "Privado", "View and edit": "Ver e editar", "Sharing enabled": "Sharing enabled", "Date archived": "Date archived", diff --git a/shared/i18n/locales/pt_PT/translation.json b/shared/i18n/locales/pt_PT/translation.json index 3e2a8f1c49..cc671f4407 100644 --- a/shared/i18n/locales/pt_PT/translation.json +++ b/shared/i18n/locales/pt_PT/translation.json @@ -744,6 +744,12 @@ "Warning notice": "Aviso de alerta", "Tip notice": "Aviso de dica", "Wrap text": "Wrap text", + "Heading": "Cabeçalho", + "Subheading": "Subtítulo", + "Merge cells": "Merge cells", + "Split cell": "Split cell", + "Outdent": "Recuar", + "Indent": "Indentar", "Placeholder": "Espaço em branco", "Bold": "Negrito", "Italic": "Itálico", @@ -751,12 +757,6 @@ "Background color": "Background color", "Highlight": "Destaque", "Code": "Código", - "Heading": "Cabeçalho", - "Subheading": "Subtítulo", - "Merge cells": "Merge cells", - "Split cell": "Split cell", - "Outdent": "Recuar", - "Indent": "Indentar", "Create link": "Criar link", "Comment": "Comentar", "Align left": "Alinhar à esquerda", @@ -855,6 +855,13 @@ "No expiration": "Sem expiração", "The document archive is empty at the moment.": "O arquivo do documento está vazio neste momento.", "Done editing": "Edição concluída", + "Only members with access can view": "Apenas membros com acesso podem visualizar", + "All members in the workspace can view": "Todos os membros no espaço de trabalho podem visualizar", + "Private": "Privado", + "Anyone with the link can view": "Qualquer pessoa com o link pode visualizar", + "Publicly shared": "Compartilhado publicamente", + "{{ count }} document": "{{ count }} document", + "{{ count }} document_plural": "{{ count }} documents", "Drop documents to import": "Arraste documentos para importar", "{{ collectionName }} doesn’t contain any\n documents yet.": "{{ collectionName }} não contém\n documentos ainda.", "{{ usersCount }} users and {{ groupsCount }} groups with access": "{{ usersCount }} utilizador e {{ groupsCount }} grupos com acesso", @@ -1318,6 +1325,7 @@ "Synced <2>": "Synced <2>", "Date created": "Date created", "Crop Image": "Crop Image", + "Your browser cannot read HEIC images, please convert it to JPEG or PNG first": "Seu navegador não consegue ler imagens HEIC. Converta-as para JPEG ou PNG primeiro.", "Crop image": "Crop image", "You can import a zip file that was previously exported from the JSON option in another instance. In {{ appName }}, open Export in the Settings sidebar and click on Export Data.": "Pode importar um ficheiro ZIP que foi exportado anteriormente a partir da opção JSON de outra instância. Em {{ appName }}, abra Exportar na barra lateral de Configurações e clique em Exportar Dados.", "Drag and drop the zip file from the JSON export option in {{appName}}, or click to upload": "Arraste e solte o ficheiro ZIP da opção de exportação JSON em {{appName}}ou clique para carregar", @@ -1592,7 +1600,6 @@ "IP": "IP", "a group": "a group", "All users": "All users", - "Private": "Privado", "View and edit": "View and edit", "Sharing enabled": "Sharing enabled", "Date archived": "Date archived", diff --git a/shared/i18n/locales/sv_SE/translation.json b/shared/i18n/locales/sv_SE/translation.json index 9f7b70c9c6..f89d644a9f 100644 --- a/shared/i18n/locales/sv_SE/translation.json +++ b/shared/i18n/locales/sv_SE/translation.json @@ -400,9 +400,9 @@ "Choose a name": "Choose a name", "name can only contain lowercase letters, numbers, and underscores.": "name can only contain lowercase letters, numbers, and underscores.", "This emoji will be available as": "This emoji will be available as", - "Emoji deleted": "Emoji deleted", + "Emoji deleted": "Emoji raderad", "Are you sure you want to delete the {{emojiName}} emoji? You will no longer be able to use it in your documents or collections.": "Är du säker på att du vill ta bort {{emojiName}}-emojin? Du kommer inte längre att kunna använda den i dina dokument eller samlingar.", - "Emoji replaced": "Emoji replaced", + "Emoji replaced": "Emoji ersatt", "Upload a new image to replace the current one for {{emojiName}}. All existing uses of this emoji will be updated automatically.": "Upload a new image to replace the current one for {{emojiName}}. All existing uses of this emoji will be updated automatically.", "Module failed to load": "Modulen kunde inte laddas", "Loading Failed": "Laddning misslyckades", @@ -430,8 +430,8 @@ "{{ count }} members_plural": "{{ count }} members", "{{authorName}} created <3>": "{{authorName}} öppnade <3>", "Lead": "Lead", - "Target date": "Target date", - "Labels": "Labels", + "Target date": "Måldatum", + "Labels": "Etiketter", "{{authorName}} opened <3>": "{{authorName}} öppnade <3>", "Search emoji": "Sök efter emoji", "Search icons": "Sök efter ikon", @@ -463,7 +463,7 @@ "Can edit": "Kan redigera", "No access": "Ingen access", "Permission": "Behörighet", - "or": "or", + "or": "eller", "plus": "plus", "then": "then", "Change Language": "Byt språk", @@ -471,8 +471,8 @@ "Unable to download image": "Unable to download image", "Lightbox": "Lightbox", "View, navigate, or download images in the document": "View, navigate, or download images in the document", - "Zoom in": "Zoom in", - "Zoom out": "Zoom out", + "Zoom in": "Zooma in", + "Zoom out": "Zooma ut", "Download": "Ladda ned", "Edit diagram": "Edit diagram", "Close": "Stäng", @@ -488,26 +488,26 @@ "{{ count }} selected_plural": "{{ count }} markerade", "Clear selection": "Rensa markering", "Can view the document": "Can view the document", - "Can view and edit the document": "Can view and edit the document", + "Can view and edit the document": "Kan se och redigera dokumentet", "Manage": "Administrera", - "Full access including sharing": "Full access including sharing", + "Full access including sharing": "Full åtkomst inklusive delning", "Permissions for {{ userName }} updated": "Behörigheter för {{ userName }} uppdaterat", - "Failed to approve access request": "Failed to approve access request", - "Access request dismissed": "Access request dismissed", - "Failed to dismiss access request": "Failed to dismiss access request", - "Approve": "Approve", - "Notification options": "Notification options", + "Failed to approve access request": "Det gick inte att godkänna åtkomstförfrågan", + "Access request dismissed": "Begäran om åtkomst avfärdad", + "Failed to dismiss access request": "Misslyckades att avfärda åtkomstbegäran", + "Approve": "Godkänn", + "Notification options": "Inställningar för aviseringar", "Unknown": "Okänd", - "Mentions": "Mentions", - "Comments and replies": "Comments and replies", - "Document events": "Document events", + "Mentions": "Omnämnanden", + "Comments and replies": "Kommentarer och svar", + "Document events": "Dokumenthändelser", "Collection events": "Samlingshändelser", "Mark all as read": "Markera alla som lästa", "You're all caught up": "Inga olästa meddelanden", - "Client type": "Client type", - "Confidential": "Confidential", + "Client type": "Kundtyp", + "Confidential": "Konfidentiell", "Suitable for server-side applications": "Suitable for server-side applications", - "Public": "Public", + "Public": "Publik", "Suitable for client-side or mobile applications": "Suitable for client-side or mobile applications", "Icon": "Ikon", "OAuth client icon": "OAuth klient ikon", @@ -538,7 +538,7 @@ "Public link copied to clipboard": "Offentlig länk har kopierats till urklipp", "Only lowercase letters, digits and dashes allowed": "Endast små bokstäver, siffror och bindestreck tillåts", "Sorry, this link has already been used": "Tyvärr, denna länk har redan använts", - "Publish to web": "Publish to web", + "Publish to web": "Publicera till webben", "Allow anyone with the link to access": "Tillåt vem som helst med länken att komma åt", "Publish to internet": "Publicera på internet", "All documents in this collection will be shared on the web, including any new documents added later": "Alla dokument i denna samling kommer att delas på webben, inklusive nya dokument som läggs till senare", @@ -550,7 +550,7 @@ "{{ count }} people and {{ count2 }} groups added to the collection_plural": "{{ count }} personer och {{ count2 }} grupper tillagda i samlingarna", "Switch to dark": "Växla till mörkt", "Switch to light": "Växla till ljust", - "Subscribe to updates": "Subscribe to updates", + "Subscribe to updates": "Prenumerera på uppdateringar", "Display settings": "Display settings", "Edit {{noun}}": "Redigera {{noun}}", "Logo": "Logo", @@ -744,6 +744,12 @@ "Warning notice": "Varningsmeddelande", "Tip notice": "Tipsnotis", "Wrap text": "Wrap text", + "Heading": "Rubrik", + "Subheading": "Underrubrik", + "Merge cells": "Sammanfoga celler", + "Split cell": "Dela cell", + "Outdent": "Minska indrag", + "Indent": "Indrag", "Placeholder": "Platshållare", "Bold": "Fetstil", "Italic": "Kursiv", @@ -751,12 +757,6 @@ "Background color": "Background color", "Highlight": "Markera", "Code": "Kod", - "Heading": "Rubrik", - "Subheading": "Underrubrik", - "Merge cells": "Sammanfoga celler", - "Split cell": "Dela cell", - "Outdent": "Minska indrag", - "Indent": "Indrag", "Create link": "Skapa länk", "Comment": "Kommentar", "Align left": "Vänsterjustera", @@ -855,6 +855,13 @@ "No expiration": "Ingen utgång", "The document archive is empty at the moment.": "Dokumentarkivet är för närvarande tomt.", "Done editing": "Redigering klar", + "Only members with access can view": "Endast medlemmar med åtkomst kan visa", + "All members in the workspace can view": "Alla medlemmar i arbetsytan kan visa", + "Private": "Privat", + "Anyone with the link can view": "Alla med länken kan visa", + "Publicly shared": "Delat offentligt", + "{{ count }} document": "{{ count }} document", + "{{ count }} document_plural": "{{ count }} documents", "Drop documents to import": "Släpp dokument att importera", "{{ collectionName }} doesn’t contain any\n documents yet.": "{{ collectionName }} innehåller inga\n -dokument ännu.", "{{ usersCount }} users and {{ groupsCount }} groups with access": "{{ usersCount }} användare och {{ groupsCount }} grupper med åtkomst", @@ -1318,6 +1325,7 @@ "Synced <2>": "Synced <2>", "Date created": "Datum skapad", "Crop Image": "Beskär bild", + "Your browser cannot read HEIC images, please convert it to JPEG or PNG first": "Din webbläsare kan inte läsa HEIC-bilder. Konvertera dem till JPEG eller PNG först.", "Crop image": "Beskär bild", "You can import a zip file that was previously exported from the JSON option in another instance. In {{ appName }}, open Export in the Settings sidebar and click on Export Data.": "Du kan importera en zip-fil som tidigare exporterades från JSON-alternativet i ett annat fall. I {{ appName }}, öppna Exportera i inställningspanelen och klicka på Exportera data.", "Drag and drop the zip file from the JSON export option in {{appName}}, or click to upload": "Dra och släpp zip-filen från JSON-exportalternativet i {{appName}}, eller klicka för att ladda upp", @@ -1592,7 +1600,6 @@ "IP": "IP", "a group": "a group", "All users": "All users", - "Private": "Privat", "View and edit": "Visa och redigera", "Sharing enabled": "Sharing enabled", "Date archived": "Date archived", diff --git a/shared/i18n/locales/th_TH/translation.json b/shared/i18n/locales/th_TH/translation.json index d461ea0006..c7ea4cfbd1 100644 --- a/shared/i18n/locales/th_TH/translation.json +++ b/shared/i18n/locales/th_TH/translation.json @@ -744,6 +744,12 @@ "Warning notice": "คำเตือน", "Tip notice": "ข้อควรทราบ", "Wrap text": "Wrap text", + "Heading": "หัวเรื่อง", + "Subheading": "หัวเรื่องย่อย", + "Merge cells": "Merge cells", + "Split cell": "Split cell", + "Outdent": "Outdent", + "Indent": "Indent", "Placeholder": "ตัวยึด", "Bold": "ตัวหนา", "Italic": "ตัวเอียง", @@ -751,12 +757,6 @@ "Background color": "Background color", "Highlight": "ไฮไลท์", "Code": "Code", - "Heading": "หัวเรื่อง", - "Subheading": "หัวเรื่องย่อย", - "Merge cells": "Merge cells", - "Split cell": "Split cell", - "Outdent": "Outdent", - "Indent": "Indent", "Create link": "สร้างลิงก์", "Comment": "Comment", "Align left": "จัดตำแหน่งชิดซ้าย", @@ -855,6 +855,13 @@ "No expiration": "No expiration", "The document archive is empty at the moment.": "ไม่มีเอกสารในที่เก็บเอกสารถาวรในขณะนี้", "Done editing": "Done editing", + "Only members with access can view": "เฉพาะสมาชิกที่มีสิทธิ์เข้าถึงเท่านั้นที่ดูได้", + "All members in the workspace can view": "สมาชิกทุกคนในเวิร์กสเปซดูได้", + "Private": "Private", + "Anyone with the link can view": "ทุกคนที่มีลิงก์ดูได้", + "Publicly shared": "แชร์แบบสาธารณะ", + "{{ count }} document": "เอกสาร {{ count }} รายการ", + "{{ count }} document_plural": "เอกสาร {{ count }} รายการ", "Drop documents to import": "Drop documents to import", "{{ collectionName }} doesn’t contain any\n documents yet.": "{{ collectionName }} doesn’t contain any\n documents yet.", "{{ usersCount }} users and {{ groupsCount }} groups with access": "{{ usersCount }} user and {{ groupsCount }} groups with access", @@ -1318,6 +1325,7 @@ "Synced <2>": "Synced <2>", "Date created": "Date created", "Crop Image": "Crop Image", + "Your browser cannot read HEIC images, please convert it to JPEG or PNG first": "เบราว์เซอร์ของคุณไม่สามารถอ่านภาพ HEIC ได้ โปรดแปลงเป็น JPEG หรือ PNG ก่อน", "Crop image": "Crop image", "You can import a zip file that was previously exported from the JSON option in another instance. In {{ appName }}, open Export in the Settings sidebar and click on Export Data.": "You can import a zip file that was previously exported from the JSON option in another instance. In {{ appName }}, open Export in the Settings sidebar and click on Export Data.", "Drag and drop the zip file from the JSON export option in {{appName}}, or click to upload": "Drag and drop the zip file from the JSON export option in {{appName}}, or click to upload", @@ -1592,7 +1600,6 @@ "IP": "IP", "a group": "a group", "All users": "All users", - "Private": "Private", "View and edit": "ดูและแก้ไข", "Sharing enabled": "Sharing enabled", "Date archived": "Date archived", diff --git a/shared/i18n/locales/tr_TR/translation.json b/shared/i18n/locales/tr_TR/translation.json index 616db352a8..7983d6c64d 100644 --- a/shared/i18n/locales/tr_TR/translation.json +++ b/shared/i18n/locales/tr_TR/translation.json @@ -744,6 +744,12 @@ "Warning notice": "Uyarı bildirimi", "Tip notice": "İpucu bildirimi", "Wrap text": "Metni kaydır", + "Heading": "Başlık", + "Subheading": "Alt başlık", + "Merge cells": "Hücreleri birleştir", + "Split cell": "Hücreyi böl", + "Outdent": "Girintiyi azalt", + "Indent": "Girintiyi arttır", "Placeholder": "Yer tutucu", "Bold": "Kalın", "Italic": "İtalik", @@ -751,12 +757,6 @@ "Background color": "Arka plan rengi", "Highlight": "Vurgula", "Code": "Kod", - "Heading": "Başlık", - "Subheading": "Alt başlık", - "Merge cells": "Hücreleri birleştir", - "Split cell": "Hücreyi böl", - "Outdent": "Girintiyi azalt", - "Indent": "Girintiyi arttır", "Create link": "Bağlantı oluştur", "Comment": "Yorum", "Align left": "Sola hizala", @@ -855,6 +855,13 @@ "No expiration": "Sona erme yok", "The document archive is empty at the moment.": "Belge arşivi şu anda boş.", "Done editing": "Düzenleme bitti", + "Only members with access can view": "Yalnızca erişimi olan üyeler görüntüleyebilir", + "All members in the workspace can view": "Çalışma alanındaki tüm üyeler görüntüleyebilir", + "Private": "Özel", + "Anyone with the link can view": "Bağlantıya sahip olan herkes görüntüleyebilir", + "Publicly shared": "Herkese açık olarak paylaşıldı", + "{{ count }} document": "{{ count }} belge", + "{{ count }} document_plural": "{{ count }} belge", "Drop documents to import": "İçe aktarmak için belgeleri buraya bırakın", "{{ collectionName }} doesn’t contain any\n documents yet.": "{{ collectionName }} henüz belge içermiyor.", "{{ usersCount }} users and {{ groupsCount }} groups with access": "erişimi olan {{ usersCount }} kullanıcı ve {{ groupsCount }} grup", @@ -1318,6 +1325,7 @@ "Synced <2>": "Eşitlendi <2>", "Date created": "Oluşturulma tarihi", "Crop Image": "Görseli Kırp", + "Your browser cannot read HEIC images, please convert it to JPEG or PNG first": "Tarayıcınız HEIC görüntülerini okuyamıyor, lütfen önce JPEG veya PNG'ye dönüştürün", "Crop image": "Görseli kırp", "You can import a zip file that was previously exported from the JSON option in another instance. In {{ appName }}, open Export in the Settings sidebar and click on Export Data.": "Daha önce başka bir örnekteki JSON seçeneğinden dışa aktarılmış bir zip dosyasını içe aktarabilirsiniz. {{ appName }} uygulamasında, Ayarlar kenar çubuğunda Dışa Aktar'ı açın ve Verileri Dışa Aktar'a tıklayın.", "Drag and drop the zip file from the JSON export option in {{appName}}, or click to upload": "{{appName}} uygulamasındaki JSON dışa aktarma seçeneğinden zip dosyasını sürükleyip bırakın veya yüklemek için tıklayın", @@ -1592,7 +1600,6 @@ "IP": "IP", "a group": "bir grup", "All users": "Tüm kullanıcılar", - "Private": "Özel", "View and edit": "Görüntüle ve düzenle", "Sharing enabled": "Paylaşım etkin", "Date archived": "Arşivlenme tarihi", diff --git a/shared/i18n/locales/uk_UA/translation.json b/shared/i18n/locales/uk_UA/translation.json index f466ad4529..a4bad9159d 100644 --- a/shared/i18n/locales/uk_UA/translation.json +++ b/shared/i18n/locales/uk_UA/translation.json @@ -744,6 +744,12 @@ "Warning notice": "Попереджувальне повідомлення", "Tip notice": "Підказка", "Wrap text": "Wrap text", + "Heading": "Заголовок", + "Subheading": "Підзаголовок", + "Merge cells": "Об'єднати комірки", + "Split cell": "Розділити комірку", + "Outdent": "Відступ", + "Indent": "Відступ", "Placeholder": "Поле для заповнення", "Bold": "Жирний", "Italic": "Курсив", @@ -751,12 +757,6 @@ "Background color": "Колір фону", "Highlight": "Виділення", "Code": "Код", - "Heading": "Заголовок", - "Subheading": "Підзаголовок", - "Merge cells": "Об'єднати комірки", - "Split cell": "Розділити комірку", - "Outdent": "Відступ", - "Indent": "Відступ", "Create link": "Створити посилання", "Comment": "Коментар", "Align left": "Вирівняти по лівому краю", @@ -855,6 +855,13 @@ "No expiration": "Без терміну дії", "The document archive is empty at the moment.": "Архів документів на даний час порожній.", "Done editing": "Редагування завершено", + "Only members with access can view": "Переглядати можуть лише учасники з доступом.", + "All members in the workspace can view": "Переглядати можуть усі учасники робочого простору.", + "Private": "Приватний", + "Anyone with the link can view": "Переглядати можуть усі, хто має посилання.", + "Publicly shared": "Загальнодоступно", + "{{ count }} document": "{{ count }} документ", + "{{ count }} document_plural": "{{ count }} документи", "Drop documents to import": "Перетягніть документи для імпорту", "{{ collectionName }} doesn’t contain any\n documents yet.": "{{ collectionName }} ще не містить жодного\n документа.", "{{ usersCount }} users and {{ groupsCount }} groups with access": "{{ usersCount }} користувач і {{ groupsCount }} груп з доступом", @@ -1318,6 +1325,7 @@ "Synced <2>": "Synced <2>", "Date created": "Дата створення", "Crop Image": "Обрізати зображення", + "Your browser cannot read HEIC images, please convert it to JPEG or PNG first": "Ваш браузер не може читати зображення HEIC, спочатку конвертуйте його в JPEG або PNG.", "Crop image": "Обрізати зображення", "You can import a zip file that was previously exported from the JSON option in another instance. In {{ appName }}, open Export in the Settings sidebar and click on Export Data.": "Ви можете імпортувати zip-файл, який раніше було експортовано з опції JSON в інший простір. У {{ appName }} відкрийте Експорт на бічній панелі налаштувань і натисніть Експортувати дані.", "Drag and drop the zip file from the JSON export option in {{appName}}, or click to upload": "Перетягніть файл zip із опції експорту JSON у {{appName}} або натисніть, щоб завантажити", @@ -1592,7 +1600,6 @@ "IP": "IP", "a group": "a group", "All users": "All users", - "Private": "Приватний", "View and edit": "Переглянути та відредагувати", "Sharing enabled": "Sharing enabled", "Date archived": "Date archived", diff --git a/shared/i18n/locales/vi_VN/translation.json b/shared/i18n/locales/vi_VN/translation.json index df0409008b..d243de372a 100644 --- a/shared/i18n/locales/vi_VN/translation.json +++ b/shared/i18n/locales/vi_VN/translation.json @@ -744,6 +744,12 @@ "Warning notice": "Thông báo cảnh báo", "Tip notice": "Thông báo mẹo", "Wrap text": "Wrap text", + "Heading": "Tiêu đề", + "Subheading": "Tiêu đề phụ", + "Merge cells": "Merge cells", + "Split cell": "Split cell", + "Outdent": "Nhô lề", + "Indent": "Thụt lề", "Placeholder": "Giữ chỗ", "Bold": "Đậm", "Italic": "Nghiêng", @@ -751,12 +757,6 @@ "Background color": "Background color", "Highlight": "Điểm nổi bật", "Code": "Code", - "Heading": "Tiêu đề", - "Subheading": "Tiêu đề phụ", - "Merge cells": "Merge cells", - "Split cell": "Split cell", - "Outdent": "Nhô lề", - "Indent": "Thụt lề", "Create link": "Tạo đường link", "Comment": "Bình luận", "Align left": "Căn trái", @@ -855,6 +855,13 @@ "No expiration": "No expiration", "The document archive is empty at the moment.": "Kho lưu trữ tài liệu hiện đang trống.", "Done editing": "Done editing", + "Only members with access can view": "Chỉ thành viên có quyền truy cập mới có thể xem", + "All members in the workspace can view": "Tất cả thành viên trong không gian làm việc đều có thể xem", + "Private": "Riêng tư", + "Anyone with the link can view": "Bất kỳ ai có liên kết đều có thể xem", + "Publicly shared": "Được chia sẻ công khai", + "{{ count }} document": "{{ count }} tài liệu", + "{{ count }} document_plural": "{{ count }} tài liệu", "Drop documents to import": "Thả tài liệu để nhập", "{{ collectionName }} doesn’t contain any\n documents yet.": "{{ collectionName }} chưa có\n tài liệu nào.", "{{ usersCount }} users and {{ groupsCount }} groups with access": "{{ usersCount }} người dùng và {{ groupsCount }} nhóm có quyền truy cập", @@ -1318,6 +1325,7 @@ "Synced <2>": "Synced <2>", "Date created": "Date created", "Crop Image": "Crop Image", + "Your browser cannot read HEIC images, please convert it to JPEG or PNG first": "Trình duyệt của bạn không thể đọc ảnh HEIC, vui lòng chuyển đổi sang JPEG hoặc PNG trước", "Crop image": "Crop image", "You can import a zip file that was previously exported from the JSON option in another instance. In {{ appName }}, open Export in the Settings sidebar and click on Export Data.": "Bạn có thể nhập tệp zip đã được xuất trước đó từ tùy chọn JSON trong một phiên bản khác. Trong {{ appName }}, mở Xuất trong thanh bên Cài đặt và nhấp vào Xuất dữ liệu.", "Drag and drop the zip file from the JSON export option in {{appName}}, or click to upload": "Kéo và thả tệp zip từ tùy chọn xuất JSON trong {{appName}} hoặc nhấp để tải lên", @@ -1592,7 +1600,6 @@ "IP": "IP", "a group": "a group", "All users": "All users", - "Private": "Riêng tư", "View and edit": "Xem và chỉnh sửa", "Sharing enabled": "Sharing enabled", "Date archived": "Date archived", diff --git a/shared/i18n/locales/zh_CN/translation.json b/shared/i18n/locales/zh_CN/translation.json index 08dcbcbf02..f2b895077c 100644 --- a/shared/i18n/locales/zh_CN/translation.json +++ b/shared/i18n/locales/zh_CN/translation.json @@ -744,6 +744,12 @@ "Warning notice": "警告信息", "Tip notice": "提示信息", "Wrap text": "换行符", + "Heading": "标题", + "Subheading": "副标题", + "Merge cells": "合并单元格", + "Split cell": "拆分单元格", + "Outdent": "减少缩进", + "Indent": "缩进", "Placeholder": "占位符", "Bold": "加粗", "Italic": "斜体", @@ -751,12 +757,6 @@ "Background color": "背景色", "Highlight": "高亮", "Code": "代码", - "Heading": "标题", - "Subheading": "副标题", - "Merge cells": "合并单元格", - "Split cell": "拆分单元格", - "Outdent": "减少缩进", - "Indent": "缩进", "Create link": "创建链接", "Comment": "评论", "Align left": "左对齐", @@ -855,6 +855,13 @@ "No expiration": "无期限", "The document archive is empty at the moment.": "文档归档目前是空的。", "Done editing": "保存编辑", + "Only members with access can view": "只有具有访问权限的成员可以查看", + "All members in the workspace can view": "工作区中的所有成员都可以查看", + "Private": "私有的", + "Anyone with the link can view": "任何拥有链接的人都可以查看", + "Publicly shared": "公开分享", + "{{ count }} document": "{{ count }} 个文档", + "{{ count }} document_plural": "{{ count }} 个文档", "Drop documents to import": "拖放文档以导入", "{{ collectionName }} doesn’t contain any\n documents yet.": "{{ collectionName }} 尚未包含任何文档", "{{ usersCount }} users and {{ groupsCount }} groups with access": "{{ usersCount }} 个用户和 {{ groupsCount }} 个组有访问权限", @@ -1318,6 +1325,7 @@ "Synced <2>": "已同步 <2>", "Date created": "创建日期", "Crop Image": "裁剪图片", + "Your browser cannot read HEIC images, please convert it to JPEG or PNG first": "您的浏览器无法读取 HEIC 图像,请先将其转换为 JPEG 或 PNG", "Crop image": "裁剪图像", "You can import a zip file that was previously exported from the JSON option in another instance. In {{ appName }}, open Export in the Settings sidebar and click on Export Data.": "您可以导入之前从另一个实例中的JSON选项导出的zip文件。在 {{ appName }} 的侧边栏设置中打开 导出 ,并点击 导出数据。", "Drag and drop the zip file from the JSON export option in {{appName}}, or click to upload": "拖放或单击上传从 {{appName}} 的 JSON 导出选项导出的 zip 文件", @@ -1592,7 +1600,6 @@ "IP": "IP", "a group": "一组", "All users": "所有用户", - "Private": "私有的", "View and edit": "查看并编辑", "Sharing enabled": "共享已启用", "Date archived": "存档日期", diff --git a/shared/i18n/locales/zh_TW/translation.json b/shared/i18n/locales/zh_TW/translation.json index af6920ab0b..dde5adaacd 100644 --- a/shared/i18n/locales/zh_TW/translation.json +++ b/shared/i18n/locales/zh_TW/translation.json @@ -744,6 +744,12 @@ "Warning notice": "警告", "Tip notice": "小幫手", "Wrap text": "自動換行", + "Heading": "標題", + "Subheading": "副標題", + "Merge cells": "合併儲存格", + "Split cell": "分割儲存格", + "Outdent": "減少縮排", + "Indent": "增加縮排", "Placeholder": "占位符", "Bold": "粗體", "Italic": "斜體", @@ -751,12 +757,6 @@ "Background color": "背景顏色", "Highlight": "強調", "Code": "程式碼", - "Heading": "標題", - "Subheading": "副標題", - "Merge cells": "合併儲存格", - "Split cell": "分割儲存格", - "Outdent": "減少縮排", - "Indent": "增加縮排", "Create link": "建立超連結", "Comment": "評論", "Align left": "靠左對齊", @@ -855,6 +855,13 @@ "No expiration": "沒有期限", "The document archive is empty at the moment.": "目前沒有任何文件被封存。", "Done editing": "編輯完成", + "Only members with access can view": "只有具備存取權的成員可以檢視", + "All members in the workspace can view": "工作區中的所有成員都可以檢視", + "Private": "不公開", + "Anyone with the link can view": "擁有連結的任何人都可以檢視", + "Publicly shared": "公開分享", + "{{ count }} document": "{{ count }} 份文件", + "{{ count }} document_plural": "{{ count }} documents", "Drop documents to import": "拖曳文件以進行匯入", "{{ collectionName }} doesn’t contain any\n documents yet.": "{{ collectionName }} 中還沒有任何文件。", "{{ usersCount }} users and {{ groupsCount }} groups with access": "{{ usersCount }} 位使用者和 {{ groupsCount }} 個群組具有存取權", @@ -1318,6 +1325,7 @@ "Synced <2>": "已同步 <2>", "Date created": "建立日期", "Crop Image": "裁切影像", + "Your browser cannot read HEIC images, please convert it to JPEG or PNG first": "您的瀏覽器無法讀取 HEIC 圖片,請先將其轉換為 JPEG 或 PNG", "Crop image": "裁切影像", "You can import a zip file that was previously exported from the JSON option in another instance. In {{ appName }}, open Export in the Settings sidebar and click on Export Data.": "您可以匯入先前從另一個執行個體的 JSON 選項匯出的 ZIP 檔案。在 {{ appName }} 中,開啟設定側邊欄的匯出,然後點選匯出資料。", "Drag and drop the zip file from the JSON export option in {{appName}}, or click to upload": "將從 {{appName}} JSON 匯出選項取得的 ZIP 檔案拖放到此處,或點選上傳", @@ -1592,7 +1600,6 @@ "IP": "IP", "a group": "群組", "All users": "所有使用者", - "Private": "不公開", "View and edit": "檢視與編輯", "Sharing enabled": "已啟用分享", "Date archived": "封存日期", From 57c110dbe5b31a48c3bc5d06c473d3229785859b Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Wed, 2 Sep 2026 20:31:37 -0400 Subject: [PATCH 055/181] chore: Upgrade MobX (#13554) * Upgrade Mobx * fix: Enforce MobX action boundaries * fix: Wrap static observable updates in actions * Remove iteration tests --- app/components/DocumentContext.tsx | 8 +- app/components/ErrorBoundary.tsx | 9 +- app/components/ModelSelection.ts | 6 +- .../components/SidebarExpansionContext.ts | 6 +- app/editor/components/NodeViewRenderer.tsx | 3 +- app/editor/extensions/FindAndReplace.tsx | 7 +- app/editor/extensions/SelectionToolbar.tsx | 7 +- app/index.tsx | 3 +- app/models/ApiKey.ts | 14 +-- app/models/AuthenticationProvider.ts | 7 +- app/models/Collection.ts | 33 ++++--- app/models/Comment.ts | 8 +- app/models/Document.ts | 42 +++++---- app/models/Emoji.ts | 6 +- app/models/Event.ts | 5 + app/models/FileOperation.ts | 5 + app/models/Group.ts | 9 +- app/models/GroupMembership.ts | 5 + app/models/GroupUser.ts | 5 + app/models/Import.ts | 5 + app/models/Integration.ts | 5 + app/models/Membership.ts | 5 + app/models/Notification.ts | 11 ++- app/models/Pin.ts | 5 + app/models/Policy.ts | 5 + app/models/Revision.ts | 5 + app/models/SearchQuery.ts | 5 + app/models/Share.ts | 7 +- app/models/Star.ts | 5 + app/models/Subscription.ts | 5 + app/models/Team.ts | 11 ++- app/models/Template.ts | 22 +++-- app/models/Unfurl.ts | 5 + app/models/User.ts | 10 +- app/models/UserMembership.ts | 5 + app/models/View.ts | 5 + app/models/WebhookSubscription.ts | 5 + app/models/base/Model.test.ts | 93 +++++++++++++++++++ app/models/base/Model.ts | 44 ++++++++- app/models/base/NavigableModel.ts | 5 +- app/models/base/ParanoidModel.ts | 2 +- app/models/oauth/OAuthAuthentication.ts | 5 + app/models/oauth/OAuthClient.ts | 7 +- app/stores/AuthStore.ts | 36 +++---- app/stores/AuthenticationProvidersStore.ts | 4 +- app/stores/CollectionsStore.ts | 11 ++- app/stores/CommentsStore.ts | 5 +- app/stores/DialogsStore.ts | 8 +- app/stores/DocumentPresenceStore.ts | 3 +- app/stores/DocumentsStore.ts | 30 +++--- app/stores/EmojiStore.ts | 4 +- app/stores/GroupMembershipsStore.ts | 19 ++-- app/stores/GroupUsersStore.ts | 26 +++--- app/stores/GroupsStore.ts | 15 +-- app/stores/ImportsStore.ts | 5 +- app/stores/IntegrationsStore.ts | 4 +- app/stores/MembershipsStore.ts | 20 ++-- app/stores/NotificationsStore.ts | 20 ++-- app/stores/PinsStore.ts | 15 +-- app/stores/SharesStore.ts | 9 +- app/stores/StarsStore.ts | 15 +-- app/stores/TemplatesStore.ts | 5 +- app/stores/UiStore.ts | 25 ++--- app/stores/UnfurlsStore.ts | 3 +- app/stores/UserMembershipsStore.ts | 26 +++--- app/stores/UsersStore.ts | 9 +- app/stores/base/Store.ts | 29 ++++-- app/utils/FeatureFlags.ts | 28 ++++-- app/utils/PluginManager.ts | 8 +- package.json | 6 +- shared/editor/extensions/Diff.ts | 7 +- yarn.lock | 66 ++++++++----- 72 files changed, 663 insertions(+), 268 deletions(-) create mode 100644 app/models/base/Model.test.ts diff --git a/app/components/DocumentContext.tsx b/app/components/DocumentContext.tsx index 0722911c49..a5bd9ca81b 100644 --- a/app/components/DocumentContext.tsx +++ b/app/components/DocumentContext.tsx @@ -1,4 +1,4 @@ -import { action, computed, observable } from "mobx"; +import { action, computed, makeObservable, observable } from "mobx"; import type { PropsWithChildren } from "react"; import { createContext, useContext, useMemo } from "react"; import type { Node } from "prosemirror-model"; @@ -28,6 +28,10 @@ class DocumentContext { @observable headings: Heading[] = []; + constructor() { + makeObservable(this); + } + @computed get hasHeadings() { // Headings inside tables are not listed in the table of contents. @@ -77,7 +81,7 @@ class DocumentContext { /** The ProseMirror document currently held by the editor */ @observable.ref - private editorDoc: Node | undefined; + private editorDoc: Node | undefined = undefined; private updateHeadings() { const currHeadings = this.editor?.getHeadings() ?? []; diff --git a/app/components/ErrorBoundary.tsx b/app/components/ErrorBoundary.tsx index 4243a920db..9bac35ba5e 100644 --- a/app/components/ErrorBoundary.tsx +++ b/app/components/ErrorBoundary.tsx @@ -1,4 +1,4 @@ -import { observable } from "mobx"; +import { makeObservable, observable } from "mobx"; import { observer } from "mobx-react"; import * as React from "react"; import type { TFunction } from "i18next"; @@ -40,7 +40,7 @@ const ERROR_TRACKING_WINDOW_MS = 5 * 60 * 1000; // 5 minutes @observer class ErrorBoundaryClass extends React.Component { @observable - error: Error | null | undefined; + error: Error | null | undefined = undefined; @observable showDetails = false; @@ -48,6 +48,11 @@ class ErrorBoundaryClass extends React.Component { @observable isRepeatedError = false; + constructor(props: Props) { + super(props); + makeObservable(this); + } + componentDidMount() { this.checkForPreviousErrors(); } diff --git a/app/components/ModelSelection.ts b/app/components/ModelSelection.ts index cc11d237f0..c1652b5154 100644 --- a/app/components/ModelSelection.ts +++ b/app/components/ModelSelection.ts @@ -1,4 +1,4 @@ -import { action, computed, observable } from "mobx"; +import { action, computed, makeObservable, observable } from "mobx"; /** * Holds the ephemeral multi-selection state for a single list of models. @@ -10,6 +10,10 @@ import { action, computed, observable } from "mobx"; export class ModelSelection { private ids = observable.set(); + constructor() { + makeObservable(this); + } + /** Ordered identifiers of the list, used to resolve shift-click ranges. */ private order: string[] = []; diff --git a/app/components/Sidebar/components/SidebarExpansionContext.ts b/app/components/Sidebar/components/SidebarExpansionContext.ts index daec363055..cff34538ad 100644 --- a/app/components/Sidebar/components/SidebarExpansionContext.ts +++ b/app/components/Sidebar/components/SidebarExpansionContext.ts @@ -1,4 +1,4 @@ -import { action, observable } from "mobx"; +import { action, makeObservable, observable } from "mobx"; import { createContext, useContext, useEffect, useState } from "react"; import type { NavigationNode } from "@shared/types"; @@ -46,6 +46,10 @@ export class SidebarExpansionState { @observable expandedIds = new Set(); + constructor() { + makeObservable(this); + } + /** * Whether a given node is currently expanded. * diff --git a/app/editor/components/NodeViewRenderer.tsx b/app/editor/components/NodeViewRenderer.tsx index 0b62a423cb..b4e93359fa 100644 --- a/app/editor/components/NodeViewRenderer.tsx +++ b/app/editor/components/NodeViewRenderer.tsx @@ -1,5 +1,5 @@ import { isEqual } from "es-toolkit/compat"; -import { action, computed, observable } from "mobx"; +import { action, computed, makeObservable, observable } from "mobx"; import type { FunctionComponent, ReactNode } from "react"; import { createPortal } from "react-dom"; @@ -27,6 +27,7 @@ export class NodeViewRenderer implements PortalRenderer { props: T ) { this.props = props; + makeObservable(this); } @computed diff --git a/app/editor/extensions/FindAndReplace.tsx b/app/editor/extensions/FindAndReplace.tsx index edb4f3dcf0..7da8cefb53 100644 --- a/app/editor/extensions/FindAndReplace.tsx +++ b/app/editor/extensions/FindAndReplace.tsx @@ -1,5 +1,5 @@ import { escapeRegExp } from "es-toolkit/compat"; -import { observable } from "mobx"; +import { makeObservable, observable } from "mobx"; import type { Node } from "prosemirror-model"; import type { Command } from "prosemirror-state"; import { Plugin, PluginKey } from "prosemirror-state"; @@ -740,6 +740,11 @@ export default class FindAndReplaceExtension extends Extension ); + constructor(options: Partial = {}) { + super(options); + makeObservable(this); + } + @observable private open = false; diff --git a/app/editor/extensions/SelectionToolbar.tsx b/app/editor/extensions/SelectionToolbar.tsx index 3e50ac4d56..e710711abb 100644 --- a/app/editor/extensions/SelectionToolbar.tsx +++ b/app/editor/extensions/SelectionToolbar.tsx @@ -1,4 +1,4 @@ -import { action, observable } from "mobx"; +import { action, makeObservable, observable } from "mobx"; import type { EditorState, Selection } from "prosemirror-state"; import { NodeSelection, Plugin, TextSelection } from "prosemirror-state"; import type { EditorView } from "prosemirror-view"; @@ -42,6 +42,11 @@ export default class SelectionToolbarExtension extends Extension { ]; } + constructor(options: Partial = {}) { + super(options); + makeObservable(this); + } + @observable state: Selection | boolean = false; diff --git a/app/index.tsx b/app/index.tsx index 3b5fc4a48a..461cc162de 100644 --- a/app/index.tsx +++ b/app/index.tsx @@ -48,8 +48,7 @@ if (env.SENTRY_DSN) { } configureMobx({ - // TODO: Enable these options and fix any resulting warnings - // enforceActions: env.isDevelopment ? "always" : "never", + enforceActions: env.isDevelopment ? "observed" : "never", computedRequiresReaction: true, isolateGlobalState: true, }); diff --git a/app/models/ApiKey.ts b/app/models/ApiKey.ts index be39c7e73f..5d8e016a79 100644 --- a/app/models/ApiKey.ts +++ b/app/models/ApiKey.ts @@ -9,6 +9,11 @@ import type { Searchable } from "./interfaces/Searchable"; class ApiKey extends Model implements Searchable { static modelName = "ApiKey"; + constructor(fields: Record, store: Model["store"]) { + super(fields, store); + this.initialize(fields); + } + /** The human-readable name of this API key */ @Field @observable @@ -17,17 +22,14 @@ class ApiKey extends Model implements Searchable { /** A list of scopes that this API key has access to. If empty, the key has full access. */ @Field @observable - scope?: string[]; - + scope?: string[] = undefined; /** An optional datetime that the API key expires. */ @Field @observable - expiresAt?: string; - + expiresAt?: string = undefined; /** Timestamp that the API key was last used. */ @observable - lastActiveAt?: string; - + lastActiveAt?: string = undefined; /** The user who this API key belongs to. */ @Relation(() => User) user: User; diff --git a/app/models/AuthenticationProvider.ts b/app/models/AuthenticationProvider.ts index 2c1c5d804d..071ac94c3f 100644 --- a/app/models/AuthenticationProvider.ts +++ b/app/models/AuthenticationProvider.ts @@ -8,6 +8,11 @@ import type AuthenticationProvidersStore from "~/stores/AuthenticationProvidersS class AuthenticationProvider extends Model { static modelName = "AuthenticationProvider"; + constructor(fields: Record, store: Model["store"]) { + super(fields, store); + this.initialize(fields); + } + displayName: string; name: string; @@ -27,7 +32,7 @@ class AuthenticationProvider extends Model { @Field @observable - settings: AuthenticationProviderSettings | undefined; + settings: AuthenticationProviderSettings | undefined = undefined; @computed get isActive() { diff --git a/app/models/Collection.ts b/app/models/Collection.ts index ca6dd79717..34dc4924f3 100644 --- a/app/models/Collection.ts +++ b/app/models/Collection.ts @@ -1,5 +1,12 @@ import invariant from "invariant"; -import { action, comparer, computed, observable, runInAction } from "mobx"; +import { + action, + comparer, + computed, + observable, + override, + runInAction, +} from "mobx"; import { type CollectionPermission, type FileOperationFormat, @@ -19,6 +26,11 @@ import { AfterChange } from "./decorators/Lifecycle"; export default class Collection extends ParanoidModel { static modelName = "Collection"; + constructor(fields: Record, store: CollectionsStore) { + super(fields, store); + this.initialize(fields); + } + store: CollectionsStore; /** The name of the collection. */ @@ -39,13 +51,11 @@ export default class Collection extends ParanoidModel { /** The color to use for the collection icon and other highlights. */ @Field @observable - color?: string | null; - + color?: string | null = undefined; /** The default permission for workspace users. */ @Field @observable - permission?: CollectionPermission; - + permission?: CollectionPermission = undefined; /** * Whether public sharing is enabled for the collection. Note this can also be disabled at the * workspace level. @@ -77,12 +87,10 @@ export default class Collection extends ParanoidModel { */ @Field @observable - commenting?: boolean | null; - + commenting?: boolean | null = undefined; /** The child documents of the collection. */ @observable - documents?: NavigationNode[]; - + documents?: NavigationNode[] = undefined; /** @deprecated Use path instead. */ @observable url: string; @@ -101,8 +109,7 @@ export default class Collection extends ParanoidModel { * User who archived the collection. */ @observable - archivedBy?: User; - + archivedBy?: User = undefined; @computed get searchContent(): string { return this.name; @@ -214,7 +221,7 @@ export default class Collection extends ParanoidModel { return !!this.archivedAt; } - @computed + @override get isDeleted() { return !!this.deletedAt; } @@ -244,7 +251,7 @@ export default class Collection extends ParanoidModel { }); invariant(res?.data, "Data should be available"); - runInAction("Collection#fetchDocuments", () => { + runInAction(() => { this.documents = res.data; }); } finally { diff --git a/app/models/Comment.ts b/app/models/Comment.ts index cbb9189768..2814ee9823 100644 --- a/app/models/Comment.ts +++ b/app/models/Comment.ts @@ -14,6 +14,11 @@ import Relation from "./decorators/Relation"; class Comment extends Model { static modelName = "Comment"; + constructor(fields: Record, store: Model["store"]) { + super(fields, store); + this.initialize(fields); + } + /** * The Prosemirror data representing the comment content */ @@ -65,8 +70,7 @@ class Comment extends Model { * comment mark to the document, and not otherwise persisted. */ @observable - pendingAnchor?: CommentAnchor; - + pendingAnchor?: CommentAnchor = undefined; /** * The date and time that this comment was resolved, if it has been resolved. */ diff --git a/app/models/Document.ts b/app/models/Document.ts index a95f705849..d11cd36925 100644 --- a/app/models/Document.ts +++ b/app/models/Document.ts @@ -1,7 +1,15 @@ import { addDays, differenceInDays, differenceInSeconds } from "date-fns"; import i18n, { t } from "i18next"; import { capitalize, floor } from "es-toolkit/compat"; -import { action, autorun, comparer, computed, observable, set } from "mobx"; +import { + action, + autorun, + comparer, + computed, + observable, + override, + set, +} from "mobx"; import type { JSONObject, NavigationNode, @@ -42,6 +50,7 @@ export default class Document extends ArchivableModel implements Searchable { constructor(fields: Record, store: DocumentsStore) { super(fields, store); + this.initialize(fields); this.embedsDisabled = Storage.get(`embedsDisabled-${this.id}`) ?? false; @@ -53,14 +62,14 @@ export default class Document extends ArchivableModel implements Searchable { }); } - @observable + // Declared on Model; redeclared here only to give it a default. isSaving = false; @observable - embedsDisabled: boolean; + embedsDisabled = false; @observable - lastViewedAt: string | undefined; + lastViewedAt: string | undefined = undefined; store: DocumentsStore; @@ -119,8 +128,7 @@ export default class Document extends ArchivableModel implements Searchable { */ @Field @observable - collectionId?: string | null; - + collectionId?: string | null = undefined; /** * The collection that this document belongs to. */ @@ -142,15 +150,13 @@ export default class Document extends ArchivableModel implements Searchable { */ @Field @observable - icon?: string | null; - + icon?: string | null = undefined; /** * The color to use for the document icon. */ @Field @observable - color?: string | null; - + color?: string | null = undefined; /** * Whether the document layout is displayed full page width. */ @@ -176,15 +182,14 @@ export default class Document extends ArchivableModel implements Searchable { */ @Field @observable - templateId: string | undefined; + templateId: string | undefined = undefined; /** * The id of the parent document that this is a child of, if any. */ @Field @observable - parentDocumentId: string | undefined; - + parentDocumentId?: string = undefined; /** * Parent document that this is a child of, if any. */ @@ -195,13 +200,12 @@ export default class Document extends ArchivableModel implements Searchable { * The ids of users that have edited this document. */ @observable - collaboratorIds: string[] | undefined; + collaboratorIds: string[] | undefined = undefined; @Relation(() => User) createdBy: User | undefined; @Relation(() => User) - @observable updatedBy: User | undefined; /** @@ -209,11 +213,10 @@ export default class Document extends ArchivableModel implements Searchable { * trash. */ @Relation(() => User) - @observable deletedBy: User | undefined; @observable - publishedAt: string | undefined; + publishedAt: string | undefined = undefined; @observable popularityScore: number; @@ -247,8 +250,7 @@ export default class Document extends ArchivableModel implements Searchable { * Only populated when viewing through a share link. */ @observable - backlinkIds?: string[]; - + backlinkIds?: string[] = undefined; /** * Returns the notifications associated with this document. */ @@ -399,7 +401,7 @@ export default class Document extends ArchivableModel implements Searchable { return !!this.archivedAt; } - @computed + @override get isDeleted(): boolean { return !!this.deletedAt; } diff --git a/app/models/Emoji.ts b/app/models/Emoji.ts index 53672837c2..1aa4394c05 100644 --- a/app/models/Emoji.ts +++ b/app/models/Emoji.ts @@ -7,6 +7,11 @@ import Relation from "./decorators/Relation"; class Emoji extends Model { static modelName = "Emoji"; + constructor(fields: Record, store: Model["store"]) { + super(fields, store); + this.initialize(fields); + } + /** The name of the emoji */ @Field @observable @@ -24,7 +29,6 @@ class Emoji extends Model { /** The user who created this emoji */ @Relation(() => User) - @observable createdBy?: User; /** The ID of the user who created this emoji */ diff --git a/app/models/Event.ts b/app/models/Event.ts index 99205bbb9e..a0a5779601 100644 --- a/app/models/Event.ts +++ b/app/models/Event.ts @@ -8,6 +8,11 @@ import Relation from "./decorators/Relation"; class Event extends Model { static modelName = "Event"; + constructor(fields: Record, store: Model["store"]) { + super(fields, store); + this.initialize(fields); + } + name: string; modelId: string | undefined; diff --git a/app/models/FileOperation.ts b/app/models/FileOperation.ts index e5f380d713..5f0c80b6ce 100644 --- a/app/models/FileOperation.ts +++ b/app/models/FileOperation.ts @@ -16,6 +16,11 @@ import Relation from "./decorators/Relation"; class FileOperation extends Model { static modelName = "FileOperation"; + constructor(fields: Record, store: FileOperationsStore) { + super(fields, store); + this.initialize(fields); + } + store: FileOperationsStore; @observable diff --git a/app/models/Group.ts b/app/models/Group.ts index 4573b95a0e..e496025da2 100644 --- a/app/models/Group.ts +++ b/app/models/Group.ts @@ -24,6 +24,11 @@ interface ExternalGroupInfo { class Group extends Model implements Searchable { static modelName = "Group"; + constructor(fields: Record, store: Model["store"]) { + super(fields, store); + this.initialize(fields); + } + @Field @observable name: string; @@ -33,7 +38,7 @@ class Group extends Model implements Searchable { description: string; @observable - externalId: string | undefined; + externalId: string | undefined = undefined; @observable memberCount: number; @@ -43,7 +48,7 @@ class Group extends Model implements Searchable { disableMentions: boolean; @observable - externalGroup: ExternalGroupInfo | undefined; + externalGroup: ExternalGroupInfo | undefined = undefined; /** * Whether this group's membership is managed by an external authentication provider. diff --git a/app/models/GroupMembership.ts b/app/models/GroupMembership.ts index a23c02f612..390ce5fa97 100644 --- a/app/models/GroupMembership.ts +++ b/app/models/GroupMembership.ts @@ -12,6 +12,11 @@ import NavigableModel from "./base/NavigableModel"; class GroupMembership extends NavigableModel { static modelName = "GroupMembership"; + constructor(fields: Record, store: NavigableModel["store"]) { + super(fields, store); + this.initialize(fields); + } + /** The group ID that this membership is granted to. */ groupId: string; diff --git a/app/models/GroupUser.ts b/app/models/GroupUser.ts index bdd2d1fde5..43fc93589b 100644 --- a/app/models/GroupUser.ts +++ b/app/models/GroupUser.ts @@ -12,6 +12,11 @@ import { observable } from "mobx"; class GroupUser extends Model { static modelName = "GroupUser"; + constructor(fields: Record, store: Model["store"]) { + super(fields, store); + this.initialize(fields); + } + /** The ID of the user. */ userId: string; diff --git a/app/models/Import.ts b/app/models/Import.ts index 81c1f48a08..3a62283ba4 100644 --- a/app/models/Import.ts +++ b/app/models/Import.ts @@ -10,6 +10,11 @@ import Relation from "./decorators/Relation"; class Import extends Model { static modelName = "Import"; + constructor(fields: Record, store: ImportsStore) { + super(fields, store); + this.initialize(fields); + } + store: ImportsStore; /** The name of the import. */ diff --git a/app/models/Integration.ts b/app/models/Integration.ts index 6cae4f043b..06fc902fd8 100644 --- a/app/models/Integration.ts +++ b/app/models/Integration.ts @@ -9,6 +9,11 @@ import Relation from "~/models/decorators/Relation"; class Integration extends Model { static modelName = "Integration"; + constructor(fields: Record, store: Model["store"]) { + super(fields, store); + this.initialize(fields); + } + type: IntegrationType; service: IntegrationService; diff --git a/app/models/Membership.ts b/app/models/Membership.ts index 3d936b5df9..c9f7a22d9a 100644 --- a/app/models/Membership.ts +++ b/app/models/Membership.ts @@ -8,6 +8,11 @@ import Relation from "./decorators/Relation"; class Membership extends Model { static modelName = "Membership"; + constructor(fields: Record, store: Model["store"]) { + super(fields, store); + this.initialize(fields); + } + userId: string; @Relation(() => User, { onDelete: "cascade" }) diff --git a/app/models/Notification.ts b/app/models/Notification.ts index ac982f0eea..c7524934e8 100644 --- a/app/models/Notification.ts +++ b/app/models/Notification.ts @@ -28,6 +28,11 @@ export type NotificationFilter = class Notification extends Model { static modelName = "Notification"; + constructor(fields: Record, store: Model["store"]) { + super(fields, store); + this.initialize(fields); + } + static filterCategories: Record = { all: [], @@ -81,15 +86,13 @@ class Notification extends Model { */ @Field @observable - accessRequestId?: string; - + accessRequestId?: string = undefined; /** * Status of the associated access request. */ @Field @observable - accessRequestStatus?: string; - + accessRequestStatus?: string = undefined; /** * The user that triggered the notification. */ diff --git a/app/models/Pin.ts b/app/models/Pin.ts index 971cd1b7f6..0e81ad20d4 100644 --- a/app/models/Pin.ts +++ b/app/models/Pin.ts @@ -12,6 +12,11 @@ import Relation from "./decorators/Relation"; class Pin extends Model { static modelName = "Pin"; + constructor(fields: Record, store: PinsStore) { + super(fields, store); + this.initialize(fields); + } + store: PinsStore; /** The collection ID that the document is pinned to. If empty the document is pinned to home. */ diff --git a/app/models/Policy.ts b/app/models/Policy.ts index 2fb7b08362..bae9a5817c 100644 --- a/app/models/Policy.ts +++ b/app/models/Policy.ts @@ -7,6 +7,11 @@ import { AfterChange } from "./decorators/Lifecycle"; class Policy extends Model { static modelName = "Policy"; + constructor(fields: Record, store: Model["store"]) { + super(fields, store); + this.initialize(fields); + } + /** * An object containing keys representing abilities and values that are either * a boolean or an array of membership IDs that have provided access to the ability. diff --git a/app/models/Revision.ts b/app/models/Revision.ts index 0696616c8e..b02ab505e2 100644 --- a/app/models/Revision.ts +++ b/app/models/Revision.ts @@ -16,6 +16,11 @@ import { client } from "~/utils/ApiClient"; class Revision extends ParanoidModel { static modelName = "Revision"; + constructor(fields: Record, store: ParanoidModel["store"]) { + super(fields, store); + this.initialize(fields); + } + /** The document ID that the revision is related to */ documentId: string; diff --git a/app/models/SearchQuery.ts b/app/models/SearchQuery.ts index 9091f5d718..5bbd82f5da 100644 --- a/app/models/SearchQuery.ts +++ b/app/models/SearchQuery.ts @@ -4,6 +4,11 @@ import Model from "./base/Model"; class SearchQuery extends Model { static modelName = "Search"; + constructor(fields: Record, store: Model["store"]) { + super(fields, store); + this.initialize(fields); + } + /** * The query string, automatically truncated to 255 characters. */ diff --git a/app/models/Share.ts b/app/models/Share.ts index 4b3d5242d0..76fe11d8a3 100644 --- a/app/models/Share.ts +++ b/app/models/Share.ts @@ -12,6 +12,11 @@ import type { Searchable } from "./interfaces/Searchable"; class Share extends Model implements Searchable { static modelName = "Share"; + constructor(fields: Record, store: SharesStore) { + super(fields, store); + this.initialize(fields); + } + store: SharesStore; @Field @@ -61,7 +66,7 @@ class Share extends Model implements Searchable { documentUrl: string; @observable - lastAccessedAt: string | null | undefined; + lastAccessedAt: string | null | undefined = undefined; @observable url: string; diff --git a/app/models/Star.ts b/app/models/Star.ts index 4c6c76651d..19326cb21b 100644 --- a/app/models/Star.ts +++ b/app/models/Star.ts @@ -9,6 +9,11 @@ import Relation from "./decorators/Relation"; class Star extends Model { static modelName = "Star"; + constructor(fields: Record, store: StarsStore) { + super(fields, store); + this.initialize(fields); + } + /** The sort order of the star */ @Field @observable diff --git a/app/models/Subscription.ts b/app/models/Subscription.ts index 341e3f12c3..93d9124da7 100644 --- a/app/models/Subscription.ts +++ b/app/models/Subscription.ts @@ -12,6 +12,11 @@ import Relation from "./decorators/Relation"; class Subscription extends Model { static modelName = "Subscription"; + constructor(fields: Record, store: Model["store"]) { + super(fields, store); + this.initialize(fields); + } + /** The user ID subscribing */ userId: string; diff --git a/app/models/Team.ts b/app/models/Team.ts index a276fa9032..2a985671bc 100644 --- a/app/models/Team.ts +++ b/app/models/Team.ts @@ -9,6 +9,11 @@ import Field from "./decorators/Field"; class Team extends Model { static modelName = "Team"; + constructor(fields: Record, store: Model["store"]) { + super(fields, store); + this.initialize(fields); + } + @Field @observable name: string; @@ -59,7 +64,7 @@ class Team extends Model { @Field @observable - subdomain: string | null | undefined; + subdomain: string | null | undefined = undefined; @Field @observable @@ -74,14 +79,14 @@ class Team extends Model { preferences: TeamPreferences | null; @observable - domain: string | null | undefined; + domain: string | null | undefined = undefined; @observable url: string; @Field @observable - allowedDomains: string[] | null | undefined; + allowedDomains: string[] | null | undefined = undefined; @computed get signinMethods(): string { diff --git a/app/models/Template.ts b/app/models/Template.ts index b15bc6c178..09d373af7d 100644 --- a/app/models/Template.ts +++ b/app/models/Template.ts @@ -1,6 +1,6 @@ import { addDays } from "date-fns"; import i18n from "i18next"; -import { computed, observable } from "mobx"; +import { computed, observable, override } from "mobx"; import type { ProsemirrorData } from "@shared/types"; import { ProsemirrorDataHelper } from "@shared/utils/ProsemirrorDataHelper"; import { isRTL } from "@shared/utils/rtl"; @@ -17,6 +17,11 @@ import type { Searchable } from "./interfaces/Searchable"; export default class Template extends ParanoidModel implements Searchable { static modelName = "Template"; + constructor(fields: Record, store: TemplatesStore) { + super(fields, store); + this.initialize(fields); + } + store: TemplatesStore; @Field @@ -38,8 +43,7 @@ export default class Template extends ParanoidModel implements Searchable { */ @Field @observable - collectionId?: string | null; - + collectionId?: string | null = undefined; /** * The collection that this template belongs to. */ @@ -58,15 +62,13 @@ export default class Template extends ParanoidModel implements Searchable { */ @Field @observable - icon?: string | null; - + icon?: string | null = undefined; /** * The color to use for the template icon. */ @Field @observable - color?: string | null; - + color?: string | null = undefined; /** * Whether the template layout is displayed full page width. */ @@ -79,7 +81,7 @@ export default class Template extends ParanoidModel implements Searchable { */ @Field @observable - language: string | undefined; + language: string | undefined = undefined; @Relation(() => User) createdBy: User | undefined; @@ -95,7 +97,7 @@ export default class Template extends ParanoidModel implements Searchable { * of the workspace. */ @observable - publishedAt: string | undefined; + publishedAt: string | undefined = undefined; /** * Publishes the template, making it available to other members of the @@ -131,7 +133,7 @@ export default class Template extends ParanoidModel implements Searchable { return `${settingsPath("templates")}/${slugifiedTitle}-${this.urlId}`; } - @computed + @override get isDeleted(): boolean { return !!this.deletedAt; } diff --git a/app/models/Unfurl.ts b/app/models/Unfurl.ts index 717b9f7eb4..2d5b3a38c9 100644 --- a/app/models/Unfurl.ts +++ b/app/models/Unfurl.ts @@ -5,6 +5,11 @@ import Model from "./base/Model"; class Unfurl extends Model { static modelName = "Unfurl"; + constructor(fields: Record, store: Model["store"]) { + super(fields, store); + this.initialize(fields); + } + @observable type: UnfurlType; diff --git a/app/models/User.ts b/app/models/User.ts index c32c76842e..905368d6b1 100644 --- a/app/models/User.ts +++ b/app/models/User.ts @@ -25,6 +25,11 @@ import type { Searchable } from "./interfaces/Searchable"; class User extends ParanoidModel implements Searchable { static modelName = "User"; + constructor(fields: Record, store: ParanoidModel["store"]) { + super(fields, store); + this.initialize(fields); + } + @Field @observable avatarUrl: string; @@ -51,8 +56,7 @@ class User extends ParanoidModel implements Searchable { @Field @observable - timezone?: string; - + timezone?: string = undefined; @observable email: string; @@ -82,7 +86,7 @@ class User extends ParanoidModel implements Searchable { isSuspended: boolean; @observable - invitedById: string | undefined; + invitedById: string | undefined = undefined; /** The user that invited this user, if they were invited. */ @Relation(() => User) diff --git a/app/models/UserMembership.ts b/app/models/UserMembership.ts index 7b9a7b4e66..9847342557 100644 --- a/app/models/UserMembership.ts +++ b/app/models/UserMembership.ts @@ -10,6 +10,11 @@ import NavigableModel from "./base/NavigableModel"; class UserMembership extends NavigableModel { static modelName = "UserMembership"; + constructor(fields: Record, store: UserMembershipsStore) { + super(fields, store); + this.initialize(fields); + } + /** The sort order of the membership (In users sidebar) */ @Field @observable diff --git a/app/models/View.ts b/app/models/View.ts index 522bb56f2c..5c4d4f422c 100644 --- a/app/models/View.ts +++ b/app/models/View.ts @@ -7,6 +7,11 @@ import Relation from "./decorators/Relation"; class View extends Model { static modelName = "View"; + constructor(fields: Record, store: Model["store"]) { + super(fields, store); + this.initialize(fields); + } + documentId: string; @Relation(() => Document) diff --git a/app/models/WebhookSubscription.ts b/app/models/WebhookSubscription.ts index 14b47d912e..57f4faa19d 100644 --- a/app/models/WebhookSubscription.ts +++ b/app/models/WebhookSubscription.ts @@ -8,6 +8,11 @@ import User from "./User"; class WebhookSubscription extends Model implements Searchable { static modelName = "WebhookSubscription"; + constructor(fields: Record, store: Model["store"]) { + super(fields, store); + this.initialize(fields); + } + @Field @observable name: string; diff --git a/app/models/base/Model.test.ts b/app/models/base/Model.test.ts new file mode 100644 index 0000000000..6f091a4772 --- /dev/null +++ b/app/models/base/Model.test.ts @@ -0,0 +1,93 @@ +/* oxlint-disable */ +import { autorun, isAction, isObservableProp } from "mobx"; +import stores from "~/stores"; + +describe("Model observability", () => { + it("annotates fields declared on the base class and on subclasses", () => { + const doc = stores.documents.add({ + id: "aaaaaaaa-1111-1111-1111-111111111111", + title: "hello", + }); + + expect(isObservableProp(doc, "id")).toBe(true); // base Model, in payload + expect(isObservableProp(doc, "isSaving")).toBe(true); // base Model, has a default + expect(isObservableProp(doc, "title")).toBe(true); // subclass, in payload + expect(isObservableProp(doc, "embedsDisabled")).toBe(true); // subclass, has a default + }); + + it("annotates fields omitted from the initial payload", () => { + // A model created from a partial payload, as a list response returns. + const doc = stores.documents.add({ + id: "aaaaaaaa-3333-3333-3333-333333333333", + title: "partial", + }); + + expect(isObservableProp(doc, "fullWidth")).toBe(true); + }); + + it("reacts when a later payload populates an omitted field", () => { + const doc = stores.documents.add({ + id: "aaaaaaaa-5555-5555-5555-555555555555", + title: "partial", + }); + const seen: Array = []; + const dispose = autorun(() => seen.push(doc.fullWidth)); + + // The full payload introduces the field, which must become reactive. + stores.documents.add({ + id: "aaaaaaaa-5555-5555-5555-555555555555", + title: "partial", + fullWidth: false, + }); + + doc.fullWidth = true; + dispose(); + expect(seen).toEqual([undefined, false, true]); + }); + + it("reacts to changes", () => { + const doc = stores.documents.add({ + id: "aaaaaaaa-2222-2222-2222-222222222222", + title: "a", + }); + const seen: string[] = []; + const dispose = autorun(() => seen.push(doc.title)); + doc.title = "b"; + dispose(); + expect(seen).toEqual(["a", "b"]); + }); + + it("annotates computed values inherited from the base class", () => { + const doc = stores.documents.add({ + id: "aaaaaaaa-4444-4444-4444-444444444444", + title: "c", + }); + const seen: boolean[] = []; + const dispose = autorun(() => seen.push(doc.isDeleted)); + doc.deletedAt = "2026-08-18T00:00:00.000Z"; + dispose(); + expect(seen).toEqual([false, true]); + }); + + it("makes store fields observable", () => { + expect(isObservableProp(stores.documents, "isFetching")).toBe(true); + expect(isObservableProp(stores.documents, "backlinks")).toBe(true); + expect(isObservableProp(stores.ui, "theme")).toBe(true); + expect(isObservableProp(stores.auth, "currentUserId")).toBe(true); + }); + + it("annotates actions declared as store fields", () => { + expect(isAction(stores.collections.import)).toBe(true); + expect(isAction(stores.comments.resolve)).toBe(true); + expect(isAction(stores.groupUsers.removeGroupMemberships)).toBe(true); + expect(isAction(stores.imports.cancel)).toBe(true); + expect(isAction(stores.memberships.removeCollectionMemberships)).toBe(true); + expect(isAction(stores.notifications.markAllAsRead)).toBe(true); + expect(isAction(stores.templates.duplicate)).toBe(true); + expect(isAction(Reflect.get(stores.unfurls, "unfurl"))).toBe(true); + expect(isAction(stores.userMemberships.fetchDocumentMemberships)).toBe( + true + ); + expect(isAction(stores.users.invite)).toBe(true); + }); +}); diff --git a/app/models/base/Model.ts b/app/models/base/Model.ts index 0d090571fd..e39b022c11 100644 --- a/app/models/base/Model.ts +++ b/app/models/base/Model.ts @@ -1,5 +1,5 @@ import { isEqual, pick } from "es-toolkit/compat"; -import { observable, action, toJS } from "mobx"; +import { action, makeObservable, observable, toJS } from "mobx"; import type { JSONObject } from "@shared/types"; import type Store from "~/stores/base/Store"; import type { PartialExcept } from "~/types"; @@ -30,10 +30,10 @@ export default abstract class Model { id: string; @observable - isSaving: boolean; + isSaving = false; @observable - isNew: boolean; + isNew = false; @observable createdAt: string; @@ -43,10 +43,36 @@ export default abstract class Model { store: Store; - constructor(fields: Record, store: Store) { + constructor(_fields: Record, store: Store) { this.store = store; + } + + /** + * Applies the initial data and makes the instance observable. + * + * Call this from the constructor of the most-derived class. MobX can only + * annotate fields that already exist on the instance, and a subclass's fields + * do not exist until its own constructor has run. + * + * @param fields the data to construct the model with. + */ + protected initialize(fields: Record) { + for (const field of getFieldsForModel(this)) { + if (field in this) { + continue; + } + + Object.defineProperty(this, field, { + configurable: true, + enumerable: true, + value: undefined, + writable: true, + }); + } + this.updateData(fields); this.isNew = !this.id; + makeObservable(this); this.initialized = true; } @@ -155,6 +181,7 @@ export default abstract class Model { } const previousAttributes = this.toAPI(); + let addedKeys = false; for (const key in data) { try { @@ -166,6 +193,9 @@ export default abstract class Model { if (isEqual(toJS(this[key]), data[key])) { continue; } + // A field declared without a default does not exist until it is first + // assigned, so MobX could not annotate it when the model was created. + addedKeys ||= !(key in this); // @ts-expect-error TODO this[key] = data[key]; } catch (error) { @@ -173,6 +203,12 @@ export default abstract class Model { } } + // Annotate any field that this payload introduced. Re-annotating a field + // that is already observable is a no-op. + if (addedKeys && this.initialized) { + makeObservable(this); + } + this.isNew = false; this.persistedAttributes = this.toAPI(); diff --git a/app/models/base/NavigableModel.ts b/app/models/base/NavigableModel.ts index 9cd01372e4..6edd3b4af9 100644 --- a/app/models/base/NavigableModel.ts +++ b/app/models/base/NavigableModel.ts @@ -11,8 +11,7 @@ export default abstract class NavigableModel extends Model { documentId?: string; @observable - node?: NavigationNode; - + node?: NavigationNode = undefined; /** * Fetches the child documents structure from the server. */ @@ -33,7 +32,7 @@ export default abstract class NavigableModel extends Model { this.isFetching = true; const res = await client.post(options.path, options.params); - runInAction(`${NavigableModel.modelName}#fetchDocuments`, () => { + runInAction(() => { this.node = res.data; }); } finally { diff --git a/app/models/base/ParanoidModel.ts b/app/models/base/ParanoidModel.ts index 6930e28aa3..19697fdbbd 100644 --- a/app/models/base/ParanoidModel.ts +++ b/app/models/base/ParanoidModel.ts @@ -3,7 +3,7 @@ import Model from "./Model"; export default abstract class ParanoidModel extends Model { @observable - deletedAt: string | undefined; + deletedAt: string | undefined = undefined; @computed get isDeleted(): boolean { diff --git a/app/models/oauth/OAuthAuthentication.ts b/app/models/oauth/OAuthAuthentication.ts index 5a9b325ada..c2398ac624 100644 --- a/app/models/oauth/OAuthAuthentication.ts +++ b/app/models/oauth/OAuthAuthentication.ts @@ -9,6 +9,11 @@ import Model from "../base/Model"; class OAuthAuthentication extends Model { static modelName = "OAuthAuthentication"; + constructor(fields: Record, store: Model["store"]) { + super(fields, store); + this.initialize(fields); + } + /** A list of scopes that this authentication has access to */ @Field @observable diff --git a/app/models/oauth/OAuthClient.ts b/app/models/oauth/OAuthClient.ts index d8661880a7..c9c37314ff 100644 --- a/app/models/oauth/OAuthClient.ts +++ b/app/models/oauth/OAuthClient.ts @@ -11,6 +11,11 @@ import Relation from "../decorators/Relation"; class OAuthClient extends ParanoidModel { static modelName = "OAuthClient"; + constructor(fields: Record, store: ParanoidModel["store"]) { + super(fields, store); + this.initialize(fields); + } + /** The human-readable name of this app */ @Field @observable @@ -73,7 +78,7 @@ class OAuthClient extends ParanoidModel { }); invariant(res.data, "Failed to rotate client secret"); - runInAction("OAuthClient#rotateSecret", () => { + runInAction(() => { this.clientSecret = res.data.clientSecret; }); } diff --git a/app/stores/AuthStore.ts b/app/stores/AuthStore.ts index e53886c897..7136702fcd 100644 --- a/app/stores/AuthStore.ts +++ b/app/stores/AuthStore.ts @@ -1,7 +1,14 @@ import * as Sentry from "@sentry/react"; import invariant from "invariant"; import { isNil } from "es-toolkit/compat"; -import { observable, action, computed, autorun, runInAction } from "mobx"; +import { + action, + autorun, + computed, + makeObservable, + observable, + runInAction, +} from "mobx"; import { getCookie, setCookie } from "tiny-cookie"; import { toError } from "@shared/utils/error"; import type { CustomTheme } from "@shared/types"; @@ -42,20 +49,16 @@ export default class AuthStore extends Store { /* The ID of the user that is currently signed in. */ @observable - public currentUserId?: string | null; - + public currentUserId?: string | null = undefined; /* The ID of the team that is currently signed in. */ @observable - public currentTeamId?: string | null; - + public currentTeamId?: string | null = undefined; /* A short-lived token to be used to authenticate with the collaboration server. */ @observable - public collaborationToken?: string | null; - + public collaborationToken?: string | null = undefined; /* When set, the user will be redirected to this URL after logging out. */ @observable - public logoutRedirectUri?: string; - + public logoutRedirectUri?: string = undefined; /* A list of teams that the current user has access to. */ @observable public availableTeams?: { @@ -68,24 +71,23 @@ export default class AuthStore extends Store { /* The authentication provider the user signed in with. */ @observable - public lastSignedIn?: string | null; - + public lastSignedIn?: string | null = undefined; /* Whether the user is currently suspended. */ @observable public isSuspended = false; /* The email address to contact if the user is suspended. */ @observable - public suspendedContactEmail?: string | null; - + public suspendedContactEmail?: string | null = undefined; /* The auth configuration for the current domain. */ @observable - public config: Config | null | undefined; + public config: Config | null | undefined = undefined; rootStore: RootStore; constructor(rootStore: RootStore) { super(rootStore, Team); + makeObservable(this); this.rootStore = rootStore; @@ -210,7 +212,7 @@ export default class AuthStore extends Store { }); invariant(res?.data, "Auth not available"); - runInAction("AuthStore#refresh", () => { + runInAction(() => { const { data } = res; this.addPolicies(res.policies); this.add(data.team); @@ -288,7 +290,7 @@ export default class AuthStore extends Store { @action deleteUser = async (data: { code: string }) => { await client.post(`/users.delete`, data); - runInAction("AuthStore#deleteUser", () => { + runInAction(() => { this.currentUserId = null; this.currentTeamId = null; this.collaborationToken = null; @@ -302,7 +304,7 @@ export default class AuthStore extends Store { deleteTeam = async (data: { code: string }) => { await client.post(`/teams.delete`, data); - runInAction("AuthStore#deleteTeam", () => { + runInAction(() => { this.currentUserId = null; this.currentTeamId = null; this.availableTeams = this.availableTeams?.filter( diff --git a/app/stores/AuthenticationProvidersStore.ts b/app/stores/AuthenticationProvidersStore.ts index 697b408724..4cc18f56dc 100644 --- a/app/stores/AuthenticationProvidersStore.ts +++ b/app/stores/AuthenticationProvidersStore.ts @@ -1,5 +1,5 @@ import { orderBy } from "es-toolkit/compat"; -import { computed } from "mobx"; +import { override } from "mobx"; import AuthenticationProvider from "~/models/AuthenticationProvider"; import type RootStore from "./RootStore"; import Store, { RPCAction } from "./base/Store"; @@ -11,7 +11,7 @@ export default class AuthenticationProvidersStore extends Store { constructor(rootStore: RootStore) { super(rootStore, Collection); + makeObservable(this); } /** @@ -35,7 +36,7 @@ export default class CollectionsStore extends Store { return this.orderedData.filter((c) => c.isActive); } - @computed + @override get orderedData(): Collection[] { let collections = Array.from(this.data.values()); collections = collections @@ -129,7 +130,7 @@ export default class CollectionsStore extends Store { const res = await client.post("/collections.archive", { id: collection.id, }); - runInAction("Collection#archive", () => { + runInAction(() => { invariant(res?.data, "Data should be available"); this.add(res.data); this.addPolicies(res.policies); @@ -141,7 +142,7 @@ export default class CollectionsStore extends Store { const res = await client.post("/collections.restore", { id: collection.id, }); - runInAction("Collection#restore", () => { + runInAction(() => { invariant(res?.data, "Data should be available"); this.add(res.data); this.addPolicies(res.policies); @@ -173,7 +174,7 @@ export default class CollectionsStore extends Store { try { const res = await client.post(`/collections.${request}`, options); invariant(res?.data, "Collection list not available"); - return runInAction("CollectionsStore#fetchNamedPage", () => { + return runInAction(() => { const collections = res.data.map(this.add); this.addPolicies(res.policies); this.isLoaded = true; diff --git a/app/stores/CommentsStore.ts b/app/stores/CommentsStore.ts index cb531c002a..5d44fb6762 100644 --- a/app/stores/CommentsStore.ts +++ b/app/stores/CommentsStore.ts @@ -1,6 +1,6 @@ import invariant from "invariant"; import { compact, differenceBy, keyBy, orderBy, uniq } from "es-toolkit/compat"; -import { action, computed } from "mobx"; +import { action, makeObservable, override } from "mobx"; import Comment from "~/models/Comment"; import { type CommentSortOption, CommentSortType } from "~/types"; import { client } from "~/utils/ApiClient"; @@ -10,6 +10,7 @@ import Store from "./base/Store"; export default class CommentsStore extends Store { constructor(rootStore: RootStore) { super(rootStore, Comment); + makeObservable(this); } /** @@ -146,7 +147,7 @@ export default class CommentsStore extends Store { return this.data.get(res.data.id) as Comment; }; - @computed + @override get orderedData(): Comment[] { return orderBy(Array.from(this.data.values()), "createdAt", "asc"); } diff --git a/app/stores/DialogsStore.ts b/app/stores/DialogsStore.ts index dbc3f6d332..737986be4d 100644 --- a/app/stores/DialogsStore.ts +++ b/app/stores/DialogsStore.ts @@ -1,4 +1,4 @@ -import { observable, action } from "mobx"; +import { action, makeObservable, observable } from "mobx"; import { v4 as uuidv4 } from "uuid"; import * as React from "react"; @@ -20,11 +20,15 @@ type GuideDefinition = { export default class DialogsStore { @observable.shallow - guide: GuideDefinition; + guide: GuideDefinition | undefined = undefined; @observable.shallow modalStack = new Map(); + constructor() { + makeObservable(this); + } + openGuide = ({ title, content, diff --git a/app/stores/DocumentPresenceStore.ts b/app/stores/DocumentPresenceStore.ts index 261844f94d..63b108e35a 100644 --- a/app/stores/DocumentPresenceStore.ts +++ b/app/stores/DocumentPresenceStore.ts @@ -1,4 +1,4 @@ -import { observable, action } from "mobx"; +import { action, makeObservable, observable } from "mobx"; import type { AwarenessChangeEvent } from "~/types"; import type RootStore from "./RootStore"; @@ -16,6 +16,7 @@ export default class PresenceStore { constructor(rootStore: RootStore) { this.rootStore = rootStore; + makeObservable(this); } /** diff --git a/app/stores/DocumentsStore.ts b/app/stores/DocumentsStore.ts index 0d05991bce..42469481b7 100644 --- a/app/stores/DocumentsStore.ts +++ b/app/stores/DocumentsStore.ts @@ -1,6 +1,13 @@ import invariant from "invariant"; import { compact, filter, omitBy, orderBy } from "es-toolkit/compat"; -import { observable, action, computed, runInAction } from "mobx"; +import { + action, + computed, + makeObservable, + observable, + override, + runInAction, +} from "mobx"; import type { DirectionFilter, SortFilter } from "@shared/types"; import { AttachmentPreset, @@ -51,7 +58,7 @@ export default class DocumentsStore extends Store { similar: Map = new Map(); @observable - movingDocumentId: string | null | undefined; + movingDocumentId: string | null | undefined = undefined; importFileTypes: string[] = [ ".md", @@ -83,6 +90,7 @@ export default class DocumentsStore extends Store { constructor(rootStore: RootStore) { super(rootStore, Document); + makeObservable(this); } @computed @@ -312,7 +320,7 @@ export default class DocumentsStore extends Store { const res = await client.post("/relationships.list", { documentId }); invariant(res?.data, "Relationships not available"); - runInAction("DocumentsStore#fetchRelationships", () => { + runInAction(() => { res.data.documents.forEach(this.add); this.addPolicies(res.policies); @@ -357,7 +365,7 @@ export default class DocumentsStore extends Store { }); invariant(res?.data, "Document list not available"); - runInAction("DocumentsStore#fetchChildDocuments", () => { + runInAction(() => { res.data.forEach(this.add); this.addPolicies(res.policies); }); @@ -373,7 +381,7 @@ export default class DocumentsStore extends Store { try { const res = await client.post(`/documents.${request}`, options); invariant(res?.data, "Document list not available"); - return runInAction("DocumentsStore#fetchNamedPage", () => { + return runInAction(() => { const documents = res.data.map(this.add); this.addPolicies(res.policies); this.isLoaded = true; @@ -460,7 +468,7 @@ export default class DocumentsStore extends Store { invariant(res?.data, "Search response should be available"); // add the documents and associated policies to the store - runInAction("DocumentsStore#searchTitles", () => { + runInAction(() => { res.data.forEach(this.add); this.addPolicies(res.policies); }); @@ -491,7 +499,7 @@ export default class DocumentsStore extends Store { invariant(res?.data, "Search response should be available"); // add the documents and associated policies to the store - runInAction("DocumentsStore#search", () => { + runInAction(() => { res.data.forEach((result: SearchResult) => this.add(result.document)); this.addPolicies(res.policies); }); @@ -638,7 +646,7 @@ export default class DocumentsStore extends Store { return this.add(res.data); }; - @action + @override async delete( document: Document, options?: { @@ -683,7 +691,7 @@ export default class DocumentsStore extends Store { const res = await client.post("/documents.archive", { id: document.id, }); - runInAction("Document#archive", () => { + runInAction(() => { invariant(res?.data, "Data should be available"); document.updateData(res.data); this.addPolicies(res.policies); @@ -707,7 +715,7 @@ export default class DocumentsStore extends Store { revisionId: options.revisionId, collectionId: options.collectionId, }); - runInAction("Document#restore", () => { + runInAction(() => { invariant(res?.data, "Data should be available"); document.updateData(res.data); this.addPolicies(res.policies); @@ -730,7 +738,7 @@ export default class DocumentsStore extends Store { ...options, }); - runInAction("Document#unpublish", () => { + runInAction(() => { invariant(res?.data, "Data should be available"); // unpublishing could sometimes detach the document from the collection. // so, get the collection id before data is updated. diff --git a/app/stores/EmojiStore.ts b/app/stores/EmojiStore.ts index 616eb632ab..67c42a536e 100644 --- a/app/stores/EmojiStore.ts +++ b/app/stores/EmojiStore.ts @@ -1,4 +1,4 @@ -import { computed } from "mobx"; +import { override } from "mobx"; import Emoji from "~/models/Emoji"; import naturalSort from "@shared/utils/naturalSort"; import type RootStore from "./RootStore"; @@ -17,7 +17,7 @@ export default class EmojisStore extends Store { super(rootStore, Emoji); } - @computed + @override get orderedData(): Emoji[] { return naturalSort(Array.from(this.data.values()), "name"); } diff --git a/app/stores/GroupMembershipsStore.ts b/app/stores/GroupMembershipsStore.ts index 028968f493..adf3eada94 100644 --- a/app/stores/GroupMembershipsStore.ts +++ b/app/stores/GroupMembershipsStore.ts @@ -1,5 +1,5 @@ import invariant from "invariant"; -import { action, runInAction } from "mobx"; +import { override, runInAction } from "mobx"; import { type CollectionPermission, type DocumentPermission, @@ -26,13 +26,12 @@ export default class GroupMembershipsStore extends Store { * * @param id the ID of the membership to remove. */ - @action + @override remove(id: string, options?: { permanent?: boolean }): void { super.remove(id, options); this.rootStore.policies.removeForMembership(id); } - @action fetchPage = async ({ collectionId, documentId, @@ -42,7 +41,9 @@ export default class GroupMembershipsStore extends Store { collectionId?: string; groupId?: string; }): Promise> => { - this.isFetching = true; + runInAction(() => { + this.isFetching = true; + }); try { const res = collectionId @@ -59,7 +60,7 @@ export default class GroupMembershipsStore extends Store { invariant(res?.data, "Data not available"); let response: PaginatedResponse = []; - runInAction(`GroupMembershipsStore#fetchPage`, () => { + runInAction(() => { res.data.groups?.forEach(this.rootStore.groups.add); res.data.documents?.forEach(this.rootStore.documents.add); response = res.data.groupMemberships.map(this.add); @@ -69,11 +70,13 @@ export default class GroupMembershipsStore extends Store { response[PAGINATION_SYMBOL] = res.pagination; return response; } finally { - this.isFetching = false; + runInAction(() => { + this.isFetching = false; + }); } }; - @action + @override async create({ collectionId, documentId, @@ -102,7 +105,7 @@ export default class GroupMembershipsStore extends Store { return cgm[0]; } - @action + @override async delete({ collectionId, documentId, diff --git a/app/stores/GroupUsersStore.ts b/app/stores/GroupUsersStore.ts index 155980b58e..02edc5b8fe 100644 --- a/app/stores/GroupUsersStore.ts +++ b/app/stores/GroupUsersStore.ts @@ -1,6 +1,6 @@ import invariant from "invariant"; import { filter } from "es-toolkit/compat"; -import { action, runInAction } from "mobx"; +import { action, makeObservable, override, runInAction } from "mobx"; import GroupUser from "~/models/GroupUser"; import type { PaginationParams } from "~/types"; import { GroupPermission } from "@shared/types"; @@ -17,20 +17,22 @@ export default class GroupUsersStore extends Store { constructor(rootStore: RootStore) { super(rootStore, GroupUser); + makeObservable(this); } - @action fetchPage = async ( params: PaginationParams | undefined ): Promise> => { - this.isFetching = true; + runInAction(() => { + this.isFetching = true; + }); try { const res = await client.post(`/groups.memberships`, params); invariant(res?.data, "Data not available"); let response: PaginatedResponse = []; - runInAction(`GroupUsersStore#fetchPage`, () => { + runInAction(() => { res.data.users.forEach(this.rootStore.users.add); response = res.data.groupMemberships.map(this.add); this.isLoaded = true; @@ -39,11 +41,13 @@ export default class GroupUsersStore extends Store { response[PAGINATION_SYMBOL] = res.pagination; return response; } finally { - this.isFetching = false; + runInAction(() => { + this.isFetching = false; + }); } }; - @action + @override async create({ groupId, userId, @@ -60,7 +64,7 @@ export default class GroupUsersStore extends Store { }); invariant(res?.data, "Group Membership data should be available"); - return runInAction(`GroupUsersStore#create`, () => { + return runInAction(() => { res.data.users.forEach(this.rootStore.users.add); res.data.groups.forEach(this.rootStore.groups.add); @@ -69,7 +73,7 @@ export default class GroupUsersStore extends Store { }); } - @action + @override async delete({ groupId, userId }: { groupId: string; userId: string }) { const res = await client.post("/groups.remove_user", { id: groupId, @@ -77,13 +81,13 @@ export default class GroupUsersStore extends Store { }); invariant(res?.data, "Group Membership data should be available"); this.remove(`${userId}-${groupId}`); - runInAction(`GroupUsersStore#delete`, () => { + runInAction(() => { res.data.groups.forEach(this.rootStore.groups.add); this.isLoaded = true; }); } - @action + @override async update({ groupId, userId, @@ -100,7 +104,7 @@ export default class GroupUsersStore extends Store { }); invariant(res?.data, "Group Membership data should be available"); - return runInAction(`GroupUsersStore#update`, () => { + return runInAction(() => { res.data.users.forEach(this.rootStore.users.add); res.data.groups.forEach(this.rootStore.groups.add); diff --git a/app/stores/GroupsStore.ts b/app/stores/GroupsStore.ts index 22bb61c126..5fde01d6e4 100644 --- a/app/stores/GroupsStore.ts +++ b/app/stores/GroupsStore.ts @@ -1,6 +1,6 @@ import invariant from "invariant"; import { filter } from "es-toolkit/compat"; -import { action, runInAction, computed } from "mobx"; +import { override, runInAction } from "mobx"; import naturalSort from "@shared/utils/naturalSort"; import Group from "~/models/Group"; import type { PaginationParams } from "~/types"; @@ -15,21 +15,22 @@ export default class GroupsStore extends Store { super(rootStore, Group); } - @computed + @override get orderedData(): Group[] { return naturalSort(Array.from(this.data.values()), "name"); } - @action fetchPage = async (params: FetchPageParams | undefined): Promise => { - this.isFetching = true; + runInAction(() => { + this.isFetching = true; + }); try { const res = await client.post(`/groups.list`, params); invariant(res?.data, "Data not available"); let models: Group[] = []; - runInAction(`GroupsStore#fetchPage`, () => { + runInAction(() => { this.addPolicies(res.policies); models = res.data.groups.map(this.add); res.data.groupMemberships.forEach(this.rootStore.groupUsers.add); @@ -37,7 +38,9 @@ export default class GroupsStore extends Store { }); return models; } finally { - this.isFetching = false; + runInAction(() => { + this.isFetching = false; + }); } }; diff --git a/app/stores/ImportsStore.ts b/app/stores/ImportsStore.ts index 2bbea994ee..f89bc1a148 100644 --- a/app/stores/ImportsStore.ts +++ b/app/stores/ImportsStore.ts @@ -1,5 +1,5 @@ import invariant from "invariant"; -import { action, runInAction } from "mobx"; +import { action, makeObservable, runInAction } from "mobx"; import Import from "~/models/Import"; import { client } from "~/utils/ApiClient"; import type RootStore from "./RootStore"; @@ -8,6 +8,7 @@ import Store from "./base/Store"; export default class ImportsStore extends Store { constructor(rootStore: RootStore) { super(rootStore, Import); + makeObservable(this); } @action @@ -16,7 +17,7 @@ export default class ImportsStore extends Store { id: importModel.id, }); - runInAction("Import#cancel", () => { + runInAction(() => { invariant(res?.data, "Data should be available"); importModel.updateData(res.data); this.addPolicies(res.policies); diff --git a/app/stores/IntegrationsStore.ts b/app/stores/IntegrationsStore.ts index ac497230c0..6fe88dfbb1 100644 --- a/app/stores/IntegrationsStore.ts +++ b/app/stores/IntegrationsStore.ts @@ -1,4 +1,4 @@ -import { computed } from "mobx"; +import { computed, override } from "mobx"; import { IntegrationService, type IntegrationType } from "@shared/types"; import naturalSort from "@shared/utils/naturalSort"; import type RootStore from "~/stores/RootStore"; @@ -16,7 +16,7 @@ class IntegrationsStore extends Store { ); } - @computed + @override get orderedData(): Integration[] { return naturalSort(Array.from(this.data.values()), "name"); } diff --git a/app/stores/MembershipsStore.ts b/app/stores/MembershipsStore.ts index ee47338436..cba803e3fd 100644 --- a/app/stores/MembershipsStore.ts +++ b/app/stores/MembershipsStore.ts @@ -1,5 +1,5 @@ import invariant from "invariant"; -import { action, runInAction } from "mobx"; +import { action, makeObservable, override, runInAction } from "mobx"; import type { CollectionPermission } from "@shared/types"; import Membership from "~/models/Membership"; import type { PaginationParams } from "~/types"; @@ -16,6 +16,7 @@ export default class MembershipsStore extends Store { constructor(rootStore: RootStore) { super(rootStore, Membership); + makeObservable(this); } /** @@ -23,24 +24,25 @@ export default class MembershipsStore extends Store { * * @param id the ID of the membership to remove. */ - @action + @override remove(id: string, options?: { permanent?: boolean }): void { super.remove(id, options); this.rootStore.policies.removeForMembership(id); } - @action fetchPage = async ( params: (PaginationParams & { id?: string }) | undefined ): Promise> => { - this.isFetching = true; + runInAction(() => { + this.isFetching = true; + }); try { const res = await client.post(`/collections.memberships`, params); invariant(res?.data, "Data not available"); let response: PaginatedResponse = []; - runInAction(`MembershipsStore#fetchPage`, () => { + runInAction(() => { res.data.users.forEach(this.rootStore.users.add); response = res.data.memberships.map(this.add); this.isLoaded = true; @@ -48,11 +50,13 @@ export default class MembershipsStore extends Store { response[PAGINATION_SYMBOL] = res.pagination; return response; } finally { - this.isFetching = false; + runInAction(() => { + this.isFetching = false; + }); } }; - @action + @override async create({ collectionId, userId, @@ -74,7 +78,7 @@ export default class MembershipsStore extends Store { return memberships[0]; } - @action + @override async delete({ collectionId, userId, diff --git a/app/stores/NotificationsStore.ts b/app/stores/NotificationsStore.ts index 244f31d0af..106e5f0924 100644 --- a/app/stores/NotificationsStore.ts +++ b/app/stores/NotificationsStore.ts @@ -1,6 +1,6 @@ import invariant from "invariant"; import { orderBy, sortBy } from "es-toolkit/compat"; -import { action, computed, runInAction } from "mobx"; +import { action, computed, makeObservable, override, runInAction } from "mobx"; import Notification from "~/models/Notification"; import type { PaginationParams } from "~/types"; import { client } from "~/utils/ApiClient"; @@ -12,27 +12,31 @@ export default class NotificationsStore extends Store { constructor(rootStore: RootStore) { super(rootStore, Notification); + makeObservable(this); } - @action fetchPage = async ( options: ({ archived?: boolean } & PaginationParams) | undefined ): Promise => { - this.isFetching = true; + runInAction(() => { + this.isFetching = true; + }); try { const res = await client.post("/notifications.list", options); invariant(res?.data, "Document revisions not available"); let models: Notification[] = []; - runInAction("NotificationsStore#fetchPage", () => { + runInAction(() => { models = res.data.notifications.map(this.add); this.isLoaded = true; }); return models; } finally { - this.isFetching = false; + runInAction(() => { + this.isFetching = false; + }); } }; @@ -45,7 +49,7 @@ export default class NotificationsStore extends Store { viewedAt: new Date().toISOString(), }); - runInAction("NotificationsStore#markAllAsRead", () => { + runInAction(() => { const viewedAt = new Date(); this.data.forEach((notification) => { notification.viewedAt = viewedAt; @@ -62,7 +66,7 @@ export default class NotificationsStore extends Store { archivedAt: new Date().toISOString(), }); - runInAction("NotificationsStore#markAllAsArchived", () => { + runInAction(() => { this.clear(); }); }; @@ -78,7 +82,7 @@ export default class NotificationsStore extends Store { /** * Returns the notifications in order of created date. */ - @computed + @override get orderedData(): Notification[] { return sortBy( orderBy(Array.from(this.data.values()), "createdAt", "desc"), diff --git a/app/stores/PinsStore.ts b/app/stores/PinsStore.ts index 5cedad4087..b4ef681be6 100644 --- a/app/stores/PinsStore.ts +++ b/app/stores/PinsStore.ts @@ -1,5 +1,5 @@ import invariant from "invariant"; -import { action, runInAction, computed } from "mobx"; +import { action, computed, override, runInAction } from "mobx"; import Pin from "~/models/Pin"; import type { PaginationParams } from "~/types"; import { client } from "~/utils/ApiClient"; @@ -52,16 +52,17 @@ export default class PinsStore extends Store { } } - @action fetchPage = async (params?: FetchParams): Promise => { - this.isFetching = true; + runInAction(() => { + this.isFetching = true; + }); try { const res = await client.post(`/pins.list`, params); invariant(res?.data, "Data not available"); let models: Pin[] = []; - runInAction(`PinsStore#fetchPage`, () => { + runInAction(() => { res.data.documents.forEach(this.rootStore.documents.add); models = res.data.pins.map(this.add); this.addPolicies(res.policies); @@ -70,7 +71,9 @@ export default class PinsStore extends Store { return models; } finally { - this.isFetching = false; + runInAction(() => { + this.isFetching = false; + }); } }; @@ -82,7 +85,7 @@ export default class PinsStore extends Store { return this.orderedData.filter((pin) => !pin.collectionId); } - @computed + @override get orderedData(): Pin[] { const pins = Array.from(this.data.values()); diff --git a/app/stores/SharesStore.ts b/app/stores/SharesStore.ts index 781b277403..2ae1c610be 100644 --- a/app/stores/SharesStore.ts +++ b/app/stores/SharesStore.ts @@ -1,6 +1,6 @@ import invariant from "invariant"; import { filter, find, isUndefined, orderBy } from "es-toolkit/compat"; -import { action, computed, observable } from "mobx"; +import { action, computed, makeObservable, observable, override } from "mobx"; import type { NavigationNode, PublicTeam } from "@shared/types"; import type Document from "~/models/Document"; import Share from "~/models/Share"; @@ -25,9 +25,10 @@ export default class SharesStore extends Store { constructor(rootStore: RootStore) { super(rootStore, Share); + makeObservable(this); } - @computed + @override get orderedData(): Share[] { return orderBy(Array.from(this.data.values()), "createdAt", "asc"); } @@ -45,7 +46,7 @@ export default class SharesStore extends Store { this.remove(share.id); }; - @action + @override async create( params: | (PartialExcept & { type: "collection" }) @@ -63,7 +64,7 @@ export default class SharesStore extends Store { return super.create(params); } - @action + @override async fetch(id: string) { const share = this.get(id); const cache = this.sharedCache.get(id); diff --git a/app/stores/StarsStore.ts b/app/stores/StarsStore.ts index e83a43adc5..fce983173c 100644 --- a/app/stores/StarsStore.ts +++ b/app/stores/StarsStore.ts @@ -1,5 +1,5 @@ import invariant from "invariant"; -import { action, runInAction, computed } from "mobx"; +import { override, runInAction } from "mobx"; import Star from "~/models/Star"; import type { PaginationParams } from "~/types"; import { client } from "~/utils/ApiClient"; @@ -11,15 +11,16 @@ export default class StarsStore extends Store { super(rootStore, Star); } - @action fetchPage = async (params?: PaginationParams): Promise => { - this.isFetching = true; + runInAction(() => { + this.isFetching = true; + }); try { const res = await client.post(`/stars.list`, params); invariant(res?.data, "Data not available"); - return runInAction(`StarsStore#fetchPage`, () => { + return runInAction(() => { res.data.documents.forEach(this.rootStore.documents.add); const models = res.data.stars.map(this.add); this.addPolicies(res.policies); @@ -27,11 +28,13 @@ export default class StarsStore extends Store { return models; }); } finally { - this.isFetching = false; + runInAction(() => { + this.isFetching = false; + }); } }; - @computed + @override get orderedData(): Star[] { const stars = Array.from(this.data.values()); diff --git a/app/stores/TemplatesStore.ts b/app/stores/TemplatesStore.ts index 94c65cdb71..780ebfcbb2 100644 --- a/app/stores/TemplatesStore.ts +++ b/app/stores/TemplatesStore.ts @@ -1,5 +1,5 @@ import { filter, orderBy } from "es-toolkit/compat"; -import { action, computed } from "mobx"; +import { action, computed, makeObservable, override } from "mobx"; import { invariant } from "mobx-utils"; import naturalSort from "@shared/utils/naturalSort"; import Template from "~/models/Template"; @@ -10,6 +10,7 @@ import Store from "./base/Store"; export default class TemplatesStore extends Store