diff --git a/app/components/Sidebar/components/HistoryNavigation.tsx b/app/components/Sidebar/components/HistoryNavigation.tsx index ee9af46a63..49a0430489 100644 --- a/app/components/Sidebar/components/HistoryNavigation.tsx +++ b/app/components/Sidebar/components/HistoryNavigation.tsx @@ -92,7 +92,7 @@ function HistoryNavigation(props: React.ComponentProps) { const Navigation = styled(Flex)` position: absolute; inset-inline-end: 12px; - top: 20px; + top: 17px; button { cursor: default; diff --git a/app/components/Switch.tsx b/app/components/Switch.tsx index a1bac9ff45..d24b9c97b5 100644 --- a/app/components/Switch.tsx +++ b/app/components/Switch.tsx @@ -2,6 +2,7 @@ import * as RadixSwitch from "@radix-ui/react-switch"; import { darken } from "polished"; import * as React from "react"; import styled from "styled-components"; +import breakpoint from "styled-components-breakpoint"; import { s } from "@shared/styles"; import { LabelText } from "~/components/Input"; import Text from "~/components/Text"; @@ -67,7 +68,7 @@ function Switch({ className={label ? undefined : className} {...props} > - + ); @@ -128,15 +129,16 @@ const Label = styled.label<{ const HOVER_EXTRA = 3; -const StyledSwitchThumb = styled(RadixSwitch.Thumb)<{ - width: number; - height: number; -}>` +/** Minimum switch size on mobile, so that small switches stay usable by touch. */ +const MOBILE_MIN_WIDTH = 32; +const MOBILE_MIN_HEIGHT = 18; + +const StyledSwitchThumb = styled(RadixSwitch.Thumb)` display: block; - width: ${(props) => props.height - 8}px; - height: ${(props) => props.height - 8}px; + width: calc(var(--switch-height) - 8px); + height: calc(var(--switch-height) - 8px); background-color: white; - border-radius: ${(props) => (props.height - 8) / 2}px; + border-radius: calc((var(--switch-height) - 8px) / 2); transition: transform 0.2s, width 0.2s; @@ -144,11 +146,11 @@ const StyledSwitchThumb = styled(RadixSwitch.Thumb)<{ will-change: transform, width; &[data-state="checked"] { - transform: translateX(${(props) => props.width - props.height}px); + transform: translateX(calc(var(--switch-width) - var(--switch-height))); } [dir="rtl"] &[data-state="checked"] { - transform: translateX(${(props) => -(props.width - props.height)}px); + transform: translateX(calc(var(--switch-height) - var(--switch-width))); } `; @@ -156,17 +158,25 @@ const StyledSwitchRoot = styled(RadixSwitch.Root)<{ width: number; height: number; }>` + --switch-width: ${(props) => Math.max(props.width, MOBILE_MIN_WIDTH)}px; + --switch-height: ${(props) => Math.max(props.height, MOBILE_MIN_HEIGHT)}px; + position: relative; - width: ${(props) => props.width}px; - height: ${(props) => props.height}px; + width: var(--switch-width); + height: var(--switch-height); background-color: ${(props) => props.theme.slate}; - border-radius: ${(props) => props.height}px; + border-radius: var(--switch-height); border: none; cursor: var(--pointer); transition: background-color 0.2s; padding: 0 4px; flex-shrink: 0; + ${(props) => breakpoint("tablet")` + --switch-width: ${props.width}px; + --switch-height: ${props.height}px; + `} + &:focus { box-shadow: 0 0 1px ${s("accent")}; outline: none; @@ -190,12 +200,12 @@ const StyledSwitchRoot = styled(RadixSwitch.Root)<{ } &:hover:not(:disabled) ${StyledSwitchThumb} { - width: ${(props) => props.height - 8 + HOVER_EXTRA}px; + width: calc(var(--switch-height) - 8px + ${HOVER_EXTRA}px); } &:hover:not(:disabled)[data-state="checked"] ${StyledSwitchThumb} { transform: translateX( - ${(props) => props.width - props.height - HOVER_EXTRA}px + calc(var(--switch-width) - var(--switch-height) - ${HOVER_EXTRA}px) ); } @@ -203,7 +213,7 @@ const StyledSwitchRoot = styled(RadixSwitch.Root)<{ &:hover:not(:disabled)[data-state="checked"] ${StyledSwitchThumb} { transform: translateX( - ${(props) => -(props.width - props.height - HOVER_EXTRA)}px + calc(var(--switch-height) - var(--switch-width) + ${HOVER_EXTRA}px) ); } `; diff --git a/app/components/primitives/Drawer.tsx b/app/components/primitives/Drawer.tsx index f1eda8be44..073e23a92c 100644 --- a/app/components/primitives/Drawer.tsx +++ b/app/components/primitives/Drawer.tsx @@ -108,7 +108,9 @@ const StyledContent = styled(m.div)` const StyledInnerContent = styled(Flex)` padding: 6px; - padding-bottom: calc(6px + var(--sab, 0px)); + + /* The safe area inset is zero unless the viewport uses viewport-fit=cover. */ + padding-bottom: max(24px, calc(6px + var(--sab, 0px))); height: 100%; `; diff --git a/app/editor/components/NoticeIcon.tsx b/app/editor/components/NoticeIcon.tsx new file mode 100644 index 0000000000..a7027df84d --- /dev/null +++ b/app/editor/components/NoticeIcon.tsx @@ -0,0 +1,44 @@ +import { DoneIcon, InfoIcon, StarredIcon, WarningIcon } from "outline-icons"; +import styled from "styled-components"; +import { NoticeTypes } from "@shared/editor/nodes/Notice"; +import { s } from "@shared/styles"; + +interface Props { + /** The style of the notice. */ + type: NoticeTypes; +} + +/** + * Renders the icon for a notice style, colored to match the notice in the editor. + * + * @param props the component props. + * @returns the icon element. + */ +export function NoticeIcon({ type }: Props) { + switch (type) { + case NoticeTypes.Success: + return ; + case NoticeTypes.Warning: + return ; + case NoticeTypes.Tip: + return ; + default: + return ; + } +} + +const NoticeInfoIcon = styled(InfoIcon)` + color: ${s("noticeInfoText")}; +`; + +const SuccessIcon = styled(DoneIcon)` + color: ${s("noticeSuccessText")}; +`; + +const NoticeWarningIcon = styled(WarningIcon)` + color: ${s("noticeWarningText")}; +`; + +const TipIcon = styled(StarredIcon)` + color: ${s("noticeTipText")}; +`; diff --git a/app/editor/menus/block.tsx b/app/editor/menus/block.tsx index 7d4fa7e648..55d4404f40 100644 --- a/app/editor/menus/block.tsx +++ b/app/editor/menus/block.tsx @@ -13,13 +13,9 @@ import { TableIcon, TodoListIcon, ImageIcon, - StarredIcon, - WarningIcon, - InfoIcon, AttachmentIcon, CalendarIcon, MathIcon, - DoneIcon, EmbedIcon, CollapseIcon, } from "outline-icons"; @@ -28,10 +24,12 @@ import styled from "styled-components"; import { v4 as uuidv4 } from "uuid"; import type { TFunction } from "i18next"; import Image from "@shared/editor/components/Img"; +import { NoticeTypes } from "@shared/editor/nodes/Notice"; import type { MenuItem } from "@shared/editor/types"; import { MentionType } from "@shared/types"; import { toISODate } from "@shared/utils/date"; import { metaDisplay } from "@shared/utils/keyboard"; +import { NoticeIcon } from "~/editor/components/NoticeIcon"; import Desktop from "~/utils/Desktop"; const Img = styled(Image)` @@ -243,30 +241,30 @@ export default function blockMenuItems( { name: "container_notice", title: t("Info notice"), - icon: , + icon: , keywords: "card callout hint information note", - attrs: { style: "info" }, + attrs: { style: NoticeTypes.Info }, }, { name: "container_notice", title: t("Success notice"), - icon: , + icon: , keywords: "card callout hint", - attrs: { style: "success" }, + attrs: { style: NoticeTypes.Success }, }, { name: "container_notice", title: t("Warning notice"), - icon: , + icon: , keywords: "card callout hint error caution danger alert", - attrs: { style: "warning" }, + attrs: { style: NoticeTypes.Warning }, }, { name: "container_notice", title: t("Tip notice"), - icon: , + icon: , keywords: "card callout hint suggestion", - attrs: { style: "tip" }, + attrs: { style: NoticeTypes.Tip }, }, { name: "separator", diff --git a/app/editor/menus/notice.tsx b/app/editor/menus/notice.tsx index 549e0682cc..96b78ae3f4 100644 --- a/app/editor/menus/notice.tsx +++ b/app/editor/menus/notice.tsx @@ -1,14 +1,9 @@ import { t } from "i18next"; -import { - DoneIcon, - ExpandedIcon, - InfoIcon, - StarredIcon, - WarningIcon, -} from "outline-icons"; +import { ExpandedIcon } from "outline-icons"; import { NoticeTypes } from "@shared/editor/nodes/Notice"; import { findParentNode } from "@shared/editor/queries/findParentNode"; import type { MenuItem, SelectionContext } from "@shared/editor/types"; +import { NoticeIcon } from "~/editor/components/NoticeIcon"; /** * Returns menu items for the notice/callout selection toolbar. @@ -39,25 +34,25 @@ export default function noticeMenuItems(ctx: SelectionContext): MenuItem[] { children: [ { name: NoticeTypes.Info, - icon: , + icon: , label: t("Info notice"), active: () => currentStyle === NoticeTypes.Info, }, { name: NoticeTypes.Success, - icon: , + icon: , label: t("Success notice"), active: () => currentStyle === NoticeTypes.Success, }, { name: NoticeTypes.Warning, - icon: , + icon: , label: t("Warning notice"), active: () => currentStyle === NoticeTypes.Warning, }, { name: NoticeTypes.Tip, - icon: , + icon: , label: t("Tip notice"), active: () => currentStyle === NoticeTypes.Tip, }, diff --git a/app/editor/menus/table.tsx b/app/editor/menus/table.tsx index 8592d6c319..628b8730b7 100644 --- a/app/editor/menus/table.tsx +++ b/app/editor/menus/table.tsx @@ -31,6 +31,7 @@ export default function tableMenuItems(ctx: SelectionContext): MenuItem[] { label: isFullWidth ? t("Default width") : t("Full width"), icon: , attrs: isFullWidth ? { layout: null } : { layout: TableLayout.fullWidth }, + visible: !ctx.isInNotice, }, { name: "distributeColumns", diff --git a/build.js b/build.js index 177135f0c3..1b7361441d 100755 --- a/build.js +++ b/build.js @@ -1,8 +1,18 @@ /* oxlint-disable no-console */ /* oxlint-disable typescript/no-require-imports */ /* oxlint-disable no-undef */ -const { exec } = require("child_process"); -const { readdirSync, existsSync } = require("fs"); +const { exec, spawn } = require("child_process"); +const { + copyFileSync, + existsSync, + mkdirSync, + readdirSync, + rmSync, + statSync, + watch, +} = require("fs"); +const { writeFile } = require("fs/promises"); +const path = require("path"); const getDirectories = (source) => readdirSync(source, { withFileTypes: true }) @@ -38,34 +48,12 @@ async function build() { const d = getDirectories("./plugins"); - // Compile server and shared + // Compile server, shared and plugins in a single SWC process, as process + // startup costs far more than the compilation itself. console.log("Compiling…"); - const swc = (src, out) => - execAsync( - `yarn swc "${src}" -d "${out}" --strip-leading-paths --extensions .ts,.tsx --ignore "**/*.test.ts,**/*.test.tsx,**/__mocks__/**" --quiet` - ); - - await Promise.all([ - swc("./server", "./build/server"), - swc("./shared", "./build/shared"), - ]); - - // SWC's --strip-leading-paths removes only the topmost path segment, so a - // `plugins//server` input keeps `/server/…` and lands correctly - // under a `./build/plugins` output directory. - for (const plugin of d) { - const hasServer = existsSync(`./plugins/${plugin}/server`); - - if (hasServer) { - await swc(`./plugins/${plugin}/server`, "./build/plugins"); - } - - const hasShared = existsSync(`./plugins/${plugin}/shared`); - - if (hasShared) { - await swc(`./plugins/${plugin}/shared`, "./build/plugins"); - } - } + await execAsync( + `node_modules/.bin/swc ./server ./shared ./plugins -d ./build --extensions .ts,.tsx --ignore "**/*.test.ts,**/*.test.tsx,**/__mocks__/**,plugins/*/client/**" --quiet` + ); // Copy static files console.log("Copying static files…"); @@ -91,4 +79,216 @@ async function build() { console.log("Done!"); } -void build(); +/** + * Whether a source file is compiled into the server build. + * @param file {string} path relative to the project root. + * @return {boolean} + */ +function isCompiled(file) { + return ( + /\.tsx?$/.test(file) && + !/\.test\.tsx?$/.test(file) && + !file.split(path.sep).includes("__mocks__") && + !/^plugins[\\/][^\\/]+[\\/]client[\\/]/.test(file) + ); +} + +/** + * The build output path of a source file. + * @param file {string} path relative to the project root. + * @return {string | undefined} the output path, or undefined if the file is not + * part of the build. + */ +function getDest(file) { + if (isCompiled(file)) { + return path.join("build", file.replace(/\.tsx?$/, ".js")); + } + if ( + /^plugins[\\/][^\\/]+[\\/]plugin\.json$/.test(file) || + /^shared[\\/]i18n[\\/]locales[\\/]/.test(file) + ) { + return path.join("build", file); + } + return undefined; +} + +/** + * Builds, then watches the source directories and updates the output of each + * changed, added or removed file. A full build runs again after a failed one. + * When a command is passed it is run, and restarted after each change that + * affects the server. + * @param command {string[]} the command and arguments to run, may be empty. + */ +async function watchSources(command) { + const swc = require("@swc/core"); + const timers = new Map(); + let child; + let restartTimer; + let isBuilt = false; + let isBuilding = false; + let isBuildPending = false; + + const startServer = () => { + // Run in a new process group so the forked service processes are stopped + // together with the master. + child = spawn(command[0], command.slice(1), { + stdio: "inherit", + detached: true, + }); + child.once("exit", (code, signal) => { + child = undefined; + if (signal !== "SIGKILL") { + console.log( + `Server exited with ${signal ?? code}, waiting for changes…` + ); + } + }); + }; + + const stopServer = (callback) => { + if (!child) { + callback?.(); + return; + } + if (callback) { + child.once("exit", callback); + } + process.kill(-child.pid, "SIGKILL"); + }; + + const restartServer = () => { + if (!command.length || !isBuilt) { + return; + } + clearTimeout(restartTimer); + restartTimer = setTimeout(() => { + console.log("Restarting…"); + stopServer(startServer); + }, 100); + }; + + const fullBuild = async () => { + if (isBuilding) { + isBuildPending = true; + return; + } + + isBuilding = true; + try { + await build(); + isBuilt = true; + } catch (err) { + console.error(err.message ?? err); + console.log("Build failed, waiting for changes…"); + } finally { + isBuilding = false; + } + + if (isBuildPending) { + isBuildPending = false; + await fullBuild(); + } else if (isBuilt && command.length) { + startServer(); + } + }; + + const updateFile = async (file) => { + const dest = getDest(file); + if (!dest) { + return false; + } + + if (!isCompiled(file)) { + mkdirSync(path.dirname(dest), { recursive: true }); + copyFileSync(file, dest); + console.log(`Copied ${file}`); + return true; + } + + const start = performance.now(); + try { + const { code } = await swc.transformFile(file); + mkdirSync(path.dirname(dest), { recursive: true }); + await writeFile(dest, code); + console.log( + `Compiled ${file} (${(performance.now() - start).toFixed(1)}ms)` + ); + return true; + } catch (err) { + console.error(err.message ?? err); + return false; + } + }; + + const handleChange = async (file) => { + const stats = statSync(file, { throwIfNoEntry: false }); + let isChanged = false; + + if (!stats) { + // The path of a removed directory maps directly to its output. + const dest = getDest(file) ?? path.join("build", file); + if (existsSync(dest)) { + rmSync(dest, { recursive: true, force: true }); + isChanged = true; + } + } else if (stats.isDirectory()) { + // A directory that was moved in does not emit events for its files. + for (const entry of readdirSync(file, { recursive: true })) { + isChanged = (await updateFile(path.join(file, entry))) || isChanged; + } + } else { + isChanged = await updateFile(file); + } + + // The editor and components are mostly used by the client, so changes + // there are picked up on the next restart. + if (isChanged && !/^shared[\\/](editor|components)[\\/]/.test(file)) { + restartServer(); + } + }; + + for (const dir of ["server", "shared", "plugins"]) { + watch(dir, { recursive: true }, (_event, filename) => { + if (!filename) { + return; + } + if (!isBuilt) { + void fullBuild(); + return; + } + + // Editors can emit several events for one save, so debounce each file. + const file = path.join(dir, filename); + clearTimeout(timers.get(file)); + timers.set( + file, + setTimeout(() => { + timers.delete(file); + void handleChange(file); + }, 50) + ); + }); + } + + watch(".", (_event, filename) => { + if (/^\.env(\.local|\.development)?$/.test(filename ?? "")) { + restartServer(); + } + }); + + for (const signal of ["SIGINT", "SIGTERM"]) { + process.once(signal, () => stopServer(() => process.exit(0))); + } + + await fullBuild(); + console.log("Watching for changes…"); +} + +if (process.argv.includes("--watch")) { + // Arguments after "--" are the command to run, e.g. the server. + const separator = process.argv.indexOf("--"); + const command = separator === -1 ? [] : process.argv.slice(separator + 1); + void watchSources(command); +} else { + void build(); +} diff --git a/package.json b/package.json index 8d3ab33590..63a82a7e1b 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "build": "yarn clean && yarn vite:build && yarn build:i18n && yarn build:server", "start": "node ./build/server/index.js", "dev": "NODE_ENV=development yarn concurrently -n api,collaboration -c \"blue,magenta\" \"node --inspect=0.0.0.0 build/server/index.js --services=cron,collaboration,websockets,admin,web,worker\"", - "dev:backend": "NODE_ENV=development nodemon --quiet --exec \"yarn build:server && yarn dev\" -e js,ts,tsx --watch server --watch shared --watch plugins --watch .env --watch .env.local --watch .env.development --ignore \"shared/components/**/*.tsx?\" --ignore \"plugins/client/**/*.tsx?\" --ignore \"**/*.test.ts\" --ignore data/ --ignore build/ --ignore app/ --ignore \"shared/editor/**\" --ignore server/migrations", + "dev:backend": "NODE_ENV=development node ./build.js --watch -- node --inspect=0.0.0.0 build/server/index.js --services=cron,collaboration,websockets,admin,web,worker", "dev:watch": "NODE_ENV=development yarn concurrently -n backend,frontend \"yarn dev:backend\" \"yarn vite:dev\"", "lint": "oxlint --type-aware app server shared plugins", "lint:changed": "git diff --name-only --diff-filter=ACMRTUXB | grep -E '\\.(js|jsx|ts|tsx)$' | xargs -r oxlint", @@ -52,12 +52,12 @@ "> 0.25%, not dead" ], "dependencies": { - "@aws-sdk/client-s3": "^3.1149.0", + "@aws-sdk/client-s3": "^3.1152.0", "@aws-sdk/cloudfront-signer": "^3.1149.0", - "@aws-sdk/lib-storage": "^3.1149.0", - "@aws-sdk/s3-presigned-post": "^3.1149.0", - "@aws-sdk/s3-request-presigner": "^3.1149.0", - "@aws-sdk/signature-v4-crt": "^3.1149.0", + "@aws-sdk/lib-storage": "^3.1152.0", + "@aws-sdk/s3-presigned-post": "^3.1152.0", + "@aws-sdk/s3-request-presigner": "^3.1152.0", + "@aws-sdk/signature-v4-crt": "^3.1152.0", "@benrbray/prosemirror-math": "^0.2.2", "@bull-board/api": "^6.21.3", "@bull-board/koa": "^6.21.3", @@ -85,7 +85,7 @@ "@koa/router": "^15.7.0", "@koa/send": "^6.0.0", "@linear/sdk": "^97.0.0", - "@modelcontextprotocol/sdk": "^1.31.0", + "@modelcontextprotocol/sdk": "^1.32.1", "@noble/hashes": "^2.4.0", "@node-oauth/oauth2-server": "^5.3.0", "@notionhq/client": "^2.3.0", @@ -121,7 +121,7 @@ "addressparser": "^1.0.1", "async-sema": "^3.1.1", "bull": "^4.16.5", - "chrono-node": "^2.10.1", + "chrono-node": "^2.10.3", "class-validator": "^0.15.1", "command-score": "^0.1.2", "compressorjs": "^1.3.0", @@ -153,7 +153,7 @@ "http-errors": "2.0.1", "https-proxy-agent": "^7.0.6", "i18next": "^22.5.1", - "i18next-fs-backend": "^2.6.8", + "i18next-fs-backend": "^2.6.9", "i18next-http-backend": "^3.0.6", "invariant": "^2.2.4", "ioredis": "^5.11.1", @@ -177,7 +177,7 @@ "lib0": "^0.2.99", "mailparser": "^3.9.28", "mammoth": "^1.11.0", - "markdown-it": "^14.3.2", + "markdown-it": "^14.3.3", "markdown-it-container": "^3.0.0", "markdown-it-emoji": "^3.0.0", "mime-types": "^3.0.2", @@ -270,7 +270,7 @@ "uuid": "^11.1.1", "validator": "13.15.35", "vaul": "^1.1.2", - "vite": "^8.3.2", + "vite": "^8.3.3", "vite-plugin-pwa": "1.3.0", "winston": "^3.17.0", "ws": "^7.5.13", @@ -345,7 +345,6 @@ "ioredis-mock": "^8.13.1", "lint-staged": "^16.4.0", "msw": "^2.15.0", - "nodemon": "^3.1.14", "oxfmt": "0.72.0", "oxlint": "1.81.0", "oxlint-tsgolint": "7.0.2001", diff --git a/plugins/webhooks/server/tasks/DeliverWebhookTask.test.ts b/plugins/webhooks/server/tasks/DeliverWebhookTask.test.ts index ba21f0b824..a7799e850b 100644 --- a/plugins/webhooks/server/tasks/DeliverWebhookTask.test.ts +++ b/plugins/webhooks/server/tasks/DeliverWebhookTask.test.ts @@ -6,16 +6,22 @@ import { type StrictRequest, } from "msw"; import { server } from "@server/test/msw"; -import { WebhookDelivery } from "@server/models"; +import { Revision, WebhookDelivery } from "@server/models"; import { buildCollection, + buildComment, buildDocument, buildPersonalCollection, buildUser, buildWebhookDelivery, buildWebhookSubscription, } from "@server/test/factories"; -import type { DocumentEvent, UserEvent } from "@server/types"; +import type { + CommentEvent, + DocumentEvent, + RevisionEvent, + UserEvent, +} from "@server/types"; import DeliverWebhookTask, { isExpectedNetworkError, } from "./DeliverWebhookTask"; @@ -160,6 +166,89 @@ describe("DeliverWebhookTask", () => { ); }); + test("should include the document collectionId in comment events", async () => { + const user = await buildUser(); + const subscription = await buildWebhookSubscription({ + teamId: user.teamId, + createdById: user.id, + url: "http://example.com", + events: ["*"], + }); + const collection = await buildCollection({ + teamId: user.teamId, + userId: user.id, + }); + const document = await buildDocument({ + teamId: user.teamId, + userId: user.id, + collectionId: collection.id, + }); + const comment = await buildComment({ + userId: user.id, + documentId: document.id, + }); + const captured = captureWebhook("http://example.com"); + + const event: CommentEvent = { + name: "comments.create", + modelId: comment.id, + documentId: document.id, + teamId: user.teamId, + actorId: user.id, + ip, + }; + await new DeliverWebhookTask().perform({ + subscriptionId: subscription.id, + event, + }); + + expect(captured.length).toBe(1); + const parsedBody = JSON.parse(captured[0].body); + expect(parsedBody.payload.id).toBe(comment.id); + expect(parsedBody.payload.model.collectionId).toBe(collection.id); + expect(parsedBody.payload.model.documentId).toBe(document.id); + }); + + test("should include the document collectionId in revision events", async () => { + const user = await buildUser(); + const subscription = await buildWebhookSubscription({ + teamId: user.teamId, + createdById: user.id, + url: "http://example.com", + events: ["*"], + }); + const collection = await buildCollection({ + teamId: user.teamId, + userId: user.id, + }); + const document = await buildDocument({ + teamId: user.teamId, + userId: user.id, + collectionId: collection.id, + }); + const revision = await Revision.buildFromDocument(document).save(); + const captured = captureWebhook("http://example.com"); + + const event: RevisionEvent = { + name: "revisions.create", + modelId: revision.id, + documentId: document.id, + teamId: user.teamId, + actorId: user.id, + ip, + }; + await new DeliverWebhookTask().perform({ + subscriptionId: subscription.id, + event, + }); + + expect(captured.length).toBe(1); + const parsedBody = JSON.parse(captured[0].body); + expect(parsedBody.payload.id).toBe(revision.id); + expect(parsedBody.payload.model.collectionId).toBe(collection.id); + expect(parsedBody.payload.model.documentId).toBe(document.id); + }); + test("should hit the subscription url when the eventing model doesn't exist", async () => { const subscription = await buildWebhookSubscription({ url: "http://example.com", diff --git a/plugins/webhooks/server/tasks/DeliverWebhookTask.ts b/plugins/webhooks/server/tasks/DeliverWebhookTask.ts index 362b306ce7..d1219af8a7 100644 --- a/plugins/webhooks/server/tasks/DeliverWebhookTask.ts +++ b/plugins/webhooks/server/tasks/DeliverWebhookTask.ts @@ -432,15 +432,26 @@ export default class DeliverWebhookTask extends BaseTask { subscription: WebhookSubscription, event: CommentEvent ): Promise { - const model = await Comment.findByPk(event.modelId, { - paranoid: false, - }); + const [model, document] = await Promise.all([ + Comment.findByPk(event.modelId, { + paranoid: false, + }), + Document.unscoped().findOne({ + attributes: ["collectionId"], + where: { id: event.documentId }, + paranoid: false, + }), + ]); + await this.sendWebhook({ event, subscription, payload: { id: event.modelId, - model: model && presentComment(model), + model: model && { + ...presentComment(model), + collectionId: document?.collectionId ?? null, + }, }, }); } @@ -744,7 +755,9 @@ export default class DeliverWebhookTask extends BaseTask { Revision.findByPk(event.modelId, { paranoid: false, }), - Document.findByPk(event.documentId, { + Document.unscoped().findOne({ + attributes: ["collectionId"], + where: { id: event.documentId }, paranoid: false, }), ]); diff --git a/server/commands/documentCreator.ts b/server/commands/documentCreator.ts index 8d4afaf09f..2456e8f72e 100644 --- a/server/commands/documentCreator.ts +++ b/server/commands/documentCreator.ts @@ -139,11 +139,15 @@ export async function authorizeDocumentPublish( }); } - if (document.parentDocumentId) { - const parentDocument = await Document.findByPk(document.parentDocumentId, { - userId: user.id, - transaction, - }); + const parentDocument = document.parentDocumentId + ? await Document.findByPk(document.parentDocumentId, { + userId: user.id, + transaction, + }) + : null; + + // The parent only grants access when it is in the destination collection. + if (parentDocument && parentDocument.collectionId === collection?.id) { authorize(user, "createChildDocument", parentDocument, { collection }); } else { authorize(user, "createDocument", collection); diff --git a/server/emails/templates/BaseEmail.tsx b/server/emails/templates/BaseEmail.tsx index 93ba96b963..a8a9d660ff 100644 --- a/server/emails/templates/BaseEmail.tsx +++ b/server/emails/templates/BaseEmail.tsx @@ -234,6 +234,11 @@ export default abstract class BaseEmail< return ; } + /** The receiving user's language in BCP47 format. */ + private get locale() { + return unicodeCLDRtoBCP47(this.props.language ?? env.DEFAULT_LANGUAGE); + } + /** * Translate a string using the receiving user's language preference. * @@ -244,10 +249,24 @@ export default abstract class BaseEmail< protected t(key: string, options?: Record): string { return i18nT(key, { ...options, - lng: unicodeCLDRtoBCP47(this.props.language ?? env.DEFAULT_LANGUAGE), + lng: this.locale, }) as string; } + /** + * Join a list of items into a single string using the receiving user's + * language preference, e.g. "A, B and C". + * + * @param items The items to join. + * @returns The joined string. + */ + protected formatList(items: string[]): string { + return new Intl.ListFormat(this.locale, { + style: "long", + type: "conjunction", + }).format(items); + } + /** * Returns the subject of the email. * diff --git a/server/emails/templates/DocumentPublishedOrUpdatedEmail.test.ts b/server/emails/templates/DocumentPublishedOrUpdatedEmail.test.ts new file mode 100644 index 0000000000..490ac58c1c --- /dev/null +++ b/server/emails/templates/DocumentPublishedOrUpdatedEmail.test.ts @@ -0,0 +1,95 @@ +import { NotificationEventType } from "@shared/types"; +import { createContext } from "@server/context"; +import mailer from "@server/emails/mailer"; +import env from "@server/env"; +import { Revision } from "@server/models"; +import { buildDocument, buildTeam, buildUser } from "@server/test/factories"; +import { initI18n } from "@server/utils/i18n"; +import DocumentPublishedOrUpdatedEmail from "./DocumentPublishedOrUpdatedEmail"; + +describe("DocumentPublishedOrUpdatedEmail", () => { + beforeAll(async () => { + await initI18n(); + }); + + afterEach(() => { + vi.restoreAllMocks(); + }); + + async function sendEmail( + eventType: + | NotificationEventType.PublishDocument + | NotificationEventType.UpdateDocument, + collaboratorCount: number, + { withActorId = true } = {} + ) { + const spy = vi.spyOn(mailer, "sendMail").mockResolvedValue(undefined); + const team = await buildTeam(); + const [actor, ...others] = await Promise.all( + Array.from({ length: collaboratorCount }, (_, index) => + buildUser({ teamId: team.id, name: `User ${index + 1}` }) + ) + ); + const recipient = await buildUser({ teamId: team.id }); + const document = await buildDocument({ + teamId: team.id, + userId: actor.id, + lastModifiedById: actor.id, + }); + const revision = await Revision.createFromDocument( + createContext({ user: actor }), + document, + [actor.id, ...others.map((user) => user.id)] + ); + + await new DocumentPublishedOrUpdatedEmail({ + to: recipient.email, + userId: recipient.id, + eventType, + revisionId: revision.id, + documentId: document.id, + teamUrl: team.url, + actorId: withActorId ? actor.id : undefined, + actorName: actor.name, + }).send(); + + expect(spy).toHaveBeenCalledTimes(1); + return spy.mock.calls[0][0]; + } + + it("should name the actor when they are the only collaborator", async () => { + const mail = await sendEmail(NotificationEventType.UpdateDocument, 1); + + expect(mail.previewText).toEqual("User 1 updated a document"); + expect(mail.text).toContain("User 1 updated the document"); + }); + + it("should list every collaborator on an update", async () => { + const mail = await sendEmail(NotificationEventType.UpdateDocument, 3); + + expect(mail.previewText).toEqual( + "User 1, User 2, and User 3 updated a document" + ); + expect(mail.text).toContain("User 1, User 2, and User 3 updated the"); + }); + + it("should send from the actor only", async () => { + const mail = await sendEmail(NotificationEventType.UpdateDocument, 2); + + expect(mail.from.name).toEqual(`User 1 via ${env.APP_NAME}`); + }); + + it("should name only the actor on publish", async () => { + const mail = await sendEmail(NotificationEventType.PublishDocument, 2); + + expect(mail.previewText).toEqual("User 1 published a document"); + }); + + it("should name only the actor when the actor ID is missing", async () => { + const mail = await sendEmail(NotificationEventType.UpdateDocument, 2, { + withActorId: false, + }); + + expect(mail.previewText).toEqual("User 1 updated a document"); + }); +}); diff --git a/server/emails/templates/DocumentPublishedOrUpdatedEmail.tsx b/server/emails/templates/DocumentPublishedOrUpdatedEmail.tsx index 3d1ac5068d..4bf61e52b0 100644 --- a/server/emails/templates/DocumentPublishedOrUpdatedEmail.tsx +++ b/server/emails/templates/DocumentPublishedOrUpdatedEmail.tsx @@ -24,6 +24,7 @@ type InputProps = EmailProps & { userId: string; documentId: string; revisionId?: string; + actorId?: string; actorName: string; eventType: | NotificationEventType.PublishDocument @@ -36,6 +37,10 @@ type BeforeSend = { collection: Collection | null; unsubscribeUrl: string; body: string | undefined; + /** Names of everyone who contributed to the revision, actor first. */ + actorNames: string; + /** The number of contributors named in actorNames. */ + actorCount: number; }; type Props = InputProps & BeforeSend; @@ -61,32 +66,28 @@ export default class DocumentPublishedOrUpdatedEmail extends BaseEmail< return false; } - const [collection, team] = await Promise.all([ + const [collection, team, revision] = await Promise.all([ document.$get("collection"), document.$get("team"), + revisionId ? Revision.findByPk(revisionId) : null, ]); let body; - if (revisionId && team?.getPreference(TeamPreference.PreviewsInEmails)) { + if (revision && team?.getPreference(TeamPreference.PreviewsInEmails)) { body = await CacheHelper.getDataOrSet( - `diff:${revisionId}`, + `diff:${revision.id}`, async () => { // generate the diff html for the email - const revision = await Revision.findByPk(revisionId); + const before = await revision.before(); + const content = await DocumentHelper.toEmailDiff(before, revision, { + includeTitle: false, + centered: false, + signedUrls: 4 * Day.seconds, + baseUrl: props.teamUrl, + }); - if (revision) { - const before = await revision.before(); - const content = await DocumentHelper.toEmailDiff(before, revision, { - includeTitle: false, - centered: false, - signedUrls: 4 * Day.seconds, - baseUrl: props.teamUrl, - }); - - // inline all css so that it works in as many email providers as possible. - return content ? await HTMLHelper.inlineCSS(content) : undefined; - } - return; + // inline all css so that it works in as many email providers as possible. + return content ? await HTMLHelper.inlineCSS(content) : undefined; }, 30, 10000 @@ -97,6 +98,7 @@ export default class DocumentPublishedOrUpdatedEmail extends BaseEmail< document, collection, body, + ...(await this.actorNames(props, revision)), unsubscribeUrl: this.unsubscribeUrl(props), }; } @@ -123,9 +125,10 @@ export default class DocumentPublishedOrUpdatedEmail extends BaseEmail< }); } - protected preview({ actorName, eventType }: Props): string { + protected preview({ actorNames, actorCount, eventType }: Props): string { return this.t("{{ actorName }} {{ eventName }} a document", { - actorName, + actorName: actorNames, + count: actorCount, eventName: this.eventName(eventType), }); } @@ -144,7 +147,8 @@ export default class DocumentPublishedOrUpdatedEmail extends BaseEmail< } protected renderAsText({ - actorName, + actorNames, + actorCount, teamUrl, document, collection, @@ -155,7 +159,7 @@ export default class DocumentPublishedOrUpdatedEmail extends BaseEmail< return ` ${this.t("“{{ documentTitle }}” {{ eventName }}", { documentTitle: document.displayTitle, eventName })} -${this.t("{{ actorName }} {{ eventName }} the document “{{ documentTitle }}”", { actorName, eventName, documentTitle: document.displayTitle })}${ +${this.t("{{ actorName }} {{ eventName }} the document “{{ documentTitle }}”", { actorName: actorNames, count: actorCount, eventName, documentTitle: document.displayTitle })}${ collection?.name ? `, ${this.t("in the {{ collectionName }} collection", { collectionName: collection.name })}` : "" @@ -168,7 +172,8 @@ ${this.t("Open Document")}: ${teamUrl}${document.url} protected render(props: Props) { const { document, - actorName, + actorNames, + actorCount, collection, eventType, teamUrl, @@ -194,7 +199,8 @@ ${this.t("Open Document")}: ${teamUrl}${document.url}

{this.t("{{ actorName }} {{ eventName }} the document", { - actorName, + actorName: actorNames, + count: actorCount, eventName, })}{" "} {document.displayTitle} @@ -240,4 +246,35 @@ ${this.t("Open Document")}: ${teamUrl}${document.url} ); } + + /** + * Returns the names of everyone who contributed to an update, with the actor + * first, joined into a single string. + * + * @param props The email props. + * @param revision The revision that triggered the email, if any. + * @returns The joined names and the number of contributors. + */ + private async actorNames( + { actorId, actorName, eventType }: InputProps, + revision: Revision | null + ) { + if ( + !actorId || + !revision || + eventType !== NotificationEventType.UpdateDocument + ) { + return { actorNames: actorName, actorCount: 1 }; + } + + const collaborators = await revision.collaborators; + const names = [ + actorName, + ...collaborators + .filter((user) => user && user.id !== actorId) + .map((user) => user.name), + ]; + + return { actorNames: this.formatList(names), actorCount: names.length }; + } } diff --git a/server/mcp/index.ts b/server/mcp/index.ts index de890cc309..998691f218 100644 --- a/server/mcp/index.ts +++ b/server/mcp/index.ts @@ -57,6 +57,9 @@ export function createMcpServer( }, }, instructions, + + // Tool arguments are flat, so a large element count is never legitimate. + maxToolInputElements: 1000, } ); diff --git a/server/models/Document.ts b/server/models/Document.ts index c12e1f6bdd..2b2ac202b2 100644 --- a/server/models/Document.ts +++ b/server/models/Document.ts @@ -69,6 +69,7 @@ import GroupUser from "./GroupUser"; import Import from "./Import"; import Relationship from "./Relationship"; import Revision from "./Revision"; +import Share from "./Share"; import Star from "./Star"; import Team from "./Team"; import User from "./User"; @@ -1314,6 +1315,17 @@ class Document extends ArchivableModel< this.collectionId = collectionId; } + // A parent outside the destination collection is stale, so publish at the root. + if (this.parentDocumentId && this.collectionId) { + const parentDocument = await Document.unscoped().findByPk( + this.parentDocumentId, + { attributes: ["collectionId"], transaction } + ); + if (parentDocument?.collectionId !== this.collectionId) { + this.parentDocumentId = null; + } + } + if (this.collectionId) { const collection = await Collection.findByPk(this.collectionId, { includeDocumentStructure: true, @@ -1424,6 +1436,20 @@ class Document extends ArchivableModel< if (options.detach) { this.collectionId = null; + this.parentDocumentId = null; + } + + // Withdrawing the document also disables its public share links. + const shares = await Share.findAll({ + where: { + documentId: this.id, + published: true, + revokedAt: { [Op.is]: null }, + }, + transaction, + }); + for (const share of shares) { + await share.updateWithCtx(ctx, { published: false }); } return this.saveWithCtx(ctx, undefined, { name: "unpublish" }); diff --git a/server/models/Revision.ts b/server/models/Revision.ts index c81fc03017..a724532e52 100644 --- a/server/models/Revision.ts +++ b/server/models/Revision.ts @@ -1,4 +1,5 @@ import type { InferAttributes, InferCreationAttributes } from "sequelize"; +import { sortBy } from "es-toolkit/compat"; import { Op } from "sequelize"; import { AllowNull, @@ -123,7 +124,8 @@ class Revision extends ParanoidModel< collaboratorIds: string[]; /** - * Get the collaborators for this revision. + * Get the collaborators for this revision, with the author first and the + * others in the order they were recorded. */ get collaborators() { const otherCollaboratorIds = (this.collaboratorIds ?? []).filter( @@ -141,7 +143,10 @@ class Revision extends ParanoidModel< }, }, paranoid: false, - }).then((others) => [this.user, ...others]); + }).then((others) => [ + this.user, + ...sortBy(others, [(user) => otherCollaboratorIds.indexOf(user.id)]), + ]); } // hooks diff --git a/server/models/helpers/DocumentHelper.test.ts b/server/models/helpers/DocumentHelper.test.ts index b1ebdeaad1..e9e6f7fc7d 100644 --- a/server/models/helpers/DocumentHelper.test.ts +++ b/server/models/helpers/DocumentHelper.test.ts @@ -1369,6 +1369,54 @@ Second notes.` ); }); + it("should resolve anchors for a heading that ends in a number", async () => { + const document = await buildDocument({ + text: `## Setup + +First setup. + +## Setup + +Second setup. + +## Setup 1 + +Third setup.`, + }); + + expect(DocumentHelper.getAnchorContent(document, "h-setup-1")).toBe( + `## Setup + +Second setup.` + ); + expect(DocumentHelper.getAnchorContent(document, "h-setup-1-1")).toBe( + `## Setup 1 + +Third setup.` + ); + }); + + it("should count nested headings when numbering duplicates", async () => { + const document = await buildDocument({ + text: `> ## Notes +> +> Quoted notes. + +## Notes + +Top-level notes.`, + }); + + expect( + DocumentHelper.getAnchorContent(document, "h-notes") + ).toBeUndefined(); + expect(DocumentHelper.getAnchorContent(document, "h-notes-1")).toBe( + `## Notes + +Top-level notes.` + ); + }); + it("should return undefined when no heading matches", async () => { const document = await buildDocument({ text: `## Installation diff --git a/server/models/helpers/DocumentHelper.tsx b/server/models/helpers/DocumentHelper.tsx index 79ae2fe19c..0009e3e8e9 100644 --- a/server/models/helpers/DocumentHelper.tsx +++ b/server/models/helpers/DocumentHelper.tsx @@ -8,7 +8,7 @@ import { ChangesetHelper, type ExtendedChange, } from "@shared/editor/lib/ChangesetHelper"; -import headingToSlug from "@shared/editor/lib/headingToSlug"; +import { HeadingSlugger } 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"; @@ -267,40 +267,34 @@ export class DocumentHelper { const node = DocumentHelper.toProsemirror(document); - // Headings are always top-level nodes, so iterating the document's direct - // children is sufficient to locate the section. const children: Node[] = []; node.content.forEach((child) => children.push(child)); - const previouslySeen: Record = {}; + // Nested headings (eg. in tables) affect the numbering of duplicates, so + // every heading is visited, but a section can only start at a top-level one. + const slugger = new HeadingSlugger(); let startIndex = -1; - let level = 0; - - for (let i = 0; i < children.length; i++) { - const child = children[i]; - if (child.type.name !== "heading") { - continue; + node.forEach((child, _offset, index) => { + if (startIndex !== -1) { + return; } - - // Calculate the heading id using the same de-duplication logic as the - // editor so that anchors to repeated headings resolve correctly. - const slug = headingToSlug(child); - const headingId = - previouslySeen[slug] > 0 - ? headingToSlug(child, previouslySeen[slug]) - : slug; - previouslySeen[slug] = - previouslySeen[slug] !== undefined ? previouslySeen[slug] + 1 : 1; - - if (startIndex === -1 && headingId === id) { - startIndex = i; - level = child.attrs.level; + if (child.type.name === "heading") { + if (slugger.slug(child) === id) { + startIndex = index; + } + return; } - } + child.descendants((nested) => { + if (nested.type.name === "heading") { + slugger.slug(nested); + } + }); + }); if (startIndex === -1) { return undefined; } + const level = children[startIndex].attrs.level; const sectionNodes: Node[] = [children[startIndex]]; for (let i = startIndex + 1; i < children.length; i++) { diff --git a/server/queues/processors/EmailsProcessor.ts b/server/queues/processors/EmailsProcessor.ts index ec3e39642a..a4b2902e2f 100644 --- a/server/queues/processors/EmailsProcessor.ts +++ b/server/queues/processors/EmailsProcessor.ts @@ -47,6 +47,7 @@ export default class EmailsProcessor extends BaseProcessor { revisionId: notification.revisionId, documentId: notification.documentId, teamUrl: notification.team.url, + actorId: notification.actorId, actorName: notification.actor.name, }, { notificationId } diff --git a/server/routes/api/attachments/attachments.test.ts b/server/routes/api/attachments/attachments.test.ts index b52058211e..b2e331809c 100644 --- a/server/routes/api/attachments/attachments.test.ts +++ b/server/routes/api/attachments/attachments.test.ts @@ -613,6 +613,22 @@ describe("#attachments.redirect", () => { expect(res.status).toEqual(302); }); + it("should not cache the redirect for longer than the signed URL is valid", async () => { + const user = await buildUser(); + const attachment = await buildAttachment({ + teamId: user.teamId, + userId: user.id, + }); + const res = await server.post("/api/attachments.redirect", user, { + body: { + id: attachment.id, + }, + redirect: "manual", + }); + expect(res.status).toEqual(302); + expect(res.headers.get("Cache-Control")).toEqual("max-age=150, immutable"); + }); + it("should return a redirect for the attachment if id supplied via query params", async () => { const user = await buildUser(); const attachment = await buildAttachment({ diff --git a/server/routes/api/attachments/attachments.ts b/server/routes/api/attachments/attachments.ts index 0fd3543efc..13b377ccba 100644 --- a/server/routes/api/attachments/attachments.ts +++ b/server/routes/api/attachments/attachments.ts @@ -335,7 +335,7 @@ const handleAttachmentsRedirect = async ( } else { ctx.set( "Cache-Control", - `max-age=${BaseStorage.defaultSignedUrlExpires}, immutable` + `max-age=${BaseStorage.getSignedUrlMinimumLifetime()}, immutable` ); ctx.redirect(await attachment.signedUrl); } diff --git a/server/routes/api/documents/documents.test.ts b/server/routes/api/documents/documents.test.ts index 101fa5e4b9..6c101a7928 100644 --- a/server/routes/api/documents/documents.test.ts +++ b/server/routes/api/documents/documents.test.ts @@ -29,6 +29,7 @@ import { FileOperation, GroupMembership, Relationship, + Share, } from "@server/models"; import { RelationshipType } from "@server/models/Relationship"; import { DocumentHelper } from "@server/models/helpers/DocumentHelper"; @@ -6986,6 +6987,128 @@ describe("#documents.update", () => { expect(res.status).toEqual(403); }); + it("should not allow publishing a child draft into an inaccessible collection", async () => { + const team = await buildTeam(); + const admin = await buildAdmin({ teamId: team.id }); + const user = await buildUser({ teamId: team.id }); + const collection = await buildCollection({ + userId: user.id, + teamId: team.id, + }); + const privateCollection = await buildCollection({ + userId: admin.id, + teamId: team.id, + permission: null, + }); + const parentDocument = await buildDocument({ + userId: user.id, + teamId: team.id, + collectionId: collection.id, + }); + const document = await buildDraftDocument({ + userId: user.id, + teamId: team.id, + collectionId: null, + parentDocumentId: parentDocument.id, + }); + const res = await server.post("/api/documents.update", user, { + body: { + id: document.id, + collectionId: privateCollection.id, + publish: true, + }, + }); + expect(res.status).toEqual(403); + + const reloaded = await Document.unscoped().findByPk(document.id); + expect(reloaded?.publishedAt).toBeNull(); + expect(reloaded?.collectionId).toBeNull(); + }); + + it("should allow publishing a child draft into the parent collection", async () => { + const team = await buildTeam(); + const user = await buildUser({ teamId: team.id }); + const collection = await buildCollection({ + userId: user.id, + teamId: team.id, + }); + const parentDocument = await buildDocument({ + userId: user.id, + teamId: team.id, + collectionId: collection.id, + }); + const document = await buildDraftDocument({ + userId: user.id, + teamId: team.id, + collectionId: null, + parentDocumentId: parentDocument.id, + }); + const res = await server.post("/api/documents.update", user, { + body: { + id: document.id, + collectionId: collection.id, + publish: true, + }, + }); + const body = await res.json(); + expect(res.status).toEqual(200); + expect(body.data.collectionId).toBe(collection.id); + expect(body.data.parentDocumentId).toBe(parentDocument.id); + }); + + it("should publish a child draft at the root of another collection", async () => { + const team = await buildTeam(); + const user = await buildUser({ teamId: team.id }); + const member = await buildUser({ teamId: team.id }); + const collection = await buildCollection({ + userId: user.id, + teamId: team.id, + }); + const otherCollection = await buildCollection({ + userId: user.id, + teamId: team.id, + }); + const parentDocument = await buildDocument({ + userId: user.id, + teamId: team.id, + collectionId: collection.id, + }); + await UserMembership.create({ + userId: member.id, + documentId: parentDocument.id, + permission: DocumentPermission.Read, + createdById: user.id, + }); + const document = await buildDraftDocument({ + userId: user.id, + teamId: team.id, + collectionId: null, + parentDocumentId: parentDocument.id, + }); + const res = await server.post("/api/documents.update", user, { + body: { + id: document.id, + collectionId: otherCollection.id, + publish: true, + }, + }); + expect(res.status).toEqual(200); + + await document.reload(); + expect(document.collectionId).toBe(otherCollection.id); + expect(document.parentDocumentId).toBeNull(); + + await otherCollection.reload(); + expect(otherCollection.documentStructure?.map((node) => node.id)).toContain( + document.id + ); + + const membership = await UserMembership.findOne({ + where: { userId: member.id, documentId: document.id }, + }); + expect(membership).toBeNull(); + }); + it("should fail to update an invalid icon value", async () => { const user = await buildUser(); const document = await buildDocument({ @@ -7715,6 +7838,61 @@ describe("#documents.unpublish", () => { expect(reloaded!.createdById).toEqual(user.id); }); + it("should remove the collection and parent when detaching", async () => { + const user = await buildUser(); + const parentDocument = await buildDocument({ + userId: user.id, + teamId: user.teamId, + }); + const document = await buildDocument({ + userId: user.id, + teamId: user.teamId, + collectionId: parentDocument.collectionId, + parentDocumentId: parentDocument.id, + }); + const res = await server.post("/api/documents.unpublish", user, { + body: { + id: document.id, + detach: true, + }, + }); + expect(res.status).toEqual(200); + + const reloaded = await Document.unscoped().findByPk(document.id); + expect(reloaded?.publishedAt).toBeNull(); + expect(reloaded?.collectionId).toBeNull(); + expect(reloaded?.parentDocumentId).toBeNull(); + }); + + it("should disable public shares when unpublishing a document", async () => { + const user = await buildUser(); + const document = await buildDocument({ + userId: user.id, + teamId: user.teamId, + }); + const share = await buildShare({ + documentId: document.id, + teamId: user.teamId, + userId: user.id, + }); + const res = await server.post("/api/documents.unpublish", user, { + body: { + id: document.id, + }, + }); + expect(res.status).toEqual(200); + + const reloaded = await Share.unscoped().findByPk(share.id); + expect(reloaded!.published).toEqual(false); + + const infoRes = await server.post("/api/shares.info", { + body: { + id: share.id, + }, + }); + expect(infoRes.status).toEqual(404); + }); + it("should unpublish a document with archived children", async () => { const user = await buildUser(); const document = await buildDocument({ diff --git a/server/routes/api/emojis/emojis.ts b/server/routes/api/emojis/emojis.ts index 3f9c1b275e..649074341f 100644 --- a/server/routes/api/emojis/emojis.ts +++ b/server/routes/api/emojis/emojis.ts @@ -105,7 +105,7 @@ router.get( ctx.set( "Cache-Control", - `max-age=${BaseStorage.defaultSignedUrlExpires}, immutable` + `max-age=${BaseStorage.getSignedUrlMinimumLifetime()}, immutable` ); ctx.redirect(await emoji.attachment.signedUrl); } diff --git a/server/routes/api/shares/shares.test.ts b/server/routes/api/shares/shares.test.ts index 480e70cc83..24e33ed928 100644 --- a/server/routes/api/shares/shares.test.ts +++ b/server/routes/api/shares/shares.test.ts @@ -6,6 +6,7 @@ import { UserMembership, Share, ShareSubscription } from "@server/models"; import { buildUser, buildDocument, + buildDraftDocument, buildShare, buildAdmin, buildViewer, @@ -1312,6 +1313,28 @@ describe("#shares.revoke", () => { expect(res.status).toEqual(200); }); + it("should allow author to revoke a share on a draft", async () => { + const user = await buildUser(); + const document = await buildDraftDocument({ + userId: user.id, + teamId: user.teamId, + }); + const share = await buildShare({ + documentId: document.id, + teamId: user.teamId, + userId: user.id, + }); + const res = await server.post("/api/shares.revoke", user, { + body: { + id: share.id, + }, + }); + expect(res.status).toEqual(200); + + const reloaded = await Share.unscoped().findByPk(share.id); + expect(reloaded!.revokedAt).toBeTruthy(); + }); + it("should allow author to revoke collection share", async () => { const user = await buildUser(); const collection = await buildCollection({ diff --git a/server/routes/api/shares/shares.ts b/server/routes/api/shares/shares.ts index 5a22217add..7e1a26ab6c 100644 --- a/server/routes/api/shares/shares.ts +++ b/server/routes/api/shares/shares.ts @@ -429,7 +429,9 @@ router.post( async (ctx: APIContext) => { const { id } = ctx.input.body; const { user } = ctx.state.auth; - const share = await Share.findByPk(id); + const share = await Share.scope({ + method: ["withCollectionPermissions", user.id], + }).findByPk(id); if (!share?.collection && !share?.document) { throw NotFoundError(); diff --git a/server/routes/api/users/users.test.ts b/server/routes/api/users/users.test.ts index ee884ac3eb..fec3e1bd85 100644 --- a/server/routes/api/users/users.test.ts +++ b/server/routes/api/users/users.test.ts @@ -1266,6 +1266,34 @@ describe("#users.update_role", () => { }); expect(res.status).toEqual(400); }); + + it("should return the same error for a user in another team", async () => { + const admin = await buildAdmin(); + const user = await buildAdmin(); + + for (const role of [UserRole.Admin, UserRole.Member]) { + const res = await server.post("/api/users.update_role", admin, { + body: { + id: user.id, + role, + }, + }); + expect(res.status).toEqual(403); + } + expect((await user.reload()).role).toEqual(UserRole.Admin); + }); + + it("should return the same error for an unknown user", async () => { + const admin = await buildAdmin(); + + const res = await server.post("/api/users.update_role", admin, { + body: { + id: faker.string.uuid(), + role: UserRole.Admin, + }, + }); + expect(res.status).toEqual(403); + }); }); describe("#users.promote", () => { diff --git a/server/routes/api/users/users.ts b/server/routes/api/users/users.ts index d1c21b8b34..ca50171450 100644 --- a/server/routes/api/users/users.ts +++ b/server/routes/api/users/users.ts @@ -371,10 +371,11 @@ async function updateRole(ctx: APIContext) { const actor = ctx.state.auth.user; const user = await User.findByPk(userId, { - rejectOnEmpty: true, transaction, lock: transaction.LOCK.UPDATE, }); + authorize(actor, "update", user); + await Team.findByPk(user.teamId, { transaction, lock: transaction.LOCK.UPDATE, diff --git a/server/routes/mcp/index.test.ts b/server/routes/mcp/index.test.ts index 4ecda7c262..5349bf0f01 100644 --- a/server/routes/mcp/index.test.ts +++ b/server/routes/mcp/index.test.ts @@ -199,6 +199,18 @@ describe("POST /mcp/", () => { await user.reload(); expect(user.getFlag(UserFlag.MCP)).toEqual(1); }); + + it("should reject tool arguments with too many elements", async () => { + const { accessToken } = await buildOAuthUser(); + + const res = await callMcpTool(server, accessToken, "list_collections", { + extra: Array.from({ length: 1001 }, (_, i) => i), + }); + expect(res?.result?.isError).toBe(true); + expect(res?.result?.content?.[0]?.text).toContain( + "more than the maximum of 1000 elements" + ); + }); }); describe("resources", () => { diff --git a/server/storage/files/BaseStorage.test.ts b/server/storage/files/BaseStorage.test.ts index 24fa366841..47202fa9f5 100644 --- a/server/storage/files/BaseStorage.test.ts +++ b/server/storage/files/BaseStorage.test.ts @@ -129,6 +129,43 @@ describe("BaseStorage", () => { }); }); + describe("getSignedUrlMinimumLifetime", () => { + afterEach(() => { + vi.useRealTimers(); + }); + + it("should return half of the default lifetime", () => { + expect(BaseStorage.getSignedUrlMinimumLifetime()).toBe( + BaseStorage.defaultSignedUrlExpires / 2 + ); + }); + + it("should subtract the capped window from long lifetimes", () => { + expect(BaseStorage.getSignedUrlMinimumLifetime(Hour.seconds)).toBe( + Hour.seconds - BaseStorage.maxSigningWindow + ); + }); + + it("should return the full lifetime when it is too short to align", () => { + expect(BaseStorage.getSignedUrlMinimumLifetime(1)).toBe(1); + }); + + it("should not exceed the remaining lifetime at the end of a window", () => { + const expiresIn = BaseStorage.defaultSignedUrlExpires; + const now = new Date("2026-04-16T12:07:29.999Z"); + vi.useFakeTimers(); + vi.setSystemTime(now); + + const expiresAt = + MockStorage.signingDateFor(expiresIn).getTime() + expiresIn * 1000; + const remaining = (expiresAt - now.getTime()) / 1000; + + expect( + BaseStorage.getSignedUrlMinimumLifetime(expiresIn) + ).toBeLessThanOrEqual(remaining); + }); + }); + describe("getPresignedPut", () => { it("should return undefined from default implementation", async () => { const storage = new MockStorage(); diff --git a/server/storage/files/BaseStorage.ts b/server/storage/files/BaseStorage.ts index 650d65e50c..6b0dc74b49 100644 --- a/server/storage/files/BaseStorage.ts +++ b/server/storage/files/BaseStorage.ts @@ -31,6 +31,20 @@ export default abstract class BaseStorage { */ public static maxSigningWindow = 15 * Minute.seconds; + /** + * Returns the number of seconds that a signed URL is always valid for, after + * signing time alignment. Use this as the upper limit when a response that + * points to a signed URL is cached. + * + * @param expiresIn The number of seconds until the signed URL expires. + * @returns The minimum number of seconds the signed URL is valid for. + */ + public static getSignedUrlMinimumLifetime( + expiresIn = BaseStorage.defaultSignedUrlExpires + ): number { + return expiresIn - BaseStorage.getSigningWindow(expiresIn); + } + /** * Rounds the current time down to a fixed window so that repeated signatures * of the same file produce an identical URL. Without this every signature is @@ -46,10 +60,7 @@ export default abstract class BaseStorage { * @returns The timestamp to sign with. */ protected static getSigningDate(expiresIn: number): Date { - const window = Math.min( - BaseStorage.maxSigningWindow, - Math.floor(expiresIn / 2) - ); + const window = BaseStorage.getSigningWindow(expiresIn); if (window < 1) { return new Date(); @@ -387,4 +398,15 @@ export default abstract class BaseStorage { "image/gif", "image/webp", ]; + + /** + * Returns the number of seconds that the signing timestamp is held constant + * for a signed URL with the given lifetime. + * + * @param expiresIn The number of seconds until the signed URL expires. + * @returns The window in seconds, or 0 if the lifetime is too short to align. + */ + private static getSigningWindow(expiresIn: number): number { + return Math.min(BaseStorage.maxSigningWindow, Math.floor(expiresIn / 2)); + } } diff --git a/shared/editor/commands/table.ts b/shared/editor/commands/table.ts index af233e9062..3850f9c611 100644 --- a/shared/editor/commands/table.ts +++ b/shared/editor/commands/table.ts @@ -112,10 +112,18 @@ export function createTable({ /** The widths of each column in the table. */ colWidth: number; }): Command { - return (state, dispatch) => { + return (state, dispatch, view) => { if (dispatch) { const offset = state.tr.selection.anchor + 1; - const nodes = createTableInner(state, rowsCount, colsCount, colWidth); + const { $from } = state.selection; + + // Fit the columns to the block, which is narrower in a notice or list. + const block = $from.depth > 0 ? view?.nodeDOM($from.before()) : null; + const width = + block instanceof HTMLElement && block.clientWidth + ? Math.min(colWidth, Math.floor(block.clientWidth / colsCount)) + : colWidth; + const nodes = createTableInner(state, rowsCount, colsCount, width); const tr = state.tr.replaceSelectionWith(nodes).scrollIntoView(); const resolvedPos = tr.doc.resolve(offset); tr.setSelection(TextSelection.near(resolvedPos)); diff --git a/shared/editor/components/Styles.ts b/shared/editor/components/Styles.ts index 8a94049be2..6f847f2bbf 100644 --- a/shared/editor/components/Styles.ts +++ b/shared/editor/components/Styles.ts @@ -1,9 +1,10 @@ -import { lighten, transparentize } from "polished"; +import { lighten, mix, transparentize } from "polished"; import type { DefaultTheme } from "styled-components"; import styled, { css, keyframes } from "styled-components"; import { HEADER_HEIGHT } from "../../constants"; import { breakpoints, hover } from "../../styles"; import { light } from "../../styles/theme"; +import { blendColors } from "../../utils/color"; import { EditorStyleHelper } from "../styles/EditorStyleHelper"; import { videoStyle } from "./Video"; @@ -86,6 +87,42 @@ const diagramTheme = (theme: DefaultTheme) => css` --pele-font-mono: ${theme.fontFamilyMono}; `; +/** + * Builds the colors of a notice block from its base and text colors. The tint + * is not opaque, so colors for content in the notice are blended onto it. + * + * @param theme the current theme. + * @param base the base color of the notice. + * @param text the color of the notice text and icon. + * @returns the css for the notice colors. + */ +const noticeColors = (theme: DefaultTheme, base: string, text: string) => { + const opacity = theme.isDark ? 0.15 : 0.08; + const background = mix(opacity, base, theme.background); + const blend = (value: string) => + blendColors(value, background, theme.isDark ? "screen" : "multiply"); + const divider = blend(theme.divider); + + return css` + background: ${transparentize(1 - opacity, base)}; + border: 1px solid ${transparentize(theme.isDark ? 0.6 : 0.7, base)}; + color: ${text}; + + --notice-background: ${background}; + --notice-divider: ${divider}; + --notice-table-header: ${mix(0.25, divider, background)}; + --notice-code-background: ${blend(theme.codeBackground)}; + --notice-code-border: ${blend(theme.codeBorder)}; + --table-grip: ${divider}; + --table-grip-border: ${background}; + + a, + .${EditorStyleHelper.noticeIcon} { + color: ${text}; + } + `; +}; + const mathStyle = (props: Props) => css` /* Based on https://github.com/benrbray/prosemirror-math/blob/master/style/math.css */ @@ -579,6 +616,134 @@ const textStyle = () => css` } `; +const noticeStyle = () => css` + .${EditorStyleHelper.notice} { + hr:not(.ProseMirror-selectednode)::before { + border-top-color: var(--notice-divider); + } + + code, + pre { + background: var(--notice-code-background); + border-color: var(--notice-code-border); + } + + pre code { + background: none; + } + + .${EditorStyleHelper.codeBlock}.with-line-numbers::after { + background: var(--notice-code-background); + } + + .${EditorStyleHelper.codeBlock}.collapsed::before { + background: linear-gradient( + to bottom, + transparent 0%, + var(--notice-code-background) 70%, + var(--notice-code-background) 100% + ); + } + + @media not print { + .${EditorStyleHelper.mermaidDiagram} { + background: var(--notice-code-background); + border-color: var(--notice-code-border); + --pele-bg: var(--notice-code-background); + } + } + + /* above the scroll shadow of a table that follows it */ + .${EditorStyleHelper.noticeIcon} { + position: relative; + z-index: 21; + } + + /* the scroll area fills the notice padding and icon gutter, which leaves + room for the row controls */ + .${EditorStyleHelper.tableScrollable} { + margin-left: -36px; + margin-right: -10px; + padding-left: 36px; + padding-right: 10px; + } + + /* keep the click area inside the scroll area so that it does not scroll */ + .${EditorStyleHelper.tableAddColumn}:not(.first)::before { + right: -10px; + } + + .${EditorStyleHelper.tableShadowLeft}::before { + left: -36px; + border-left: 36px solid var(--notice-background); + } + + .${EditorStyleHelper.tableShadowRight}::after { + right: -10px; + border-right: 10px solid var(--notice-background); + } + + &:dir(rtl) { + .${EditorStyleHelper.tableScrollable} { + margin-left: -8px; + margin-right: -38px; + padding-left: 8px; + padding-right: 38px; + } + + .${EditorStyleHelper.tableShadowLeft}::before { + left: -8px; + border-left-width: 8px; + } + + .${EditorStyleHelper.tableShadowRight}::after { + right: -38px; + border-right-width: 38px; + } + } + + .${EditorStyleHelper.tableFullWidth} { + transform: none; + + .${EditorStyleHelper.tableScrollable} { + width: auto; + } + + table { + width: 100%; + } + + &.${EditorStyleHelper.tableShadowRight}::after { + left: auto; + } + } + + table, + tr, + td, + th { + border-color: var(--notice-divider); + } + + th { + background: var(--notice-table-header); + } + + .${EditorStyleHelper.tableStickyHeader} > .${EditorStyleHelper.tableScrollable} > table > tbody > tr:first-child > th { + box-shadow: + 0 -1px 0 var(--notice-divider), + 0 1px 0 var(--notice-divider); + } + + td[data-bgcolor], + th[data-bgcolor] { + background: + linear-gradient(var(--cell-bg-color), var(--cell-bg-color)), + linear-gradient(var(--notice-background), var(--notice-background)); + } + } +`; + const style = (props: Props) => css` --font-size-p: var(--font-size-body); --font-size-h1: 28px; @@ -1366,15 +1531,12 @@ ${ display: flex; align-items: center; position: relative; - background: ${transparentize(0.9, props.theme.noticeInfoBackground)}; - border-left: 4px solid ${props.theme.noticeInfoBackground}; - color: ${props.theme.noticeInfoText}; - border-radius: 4px; + ${noticeColors(props.theme, props.theme.noticeInfoBackground, props.theme.noticeInfoText)} + border-radius: ${EditorStyleHelper.blockRadius}; padding: 8px 10px 8px 8px; margin: 8px 0; a { - color: ${props.theme.noticeInfoText}; text-decoration: underline; } @@ -1398,7 +1560,6 @@ ${ height: 24px; align-self: flex-start; margin-right: 4px; - color: ${props.theme.noticeInfoBackground}; } &:dir(rtl) .${EditorStyleHelper.noticeIcon} { @@ -1408,45 +1569,15 @@ ${ } .${EditorStyleHelper.notice}.tip { - background: ${transparentize(0.9, props.theme.noticeTipBackground)}; - border-left: 4px solid ${props.theme.noticeTipBackground}; - color: ${props.theme.noticeTipText}; - - .${EditorStyleHelper.noticeIcon} { - color: ${props.theme.noticeTipBackground}; - } - - a { - color: ${props.theme.noticeTipText}; - } + ${noticeColors(props.theme, props.theme.noticeTipBackground, props.theme.noticeTipText)} } .${EditorStyleHelper.notice}.warning { - background: ${transparentize(0.9, props.theme.noticeWarningBackground)}; - border-left: 4px solid ${props.theme.noticeWarningBackground}; - color: ${props.theme.noticeWarningText}; - - .${EditorStyleHelper.noticeIcon} { - color: ${props.theme.noticeWarningBackground}; - } - - a { - color: ${props.theme.noticeWarningText}; - } + ${noticeColors(props.theme, props.theme.noticeWarningBackground, props.theme.noticeWarningText)} } .${EditorStyleHelper.notice}.success { - background: ${transparentize(0.9, props.theme.noticeSuccessBackground)}; - border-left: 4px solid ${props.theme.noticeSuccessBackground}; - color: ${props.theme.noticeSuccessText}; - - .${EditorStyleHelper.noticeIcon} { - color: ${props.theme.noticeSuccessBackground}; - } - - a { - color: ${props.theme.noticeSuccessText}; - } + ${noticeColors(props.theme, props.theme.noticeSuccessBackground, props.theme.noticeSuccessText)} } blockquote { @@ -1909,7 +2040,7 @@ mark { height: auto; overflow: visible; - &::after { + .${EditorStyleHelper.codeBlockLineNumber} { display: none; } } @@ -1928,41 +2059,45 @@ mark { .${EditorStyleHelper.codeBlock}.with-line-numbers { pre { + // Position line numbers against the block, so they stay in place when + // the code scrolls horizontally. + position: static; padding-left: calc(var(--line-number-gutter-width, 0) * 1em + 1.5em); } - &::after { - content: attr(data-line-numbers); + code { + counter-reset: line; + } + + .${EditorStyleHelper.codeBlockLineNumber} { position: absolute; - padding-left: 0.5em; left: 1px; - top: calc(1px + 0.75em); - width: calc(var(--line-number-gutter-width,0) * 1em + .25em); - word-break: break-all; - white-space: break-spaces; - font-family: ${props.theme.fontFamilyMono}; - line-height: 1.4em; + box-sizing: content-box; + width: calc(var(--line-number-gutter-width, 0) * 1em + .25em); + padding: 0 0.75em 0 0.5em; color: ${props.theme.textTertiary}; background: ${props.theme.codeBackground}; text-align: right; font-variant-numeric: tabular-nums; user-select: none; + pointer-events: none; + + &::before { + counter-increment: line; + content: counter(line); + } } } .${EditorStyleHelper.codeBlock}.collapsed { + overflow: clip; + pre { pointer-events: none; max-height: calc(10 * 1.4em + 0.75em); overflow: hidden; } - &::after { - max-height: calc(10 * 1.4em + 0.75em); - overflow: hidden; - clip-path: inset(0 0 calc(100% - 10 * 1.4em - 0.75em) 0); - } - &::before { content: ""; position: absolute; @@ -1982,17 +2117,13 @@ mark { } @media print { + overflow: visible; + pre { max-height: none; overflow: visible; } - &::after { - max-height: none; - overflow: visible; - clip-path: none; - } - &::before { display: none; } @@ -2242,7 +2373,7 @@ table { height: 4px; display: ${props.readOnly ? "none" : "block"}; border-radius: 100%; - background-color: ${props.theme.divider}; + background-color: var(--table-grip, ${props.theme.divider}); } &:hover { @@ -2287,7 +2418,7 @@ table { height: 4px; display: ${props.readOnly ? "none" : "block"}; border-radius: 100%; - background-color: ${props.theme.divider}; + background-color: var(--table-grip, ${props.theme.divider}); } &:hover { @@ -2329,7 +2460,7 @@ table { left: var(--span-start, 0); width: var(--span-size, 100%); height: 12px; - background: ${props.theme.divider}; + background: var(--table-grip, ${props.theme.divider}); display: ${props.readOnly ? "none" : "block"}; /* above the add column controls so narrow columns stay draggable */ z-index: 2; @@ -2340,7 +2471,7 @@ table { } body.${EditorStyleHelper.tableDragging} &:hover::after { - background: ${props.theme.divider}; + background: var(--table-grip, ${props.theme.divider}); } &.first::after { border-top-left-radius: 3px; @@ -2364,8 +2495,8 @@ table { top: var(--span-start, 0); height: var(--span-size, 100%); width: 12px; - background: ${props.theme.divider}; - border-color: ${props.theme.background}; + background: var(--table-grip, ${props.theme.divider}); + border-color: var(--table-grip-border, ${props.theme.background}); display: ${props.readOnly ? "none" : "block"}; /* above the add row controls so short rows stay draggable */ z-index: 2; @@ -2376,7 +2507,7 @@ table { } body.${EditorStyleHelper.tableDragging} &:hover::after { - background: ${props.theme.divider}; + background: var(--table-grip, ${props.theme.divider}); } &.first::after { border-top-left-radius: 3px; @@ -2395,11 +2526,11 @@ table { &::after { content: ""; cursor: var(--pointer); - background: ${props.theme.divider}; + background: var(--table-grip, ${props.theme.divider}); width: 13px; height: 13px; border-radius: 13px; - border: 2px solid ${props.theme.background}; + border: 2px solid var(--table-grip-border, ${props.theme.background}); position: absolute; top: -18px; left: -18px; @@ -2891,6 +3022,7 @@ li > .${EditorStyleHelper.toggleBlock} { const EditorContainer = styled.div>` ${style} + ${noticeStyle} ${mathStyle} ${codeMarkCursor} ${codeBlockStyle} diff --git a/shared/editor/lib/headingToSlug.test.ts b/shared/editor/lib/headingToSlug.test.ts new file mode 100644 index 0000000000..9172b1fe26 --- /dev/null +++ b/shared/editor/lib/headingToSlug.test.ts @@ -0,0 +1,58 @@ +import { Schema } from "prosemirror-model"; +import headingToSlug, { HeadingSlugger } from "./headingToSlug"; + +const schema = new Schema({ + nodes: { + doc: { content: "block+" }, + heading: { group: "block", content: "inline*" }, + text: { group: "inline" }, + }, +}); + +const heading = (text: string) => + schema.node("heading", null, [schema.text(text)]); + +const slugs = (...titles: string[]) => { + const slugger = new HeadingSlugger(); + return titles.map((title) => slugger.slug(heading(title))); +}; + +describe("headingToSlug", () => { + it("returns a prefixed slug", () => { + expect(headingToSlug(heading("Getting Started"))).toBe("h-getting-started"); + }); + + it("appends the index when it is not zero", () => { + expect(headingToSlug(heading("Notes"), 2)).toBe("h-notes-2"); + }); +}); + +describe("HeadingSlugger", () => { + it("returns the plain slug for unique headings", () => { + expect(slugs("One", "Two")).toEqual(["h-one", "h-two"]); + }); + + it("appends a suffix to repeated headings", () => { + expect(slugs("Notes", "Notes", "Notes")).toEqual([ + "h-notes", + "h-notes-1", + "h-notes-2", + ]); + }); + + it("does not reuse a slug when a heading ends in a number", () => { + expect(slugs("Setup", "Setup", "Setup 1")).toEqual([ + "h-setup", + "h-setup-1", + "h-setup-1-1", + ]); + }); + + it("skips a suffix already used by an earlier heading", () => { + expect(slugs("Setup 1", "Setup", "Setup")).toEqual([ + "h-setup-1", + "h-setup", + "h-setup-2", + ]); + }); +}); diff --git a/shared/editor/lib/headingToSlug.ts b/shared/editor/lib/headingToSlug.ts index bb64b1543e..8b1ae1b7c0 100644 --- a/shared/editor/lib/headingToSlug.ts +++ b/shared/editor/lib/headingToSlug.ts @@ -2,6 +2,48 @@ import { escape } from "es-toolkit/compat"; import type { Node } from "prosemirror-model"; import slugify from "slugify"; +// calculates a unique slug for this heading based on it's text and position +// in the document that is as stable as possible +export default function headingToSlug(node: Node, index = 0) { + const slugified = safeSlugify(node.textContent); + if (index === 0) { + return slugified; + } + return `${slugified}-${index}`; +} + +/** + * Assigns unique slugs to the headings of a document. Call `slug` for each + * heading in document order; repeated headings are given a numeric suffix. + */ +export class HeadingSlugger { + /** + * Returns a slug for the heading that is not already in use. + * + * @param node the heading node. + * @returns the unique slug. + */ + public slug(node: Node): string { + const base = headingToSlug(node); + let index = this.counts.get(base) ?? 0; + let id = headingToSlug(node, index); + + // A heading whose text ends in a number can match a suffixed duplicate. + while (this.used.has(id)) { + index += 1; + id = headingToSlug(node, index); + } + + this.counts.set(base, index + 1); + this.used.add(id); + return id; + } + + private counts = new Map(); + + private used = new Set(); +} + // Slugify, escape, and remove periods from headings so that they are // compatible with both url hashes AND dom ID's (querySelector does not like // ID's that begin with a number or a period, for example). @@ -13,13 +55,3 @@ function safeSlugify(text: string) { }) )}`; } - -// calculates a unique slug for this heading based on it's text and position -// in the document that is as stable as possible -export default function headingToSlug(node: Node, index = 0) { - const slugified = safeSlugify(node.textContent); - if (index === 0) { - return slugified; - } - return `${slugified}-${index}`; -} diff --git a/shared/editor/nodes/CodeFence.ts b/shared/editor/nodes/CodeFence.ts index 07d697512e..6eb9390e68 100644 --- a/shared/editor/nodes/CodeFence.ts +++ b/shared/editor/nodes/CodeFence.ts @@ -195,17 +195,11 @@ function buildCollapseState( const isCollapsed = collapsedBlocks.has(pos); if (isCollapsed) { - const totalLines = (node.textContent.match(/\n/g)?.length ?? 0) + 1; - const gutterWidth = String(totalLines).length; - const lineNumberText = Array.from({ length: totalLines }, (_, i) => - String(i + 1).padStart(gutterWidth, " ") - ).join("\n"); - decorations.push( Decoration.node( pos, pos + node.nodeSize, - { class: "collapsed", "data-line-numbers": lineNumberText }, + { class: "collapsed" }, { collapsed: true } ) ); @@ -298,11 +292,8 @@ export default class CodeFence extends Node { toDOM: (node) => { const classes = [ EditorStyleHelper.codeBlock, - node.attrs.wrap - ? "with-line-wrap" - : this.showLineNumbers - ? "with-line-numbers" - : "", + node.attrs.wrap ? "with-line-wrap" : "", + this.showLineNumbers ? "with-line-numbers" : "", ] .filter(Boolean) .join(" "); diff --git a/shared/editor/nodes/Notice.tsx b/shared/editor/nodes/Notice.tsx index d016da25c0..ffa1e19cfd 100644 --- a/shared/editor/nodes/Notice.tsx +++ b/shared/editor/nodes/Notice.tsx @@ -40,7 +40,7 @@ export default class Notice extends Node { }, }, content: - "(list | blockquote | hr | paragraph | heading | code_block | code_fence | attachment)+", + "(list | blockquote | hr | paragraph | heading | code_block | code_fence | attachment | table)+", group: "block", defining: true, draggable: false, diff --git a/shared/editor/plugins/CodeHighlightingPlugin.ts b/shared/editor/plugins/CodeHighlightingPlugin.ts index 98fea07cd3..20eedd78bf 100644 --- a/shared/editor/plugins/CodeHighlightingPlugin.ts +++ b/shared/editor/plugins/CodeHighlightingPlugin.ts @@ -1,4 +1,4 @@ -import { flattenDeep, padStart } from "es-toolkit/compat"; +import { flattenDeep } from "es-toolkit/compat"; import type { Node } from "prosemirror-model"; import type { Transaction } from "prosemirror-state"; import { Plugin, PluginKey } from "prosemirror-state"; @@ -7,6 +7,7 @@ import type refractorType from "refractor/core"; import { getLoaderForLanguage, getRefractorLangForLanguage } from "../lib/code"; import { isRemoteTransaction } from "../lib/multiplayer"; import { findBlockNodes } from "../queries/findChildren"; +import { EditorStyleHelper } from "../styles/EditorStyleHelper"; type ParsedNode = { text: string; @@ -62,6 +63,36 @@ async function loadLanguage(language: string) { return languagePromises[language]; } +/** + * Create the DOM for a line number. The number itself is a CSS counter, so + * every widget is identical and the view can reuse them as lines change. + * + * @returns the line number element. + */ +function createLineNumber() { + const element = document.createElement("span"); + element.className = EditorStyleHelper.codeBlockLineNumber; + element.setAttribute("aria-hidden", "true"); + return element; +} + +/** + * Create a widget decoration that marks the start of a line in a code block. + * + * @param pos - the position of the start of the line. + * @returns the widget decoration. + */ +function lineNumberWidget(pos: number) { + return Decoration.widget(pos, createLineNumber, { + side: -1, + marks: [], + key: "line-number", + // Keep the widget editable, Chrome otherwise deletes it on Backspace at + // the start of a line instead of the line break. + raw: true, + }); +} + function getDecorations({ doc, name, @@ -109,27 +140,28 @@ function getDecorations({ const lineDecorations = []; if (!cache[block.pos] || !cache[block.pos].node.eq(block.node)) { - if (lineNumbers && !block.node.attrs.wrap) { - const lineCount = - (block.node.textContent.match(/\n/g) || []).length + 1; - const gutterWidth = String(lineCount).length; - - const lineCountText = Array.from({ length: lineCount }) - .map((_, i) => padStart(`${i + 1}`, gutterWidth, " ")) - .join("\n"); + if (lineNumbers) { + const text = block.node.textContent; + const lineStarts = [block.pos + 1]; + for (let i = 0; i < text.length; i++) { + if (text[i] === "\n") { + lineStarts.push(block.pos + 2 + i); + } + } + const gutterWidth = String(lineStarts.length).length; lineDecorations.push( Decoration.node( block.pos, block.pos + block.node.nodeSize, { - "data-line-numbers": `${lineCountText}`, style: `--line-number-gutter-width: ${gutterWidth};`, }, { - key: `line-${lineCount}-gutter`, + key: `line-${gutterWidth}-gutter`, } - ) + ), + ...lineStarts.map(lineNumberWidget) ); } diff --git a/shared/editor/styles/EditorStyleHelper.ts b/shared/editor/styles/EditorStyleHelper.ts index d210380451..9bbe6df45a 100644 --- a/shared/editor/styles/EditorStyleHelper.ts +++ b/shared/editor/styles/EditorStyleHelper.ts @@ -78,6 +78,9 @@ export class EditorStyleHelper { /** Toggle button for collapsible code blocks */ static readonly codeBlockToggle = "code-block-toggle"; + /** Line number shown in the gutter at the start of each code block line */ + static readonly codeBlockLineNumber = "code-block-line-number"; + // Diffs static readonly diffInsertion = "diff-insertion"; diff --git a/shared/i18n/locales/en_US/translation.json b/shared/i18n/locales/en_US/translation.json index 10c62c6334..8cc032e522 100644 --- a/shared/i18n/locales/en_US/translation.json +++ b/shared/i18n/locales/en_US/translation.json @@ -1842,8 +1842,11 @@ "updated": "updated", "“{{ documentTitle }}” {{ eventName }}": "“{{ documentTitle }}” {{ eventName }}", "{{ actorName }} {{ eventName }} a document": "{{ actorName }} {{ eventName }} a document", + "{{ actorName }} {{ eventName }} a document_plural": "{{ actorName }} {{ eventName }} a document", "{{ actorName }} {{ eventName }} the document “{{ documentTitle }}”": "{{ actorName }} {{ eventName }} the document “{{ documentTitle }}”", + "{{ actorName }} {{ eventName }} the document “{{ documentTitle }}”_plural": "{{ actorName }} {{ eventName }} the document “{{ documentTitle }}”", "{{ actorName }} {{ eventName }} the document": "{{ actorName }} {{ eventName }} the document", + "{{ actorName }} {{ eventName }} the document_plural": "{{ actorName }} {{ eventName }} the document", "{{ actorName }} shared “{{ documentTitle }}” with you": "{{ actorName }} shared “{{ documentTitle }}” with you", "{{ actorName }} shared a document": "{{ actorName }} shared a document", "{{ actorName }} shared “{{ documentTitle }}” with you.": "{{ actorName }} shared “{{ documentTitle }}” with you.", diff --git a/shared/styles/theme.ts b/shared/styles/theme.ts index fe2a98cf28..d4ab854c51 100644 --- a/shared/styles/theme.ts +++ b/shared/styles/theme.ts @@ -1,4 +1,4 @@ -import { darken, lighten, transparentize } from "polished"; +import { darken, lighten, mix, saturate, transparentize } from "polished"; import type { DefaultTheme, Colors } from "styled-components"; import breakpoints from "./breakpoints"; @@ -102,14 +102,23 @@ const buildBaseTheme = (input: Partial) => { codeConstant: "#0550ae", codeParameter: colors.lightBlack, codeOperator: "#393a34", - noticeInfoBackground: colors.brand.blue, - noticeInfoText: colors.almostBlack, - noticeTipBackground: "#f5be31", - noticeTipText: colors.almostBlack, - noticeWarningBackground: "#d73a49", - noticeWarningText: colors.almostBlack, + noticeInfoBackground: colors.slate, + noticeInfoText: saturate(0.1, mix(0.5, colors.slate, colors.almostBlack)), + noticeTipBackground: colors.brand.blue, + noticeTipText: saturate( + 0.1, + mix(0.5, colors.brand.blue, colors.almostBlack) + ), + noticeWarningBackground: colors.brand.yellow, + noticeWarningText: saturate( + 0.1, + mix(0.5, colors.brand.yellow, colors.almostBlack) + ), noticeSuccessBackground: colors.brand.green, - noticeSuccessText: colors.almostBlack, + noticeSuccessText: saturate( + 0.1, + mix(0.5, colors.brand.green, colors.almostBlack) + ), tableSelectedBackground: transparentize(0.9, colors.accent), breakpoints, ...colors, @@ -263,10 +272,10 @@ export const buildDarkTheme = (input: Partial): DefaultTheme => { codeAttrValue: "#ce9178", embedBorder: colors.black50, horizontalRule: lighten(0.1, colors.almostBlack), - noticeInfoText: colors.white, - noticeTipText: colors.white, - noticeWarningText: colors.white, - noticeSuccessText: colors.white, + noticeInfoText: mix(0.5, colors.slate, colors.white), + noticeTipText: mix(0.5, colors.brand.blue, colors.white), + noticeWarningText: mix(0.5, colors.brand.yellow, colors.white), + noticeSuccessText: mix(0.5, colors.brand.green, colors.white), progressBarBackground: colors.slate, scrollbarBackground: colors.black, scrollbarThumb: colors.lightBlack, diff --git a/shared/utils/ProsemirrorHelper.test.ts b/shared/utils/ProsemirrorHelper.test.ts index 771837ded0..dd37799cd6 100644 --- a/shared/utils/ProsemirrorHelper.test.ts +++ b/shared/utils/ProsemirrorHelper.test.ts @@ -404,6 +404,20 @@ describe("ProsemirrorHelper", () => { }); describe("getHeadings", () => { + it("gives each heading a unique id", () => { + const node = doc( + heading("Setup", 2), + heading("Setup", 2), + heading("Setup 1", 2) + ); + + expect(ProsemirrorHelper.getHeadings(node).map((h) => h.id)).toEqual([ + "h-setup", + "h-setup-1", + "h-setup-1-1", + ]); + }); + it("marks headings that are nested inside tables", () => { const node = doc( heading("One", 1), diff --git a/shared/utils/ProsemirrorHelper.ts b/shared/utils/ProsemirrorHelper.ts index 3157d5de6e..537b2d0272 100644 --- a/shared/utils/ProsemirrorHelper.ts +++ b/shared/utils/ProsemirrorHelper.ts @@ -1,6 +1,6 @@ import type { Schema } from "prosemirror-model"; import type { Node } from "prosemirror-model"; -import headingToSlug from "../editor/lib/headingToSlug"; +import { HeadingSlugger } from "../editor/lib/headingToSlug"; import textBetween from "../editor/lib/textBetween"; import type { ProsemirrorData } from "../types"; import { hashString } from "./string"; @@ -207,31 +207,16 @@ export class ProsemirrorHelper { } private static getAnchorsForHeadingNodes(doc: Node): NodeAnchor[] { - const previouslySeen: Record = {}; + const slugger = new HeadingSlugger(); const anchors: NodeAnchor[] = []; doc.descendants((node, pos) => { if (node.type.name !== "heading") { return; } - // calculate the optimal id - const slug = headingToSlug(node); - let id = slug; - - // check if we've already used it, and if so how many times? - // Make the new id based on that number ensuring that we have - // unique ID's even when headings are identical - if (previouslySeen[slug] > 0) { - id = headingToSlug(node, previouslySeen[slug]); - } - - // record that we've seen this slug for the next loop - previouslySeen[slug] = - previouslySeen[slug] !== undefined ? previouslySeen[slug] + 1 : 1; - anchors.push({ pos, - id, + id: slugger.slug(node), className: EditorStyleHelper.headingPositionAnchor, }); }); @@ -498,7 +483,7 @@ export class ProsemirrorHelper { */ static getHeadings(doc: Node) { const headings: Heading[] = []; - const previouslySeen: Record = {}; + const slugger = new HeadingSlugger(); let tableEnd = 0; doc.descendants((node, pos) => { @@ -507,25 +492,10 @@ export class ProsemirrorHelper { tableEnd = Math.max(tableEnd, pos + node.nodeSize); } if (node.type.name === "heading") { - // calculate the optimal id - const id = headingToSlug(node); - let name = id; - - // check if we've already used it, and if so how many times? - // Make the new id based on that number ensuring that we have - // unique ID's even when headings are identical - if (previouslySeen[id] > 0) { - name = headingToSlug(node, previouslySeen[id]); - } - - // record that we've seen this id for the next loop - previouslySeen[id] = - previouslySeen[id] !== undefined ? previouslySeen[id] + 1 : 1; - headings.push({ title: ProsemirrorHelper.toPlainText(node), level: node.attrs.level, - id: name, + id: slugger.slug(node), inTable: pos < tableEnd, }); } diff --git a/shared/utils/color.test.ts b/shared/utils/color.test.ts index cf40625141..4c443e5faf 100644 --- a/shared/utils/color.test.ts +++ b/shared/utils/color.test.ts @@ -1,4 +1,5 @@ import { + blendColors, ensureContrast, palette, stringToColor, @@ -143,3 +144,26 @@ describe("ensureContrast", () => { expect(ensureContrast("currentColor", true, "#111")).toBe("currentColor"); }); }); + +describe("blendColors", () => { + it("multiplies a color onto the backdrop", () => { + expect(blendColors("#ffffff", "#336699", "multiply")).toBe("#336699"); + expect(blendColors("#000000", "#336699", "multiply")).toBe("#000000"); + expect(blendColors("#808080", "#ff0000", "multiply")).toBe("#800000"); + }); + + it("screens a color onto the backdrop", () => { + expect(blendColors("#000000", "#336699", "screen")).toBe("#336699"); + expect(blendColors("#ffffff", "#336699", "screen")).toBe("#ffffff"); + expect(blendColors("#808080", "#000000", "screen")).toBe("#808080"); + }); + + it("applies the alpha of the color", () => { + expect(blendColors("rgba(0, 0, 0, 0.5)", "#ffffff", "multiply")).toBe( + "#808080" + ); + expect(blendColors("rgba(255, 255, 255, 0)", "#336699", "screen")).toBe( + "#336699" + ); + }); +}); diff --git a/shared/utils/color.ts b/shared/utils/color.ts index 5e3d0e8696..39304df532 100644 --- a/shared/utils/color.ts +++ b/shared/utils/color.ts @@ -196,3 +196,34 @@ export const hexToRgba = (hex: string): RgbaColor => { hex.length === 8 ? round(parseInt(hex.substring(6, 8), 16) / 255, 2) : 1, }; }; + +/** + * Blends a color onto an opaque backdrop with a multiply or screen blend mode. + * Multiply darkens the backdrop, screen lightens it. The alpha of the color + * controls how much of the blend is applied. + * + * @param color the color to blend. + * @param backdrop the color below. + * @param mode the blend mode to use. + * @returns the blended color as a hex string. + */ +export const blendColors = ( + color: string, + backdrop: string, + mode: "multiply" | "screen" +): string => { + const source = parseToRgb(color); + const base = parseToRgb(backdrop); + const alpha = "alpha" in source ? source.alpha : 1; + const blend = (a: number, b: number) => { + const blended = mode === "multiply" ? (a * b) / 255 : a + b - (a * b) / 255; + return Math.round(alpha * blended + (1 - alpha) * b); + }; + + return rgbaToHex({ + red: blend(source.red, base.red), + green: blend(source.green, base.green), + blue: blend(source.blue, base.blue), + alpha: 1, + }); +}; diff --git a/tsconfig.json b/tsconfig.json index 9e95439b84..2413f02a83 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -11,7 +11,7 @@ "forceConsistentCasingInFileNames": true, "isolatedModules": true, "jsx": "react-jsx", - "lib": ["dom", "es2020", "es2024.string", "dom.iterable", "esnext.asynciterable"], + "lib": ["dom", "es2020", "es2021.intl", "es2024.string", "dom.iterable", "esnext.asynciterable"], "module": "esnext", "moduleResolution": "bundler", "resolvePackageJsonExports": false, diff --git a/yarn.lock b/yarn.lock index 34f60e992b..2b378a0dd4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -18,27 +18,27 @@ __metadata: languageName: node linkType: hard -"@aws-sdk/checksums@npm:^3.1001.2": - version: 3.1001.2 - resolution: "@aws-sdk/checksums@npm:3.1001.2" +"@aws-sdk/checksums@npm:^3.1001.3": + version: 3.1001.3 + resolution: "@aws-sdk/checksums@npm:3.1001.3" dependencies: - "@aws-sdk/core": "npm:^3.978.2" + "@aws-sdk/core": "npm:^3.978.3" "@aws-sdk/types": "npm:^3.974.6" "@smithy/core": "npm:^3.35.2" "@smithy/types": "npm:^4.19.0" tslib: "npm:^2.6.2" - checksum: 10c0/fd40724bbab7641eb7f5ae85737c1d5bed096a2243133b46df1c47a4f6129a93fefa887a9a6d1044c68e179d06e0950309cd5eba8e03c9a29a33787ac42b9ce0 + checksum: 10c0/d7cceb3e63e93ececc00d80d5cbf54aaeec44d5d283433662d768e1eddbfeff999707f71e8bb7124015edbc2531c1b84803912e9fedc07a6c2e893e8b8b33c62 languageName: node linkType: hard -"@aws-sdk/client-s3@npm:3.1149.0, @aws-sdk/client-s3@npm:^3.1149.0": - version: 3.1149.0 - resolution: "@aws-sdk/client-s3@npm:3.1149.0" +"@aws-sdk/client-s3@npm:3.1152.0, @aws-sdk/client-s3@npm:^3.1152.0": + version: 3.1152.0 + resolution: "@aws-sdk/client-s3@npm:3.1152.0" dependencies: - "@aws-sdk/checksums": "npm:^3.1001.2" - "@aws-sdk/core": "npm:^3.978.2" - "@aws-sdk/credential-provider-node": "npm:^3.972.85" - "@aws-sdk/middleware-sdk-s3": "npm:^3.972.78" + "@aws-sdk/checksums": "npm:^3.1001.3" + "@aws-sdk/core": "npm:^3.978.3" + "@aws-sdk/credential-provider-node": "npm:^3.972.86" + "@aws-sdk/middleware-sdk-s3": "npm:^3.972.79" "@aws-sdk/signature-v4-multi-region": "npm:^3.996.48" "@aws-sdk/types": "npm:^3.974.6" "@smithy/core": "npm:^3.35.2" @@ -46,7 +46,7 @@ __metadata: "@smithy/node-http-handler": "npm:^4.12.1" "@smithy/types": "npm:^4.19.0" tslib: "npm:^2.6.2" - checksum: 10c0/97b8effdcfe2eb958f30c8aa1c7df47f878b32077a6013c0ba6c6efd8a4dc474d507b13839fe222ab9a39c2809670f471879025436a1e425a4c0422f9248897e + checksum: 10c0/3730e9ace5713ba81a1cdb965c21d57c9546327b7f26e379933f0544b199c9b0ac511173361b32a33e672524cb23422d6e99f0fc47c088d59b3ffaa60dd9716a languageName: node linkType: hard @@ -60,9 +60,9 @@ __metadata: languageName: node linkType: hard -"@aws-sdk/core@npm:^3.978.2": - version: 3.978.2 - resolution: "@aws-sdk/core@npm:3.978.2" +"@aws-sdk/core@npm:^3.978.3": + version: 3.978.3 + resolution: "@aws-sdk/core@npm:3.978.3" dependencies: "@aws-sdk/types": "npm:^3.974.6" "@aws-sdk/xml-builder": "npm:^3.972.41" @@ -72,148 +72,148 @@ __metadata: "@smithy/types": "npm:^4.19.0" bowser: "npm:^2.11.0" tslib: "npm:^2.6.2" - checksum: 10c0/d2cb6a2794d1ed57c256e3523023606f86f679c0da361e1cd94ff2b177593a4bc898738031278dac0aaf025f72beca6ffe42c5a2fd6738a874b9dc19b221dbf3 + checksum: 10c0/5f5e14629cf26d4c9d4a09e95cfb1bbd4ec880f4eb94d7bcecfd00a6099ab716bf4871e581dbd5a89cd5a06e13621871b54006aa6a36bf1d385d20816813e337 languageName: node linkType: hard -"@aws-sdk/credential-provider-env@npm:^3.972.73": - version: 3.972.73 - resolution: "@aws-sdk/credential-provider-env@npm:3.972.73" +"@aws-sdk/credential-provider-env@npm:^3.972.74": + version: 3.972.74 + resolution: "@aws-sdk/credential-provider-env@npm:3.972.74" dependencies: - "@aws-sdk/core": "npm:^3.978.2" + "@aws-sdk/core": "npm:^3.978.3" "@aws-sdk/types": "npm:^3.974.6" "@smithy/core": "npm:^3.35.2" "@smithy/types": "npm:^4.19.0" tslib: "npm:^2.6.2" - checksum: 10c0/d60d6319390e36883a92d9dbf00a01d76cd449920019f99df3006b4896f434eb007235e052a9173e7f7e518539568f0c4f46278d8c9831682494b90f7dbdfcd2 + checksum: 10c0/ce6963f9e02e5d67ca9cf3bdf08cb73872abd5907ccd51f0e6381fa059148fa7f273e78f4f214b47849c8ab9a1910cb86bcc82d6551ed464a63502a70d9b71b4 languageName: node linkType: hard -"@aws-sdk/credential-provider-http@npm:^3.972.75": - version: 3.972.75 - resolution: "@aws-sdk/credential-provider-http@npm:3.972.75" +"@aws-sdk/credential-provider-http@npm:^3.972.76": + version: 3.972.76 + resolution: "@aws-sdk/credential-provider-http@npm:3.972.76" dependencies: - "@aws-sdk/core": "npm:^3.978.2" + "@aws-sdk/core": "npm:^3.978.3" "@aws-sdk/types": "npm:^3.974.6" "@smithy/core": "npm:^3.35.2" "@smithy/fetch-http-handler": "npm:^5.8.0" "@smithy/node-http-handler": "npm:^4.12.1" "@smithy/types": "npm:^4.19.0" tslib: "npm:^2.6.2" - checksum: 10c0/9f983e083a232ab0f910db670b2162affac7cc2c6300eebbda4c3822a38761ae67b5925ca1dd1f1c9032ba25b57721721567346ca35b2eb399dc12aa45a7583c + checksum: 10c0/9921862c990f2cf8beb76811bed873a0c01db032476f48e77b71f2e886a49b70837b1e15cf4adf39a8eef16be1636786023ea5a03e9de1453b15babc473739d4 languageName: node linkType: hard -"@aws-sdk/credential-provider-ini@npm:^3.973.18": +"@aws-sdk/credential-provider-ini@npm:^3.973.19": + version: 3.973.19 + resolution: "@aws-sdk/credential-provider-ini@npm:3.973.19" + dependencies: + "@aws-sdk/core": "npm:^3.978.3" + "@aws-sdk/credential-provider-env": "npm:^3.972.74" + "@aws-sdk/credential-provider-http": "npm:^3.972.76" + "@aws-sdk/credential-provider-login": "npm:^3.972.81" + "@aws-sdk/credential-provider-process": "npm:^3.972.74" + "@aws-sdk/credential-provider-sso": "npm:^3.973.18" + "@aws-sdk/credential-provider-web-identity": "npm:^3.972.80" + "@aws-sdk/nested-clients": "npm:^3.997.48" + "@aws-sdk/types": "npm:^3.974.6" + "@smithy/core": "npm:^3.35.2" + "@smithy/credential-provider-imds": "npm:^4.5.2" + "@smithy/types": "npm:^4.19.0" + tslib: "npm:^2.6.2" + checksum: 10c0/f1babaaabc615fb48ce1d293c2c0f9236901edc2a0ccd8b8aa58f7a59df3e5e5a40b877c2f821f3904c52e2c9be39b468eb12470b4ce24d262105d6148e3906e + languageName: node + linkType: hard + +"@aws-sdk/credential-provider-login@npm:^3.972.81": + version: 3.972.81 + resolution: "@aws-sdk/credential-provider-login@npm:3.972.81" + dependencies: + "@aws-sdk/core": "npm:^3.978.3" + "@aws-sdk/nested-clients": "npm:^3.997.48" + "@aws-sdk/types": "npm:^3.974.6" + "@smithy/core": "npm:^3.35.2" + "@smithy/types": "npm:^4.19.0" + tslib: "npm:^2.6.2" + checksum: 10c0/e37ee7146b9b33dd14398e7b63de430dec62067ba960a504f18e078d0d918f070e73b961a8f84edaf6b5a4fa2126e2855d881960df410e607d5392d02184a4ed + languageName: node + linkType: hard + +"@aws-sdk/credential-provider-node@npm:^3.972.86": + version: 3.972.86 + resolution: "@aws-sdk/credential-provider-node@npm:3.972.86" + dependencies: + "@aws-sdk/credential-provider-env": "npm:^3.972.74" + "@aws-sdk/credential-provider-http": "npm:^3.972.76" + "@aws-sdk/credential-provider-ini": "npm:^3.973.19" + "@aws-sdk/credential-provider-process": "npm:^3.972.74" + "@aws-sdk/credential-provider-sso": "npm:^3.973.18" + "@aws-sdk/credential-provider-web-identity": "npm:^3.972.80" + "@aws-sdk/types": "npm:^3.974.6" + "@smithy/core": "npm:^3.35.2" + "@smithy/credential-provider-imds": "npm:^4.5.2" + "@smithy/types": "npm:^4.19.0" + tslib: "npm:^2.6.2" + checksum: 10c0/66cb2ab79cd6fa7eebad84e4fb043bb619e2119cdd6f4ff67b2825068fe51bb41161581566b98042c66593155e39e2a1b8a53e2f89a5a3f4fb56b6d07e5a875d + languageName: node + linkType: hard + +"@aws-sdk/credential-provider-process@npm:^3.972.74": + version: 3.972.74 + resolution: "@aws-sdk/credential-provider-process@npm:3.972.74" + dependencies: + "@aws-sdk/core": "npm:^3.978.3" + "@aws-sdk/types": "npm:^3.974.6" + "@smithy/core": "npm:^3.35.2" + "@smithy/types": "npm:^4.19.0" + tslib: "npm:^2.6.2" + checksum: 10c0/4408a904ee5f9c76746a440985b4c14107c8d29d12f3c412ca23c609017a05e970c471a8adf25f662c284c480baf8aa26def66d30b2ccce532fb4e6c3655a8fb + languageName: node + linkType: hard + +"@aws-sdk/credential-provider-sso@npm:^3.973.18": version: 3.973.18 - resolution: "@aws-sdk/credential-provider-ini@npm:3.973.18" + resolution: "@aws-sdk/credential-provider-sso@npm:3.973.18" dependencies: - "@aws-sdk/core": "npm:^3.978.2" - "@aws-sdk/credential-provider-env": "npm:^3.972.73" - "@aws-sdk/credential-provider-http": "npm:^3.972.75" - "@aws-sdk/credential-provider-login": "npm:^3.972.80" - "@aws-sdk/credential-provider-process": "npm:^3.972.73" - "@aws-sdk/credential-provider-sso": "npm:^3.973.17" - "@aws-sdk/credential-provider-web-identity": "npm:^3.972.79" - "@aws-sdk/nested-clients": "npm:^3.997.47" + "@aws-sdk/core": "npm:^3.978.3" + "@aws-sdk/nested-clients": "npm:^3.997.48" + "@aws-sdk/token-providers": "npm:3.1150.0" "@aws-sdk/types": "npm:^3.974.6" "@smithy/core": "npm:^3.35.2" - "@smithy/credential-provider-imds": "npm:^4.5.2" "@smithy/types": "npm:^4.19.0" tslib: "npm:^2.6.2" - checksum: 10c0/cf2862ae983155883d08302dee65743d83c3774e473cb4742a55bef90c2a6c523e377ef44d008398f23e3a8120e3bee5338c8c2c2ffd197d9e56581c419e35f7 + checksum: 10c0/49a9852188b043a23795675e93298070d8bfe75b74b1db9217411a96271c678cd53dd06c80d97515ce9884693da551e804fbc3bcfed5e6f5f6d1e1c5e1ae491a languageName: node linkType: hard -"@aws-sdk/credential-provider-login@npm:^3.972.80": +"@aws-sdk/credential-provider-web-identity@npm:^3.972.80": version: 3.972.80 - resolution: "@aws-sdk/credential-provider-login@npm:3.972.80" + resolution: "@aws-sdk/credential-provider-web-identity@npm:3.972.80" dependencies: - "@aws-sdk/core": "npm:^3.978.2" - "@aws-sdk/nested-clients": "npm:^3.997.47" + "@aws-sdk/core": "npm:^3.978.3" + "@aws-sdk/nested-clients": "npm:^3.997.48" "@aws-sdk/types": "npm:^3.974.6" "@smithy/core": "npm:^3.35.2" "@smithy/types": "npm:^4.19.0" tslib: "npm:^2.6.2" - checksum: 10c0/d35cffe704c3b30f4569632d4bd87a11ab200e78c9247b1ed113f059b611b1f88729524f2cf32ae5d2bce14815814dc6d453b7cdad64a9106b8996a257b12763 + checksum: 10c0/e97acf071ef2ceb45dd9183f0ca6ac9ce606638beb47d72f3665cb270e3006b79aed8589545639a1bb4e0f2792f5d6f5b3025b7e55e1ab680628280440f998ab languageName: node linkType: hard -"@aws-sdk/credential-provider-node@npm:^3.972.85": - version: 3.972.85 - resolution: "@aws-sdk/credential-provider-node@npm:3.972.85" +"@aws-sdk/crt-loader@npm:^3.972.78": + version: 3.972.78 + resolution: "@aws-sdk/crt-loader@npm:3.972.78" dependencies: - "@aws-sdk/credential-provider-env": "npm:^3.972.73" - "@aws-sdk/credential-provider-http": "npm:^3.972.75" - "@aws-sdk/credential-provider-ini": "npm:^3.973.18" - "@aws-sdk/credential-provider-process": "npm:^3.972.73" - "@aws-sdk/credential-provider-sso": "npm:^3.973.17" - "@aws-sdk/credential-provider-web-identity": "npm:^3.972.79" - "@aws-sdk/types": "npm:^3.974.6" - "@smithy/core": "npm:^3.35.2" - "@smithy/credential-provider-imds": "npm:^4.5.2" - "@smithy/types": "npm:^4.19.0" - tslib: "npm:^2.6.2" - checksum: 10c0/72452c2a98fd18dca3a70b2c851087fb9b39f598c715a6431c3293a0e8183b657ce13cf1ce0803b0192e12d4a65ed9962bb3b930083a9f8e94406abe0178a8f6 - languageName: node - linkType: hard - -"@aws-sdk/credential-provider-process@npm:^3.972.73": - version: 3.972.73 - resolution: "@aws-sdk/credential-provider-process@npm:3.972.73" - dependencies: - "@aws-sdk/core": "npm:^3.978.2" - "@aws-sdk/types": "npm:^3.974.6" - "@smithy/core": "npm:^3.35.2" - "@smithy/types": "npm:^4.19.0" - tslib: "npm:^2.6.2" - checksum: 10c0/b9e265616395409e69d7694d8e884490793fc959b9abd451fe6c424e09651d0c3dd24ea61c9d19250b50d28babb8aae8168ad4107b1b91c7f77344623ae9777d - languageName: node - linkType: hard - -"@aws-sdk/credential-provider-sso@npm:^3.973.17": - version: 3.973.17 - resolution: "@aws-sdk/credential-provider-sso@npm:3.973.17" - dependencies: - "@aws-sdk/core": "npm:^3.978.2" - "@aws-sdk/nested-clients": "npm:^3.997.47" - "@aws-sdk/token-providers": "npm:3.1149.0" - "@aws-sdk/types": "npm:^3.974.6" - "@smithy/core": "npm:^3.35.2" - "@smithy/types": "npm:^4.19.0" - tslib: "npm:^2.6.2" - checksum: 10c0/f658d3fc6cdbeb9d2c0848cdff726733668f1e5efad0f64e86bf24de5a46e619192fad2751d1426ff25bbe116d25c16522103ed2ecd540eac71515bb8a461c90 - languageName: node - linkType: hard - -"@aws-sdk/credential-provider-web-identity@npm:^3.972.79": - version: 3.972.79 - resolution: "@aws-sdk/credential-provider-web-identity@npm:3.972.79" - dependencies: - "@aws-sdk/core": "npm:^3.978.2" - "@aws-sdk/nested-clients": "npm:^3.997.47" - "@aws-sdk/types": "npm:^3.974.6" - "@smithy/core": "npm:^3.35.2" - "@smithy/types": "npm:^4.19.0" - tslib: "npm:^2.6.2" - checksum: 10c0/7110979f1597ceb83de74ddc41675ba67f9bd0d7cc44223ba730304ad3fead7b53463b09eab7065bd76ef5538ac7e57e844fb4d0afacfab917391cc42e4ae7cd - languageName: node - linkType: hard - -"@aws-sdk/crt-loader@npm:^3.972.77": - version: 3.972.77 - resolution: "@aws-sdk/crt-loader@npm:3.972.77" - dependencies: - "@aws-sdk/core": "npm:^3.978.2" + "@aws-sdk/core": "npm:^3.978.3" aws-crt: "npm:^1.31.0" tslib: "npm:^2.6.2" - checksum: 10c0/8acd2f37c9602323e3afd5d6bff50c6ada37eb94814e73d650e495cb34a8c86afe66222f187a7e5b2c35dfd9ace888933e183444a4238a6956f37c4bc8c45d5a + checksum: 10c0/6e94d030487c23e3b23e7b233f1a0a2df8e2ea298975da93bab2c66c0cfddd41d43bc1f33a6deef629791302f5ef9ae8f58de6ea5f9bb0eeff5365a1e7b2fe92 languageName: node linkType: hard -"@aws-sdk/lib-storage@npm:^3.1149.0": - version: 3.1149.0 - resolution: "@aws-sdk/lib-storage@npm:3.1149.0" +"@aws-sdk/lib-storage@npm:^3.1152.0": + version: 3.1152.0 + resolution: "@aws-sdk/lib-storage@npm:3.1152.0" dependencies: "@smithy/core": "npm:^3.35.2" "@smithy/types": "npm:^4.19.0" @@ -222,30 +222,30 @@ __metadata: stream-browserify: "npm:3.0.0" tslib: "npm:^2.6.2" peerDependencies: - "@aws-sdk/client-s3": ^3.1149.0 - checksum: 10c0/078c2bb30dc438f422bb62c3df2098d8a6b586dda6c669b5c7d591244b1a5a098b44056c86ac5622e8a61164e1a28a9ba5c216b5f4b8f5111b5e28d31512e9a6 + "@aws-sdk/client-s3": ^3.1152.0 + checksum: 10c0/fcc60a9fbdc4a3cb9bd9a94e33a548d22b4ba19eccc234c4256ce30d91960d7e0a3357c1b0117a65f10b23324025aa9c2885c7e34ce96afe7dd90eafbf522aa2 languageName: node linkType: hard -"@aws-sdk/middleware-sdk-s3@npm:^3.972.78": - version: 3.972.78 - resolution: "@aws-sdk/middleware-sdk-s3@npm:3.972.78" +"@aws-sdk/middleware-sdk-s3@npm:^3.972.79": + version: 3.972.79 + resolution: "@aws-sdk/middleware-sdk-s3@npm:3.972.79" dependencies: - "@aws-sdk/core": "npm:^3.978.2" + "@aws-sdk/core": "npm:^3.978.3" "@aws-sdk/signature-v4-multi-region": "npm:^3.996.48" "@aws-sdk/types": "npm:^3.974.6" "@smithy/core": "npm:^3.35.2" "@smithy/types": "npm:^4.19.0" tslib: "npm:^2.6.2" - checksum: 10c0/691519cc985504c0bf1bb72c2cc3060737b22197def89c36f5380c981d0e9e68569f547ac7e06677dca7c6d63f64b618f8954bed50a44f482669c686bfcf44e5 + checksum: 10c0/bcf6a328c6039b5c09dc654b8dc3022e31164280feb76520e55e89a01c352b423901b7617134251cc29e6daa37c05e8b5ee030ad480491df6c679460a777ad20 languageName: node linkType: hard -"@aws-sdk/nested-clients@npm:^3.997.47": - version: 3.997.47 - resolution: "@aws-sdk/nested-clients@npm:3.997.47" +"@aws-sdk/nested-clients@npm:^3.997.48": + version: 3.997.48 + resolution: "@aws-sdk/nested-clients@npm:3.997.48" dependencies: - "@aws-sdk/core": "npm:^3.978.2" + "@aws-sdk/core": "npm:^3.978.3" "@aws-sdk/signature-v4-multi-region": "npm:^3.996.48" "@aws-sdk/types": "npm:^3.974.6" "@smithy/core": "npm:^3.35.2" @@ -253,51 +253,51 @@ __metadata: "@smithy/node-http-handler": "npm:^4.12.1" "@smithy/types": "npm:^4.19.0" tslib: "npm:^2.6.2" - checksum: 10c0/0787cefe45ff4eaae5bd950f93844596bd1eb68949ae1d317de63d2bb22c415f51778db3042dccc3ee28ddf597f967d3ffba0c51dd1c0bc8419e1a9152d395c8 + checksum: 10c0/61ec1e1c3eac42930052bdd1b315f10cde687fd43887b995b74a10d4cc6b60c06d6b2a22cf7f5102926a5473ed4b5a56a91677dc34ceb4777a09057d19391e48 languageName: node linkType: hard -"@aws-sdk/s3-presigned-post@npm:^3.1149.0": - version: 3.1149.0 - resolution: "@aws-sdk/s3-presigned-post@npm:3.1149.0" +"@aws-sdk/s3-presigned-post@npm:^3.1152.0": + version: 3.1152.0 + resolution: "@aws-sdk/s3-presigned-post@npm:3.1152.0" dependencies: - "@aws-sdk/client-s3": "npm:3.1149.0" - "@aws-sdk/core": "npm:^3.978.2" + "@aws-sdk/client-s3": "npm:3.1152.0" + "@aws-sdk/core": "npm:^3.978.3" "@aws-sdk/types": "npm:^3.974.6" "@smithy/core": "npm:^3.35.2" "@smithy/signature-v4": "npm:^5.7.4" "@smithy/types": "npm:^4.19.0" tslib: "npm:^2.6.2" - checksum: 10c0/5650c09df6bc79596194361765beb0325f35c51293a074767e12ef53e3273e1fc90248cfe2f4ea96813fff3905ca6dde949700c2b07dd62e395ae53fb0cf9844 + checksum: 10c0/5cd36049bcaae06321c14f530f2aeeb9df80a9ffa3f2ce04c7c6c6ab9b65a6604a6f7c9b5906d7c84000cf53a8cef65accec0660fb565a0c89d17223b799530e languageName: node linkType: hard -"@aws-sdk/s3-request-presigner@npm:^3.1149.0": - version: 3.1149.0 - resolution: "@aws-sdk/s3-request-presigner@npm:3.1149.0" +"@aws-sdk/s3-request-presigner@npm:^3.1152.0": + version: 3.1152.0 + resolution: "@aws-sdk/s3-request-presigner@npm:3.1152.0" dependencies: - "@aws-sdk/core": "npm:^3.978.2" + "@aws-sdk/core": "npm:^3.978.3" "@aws-sdk/signature-v4-multi-region": "npm:^3.996.48" "@aws-sdk/types": "npm:^3.974.6" "@smithy/core": "npm:^3.35.2" "@smithy/types": "npm:^4.19.0" tslib: "npm:^2.6.2" - checksum: 10c0/f5f0762bde0e62247792d845365cb40f491d7ac6b3d87a9bfe0c85cb1c222b40b48df1873d21fb85c5251fd2ed88394c011cd41432f71825c90cd6a1b95c7c89 + checksum: 10c0/5687935d13d441116796c0be76fd7ac5dabfaba87da8e35cc4658e1c6f98e116fb5675f60dfd1af68dabe68a808691eb46a9d618c4a8d82a2c7ec9f77aa196f5 languageName: node linkType: hard -"@aws-sdk/signature-v4-crt@npm:^3.1149.0": - version: 3.1149.0 - resolution: "@aws-sdk/signature-v4-crt@npm:3.1149.0" +"@aws-sdk/signature-v4-crt@npm:^3.1152.0": + version: 3.1152.0 + resolution: "@aws-sdk/signature-v4-crt@npm:3.1152.0" dependencies: - "@aws-sdk/crt-loader": "npm:^3.972.77" + "@aws-sdk/crt-loader": "npm:^3.972.78" "@aws-sdk/signature-v4-multi-region": "npm:^3.996.48" "@aws-sdk/types": "npm:^3.974.6" "@smithy/core": "npm:^3.35.2" "@smithy/signature-v4": "npm:^5.7.4" "@smithy/types": "npm:^4.19.0" tslib: "npm:^2.6.2" - checksum: 10c0/c76a967bd52c328a639ebcb79446da4d24e24830e4e2cfbc3a08df8766d4f58cc597142c604485a34c4027a843181634467b46801a31eb105ee2eb2a2987b0a8 + checksum: 10c0/d237a0e08cf3abea95682a58399db70e325e70326b743b8dded326280db20790a9c34e0fd7b9dcb1ada96cd499e3b1666c03fd92b69d68b34a6cf69e8c53a6c5 languageName: node linkType: hard @@ -313,17 +313,17 @@ __metadata: languageName: node linkType: hard -"@aws-sdk/token-providers@npm:3.1149.0": - version: 3.1149.0 - resolution: "@aws-sdk/token-providers@npm:3.1149.0" +"@aws-sdk/token-providers@npm:3.1150.0": + version: 3.1150.0 + resolution: "@aws-sdk/token-providers@npm:3.1150.0" dependencies: - "@aws-sdk/core": "npm:^3.978.2" - "@aws-sdk/nested-clients": "npm:^3.997.47" + "@aws-sdk/core": "npm:^3.978.3" + "@aws-sdk/nested-clients": "npm:^3.997.48" "@aws-sdk/types": "npm:^3.974.6" "@smithy/core": "npm:^3.35.2" "@smithy/types": "npm:^4.19.0" tslib: "npm:^2.6.2" - checksum: 10c0/e58ea6c4000a40f0ce785d7b4494a8f7a8abc76876fd8f3f20028621fe1d23ace999270f6cc40785966ec264f9b23d5a5dedf9fa7dd2fda0c07809a5e51f3fa2 + checksum: 10c0/c9a916dea1e2bdee9292ecf543e4c72a6cdb6e69b00569c78ee5f048095e05ac03b96fb49dae38cefcd8c7e4a1329b7f406d76cb32bb971249858dfca97ef3ad languageName: node linkType: hard @@ -2087,9 +2087,9 @@ __metadata: linkType: hard "@floating-ui/utils@npm:^0.2.10": - version: 0.2.10 - resolution: "@floating-ui/utils@npm:0.2.10" - checksum: 10c0/e9bc2a1730ede1ee25843937e911ab6e846a733a4488623cd353f94721b05ec2c9ec6437613a2ac9379a94c2fd40c797a2ba6fa1df2716f5ce4aa6ddb1cf9ea4 + version: 0.2.12 + resolution: "@floating-ui/utils@npm:0.2.12" + checksum: 10c0/bb910b90d56991a62011afaf5f8e0c4b7fb6dab69403f4dd17fbd6eb25560b28d533dff9791f270b4f459852e9006a1077b5d73cbedb5e34d9424afc6a828314 languageName: node linkType: hard @@ -2713,9 +2713,9 @@ __metadata: languageName: node linkType: hard -"@modelcontextprotocol/sdk@npm:^1.31.0": - version: 1.31.0 - resolution: "@modelcontextprotocol/sdk@npm:1.31.0" +"@modelcontextprotocol/sdk@npm:^1.32.1": + version: 1.32.1 + resolution: "@modelcontextprotocol/sdk@npm:1.32.1" dependencies: "@hono/node-server": "npm:^1.19.9 || ^2.0.5" ajv: "npm:^8.17.1" @@ -2742,7 +2742,7 @@ __metadata: optional: true zod: optional: false - checksum: 10c0/2c4f011a765fb3346ec578455591d062008a842a0f6f8a763baa97b6a01e0f1febb97d1cc44024ee6d0761d43df56e9c71f72a37d47c7ea6aeb1c4f8be0f06d9 + checksum: 10c0/8b6c8ff6aa5358aeb316fedfa2094a4241ce12d98a0f818cee42510ec9149fed21fc75244c5f0e8cb453337f243c09fa8a90425cd2533fd481964d8583a1f0c9 languageName: node linkType: hard @@ -5706,17 +5706,7 @@ __metadata: languageName: node linkType: hard -"@smithy/core@npm:^3.33.2, @smithy/core@npm:^3.33.3, @smithy/core@npm:^3.35.0": - version: 3.35.0 - resolution: "@smithy/core@npm:3.35.0" - dependencies: - "@smithy/types": "npm:^4.19.0" - tslib: "npm:^2.6.2" - checksum: 10c0/9c0b8343c3ea720498e495ffdf83cb587775ff27b5a968c4f2a3da2410689ea593c005a4b8fa5c1e47624b52af5901b7aab79603acd317987920deedb53695d2 - languageName: node - linkType: hard - -"@smithy/core@npm:^3.35.2": +"@smithy/core@npm:^3.33.2, @smithy/core@npm:^3.33.3, @smithy/core@npm:^3.35.0, @smithy/core@npm:^3.35.2": version: 3.35.2 resolution: "@smithy/core@npm:3.35.2" dependencies: @@ -7478,7 +7468,7 @@ __metadata: languageName: node linkType: hard -"anymatch@npm:^3.1.3, anymatch@npm:~3.1.2": +"anymatch@npm:^3.1.3": version: 3.1.3 resolution: "anymatch@npm:3.1.3" dependencies: @@ -7782,13 +7772,6 @@ __metadata: languageName: node linkType: hard -"binary-extensions@npm:^2.0.0": - version: 2.3.0 - resolution: "binary-extensions@npm:2.3.0" - checksum: 10c0/75a59cafc10fb12a11d510e77110c6c7ae3f4ca22463d52487709ca7f18f69d886aa387557cc9864fbdb10153d0bdb4caacabf11541f55e89ed6e18d12ece2b5 - languageName: node - linkType: hard - "binary-version-check@npm:^6.1.0": version: 6.1.0 resolution: "binary-version-check@npm:6.1.0" @@ -7928,7 +7911,7 @@ __metadata: languageName: node linkType: hard -"braces@npm:^3.0.3, braces@npm:~3.0.2": +"braces@npm:^3.0.3": version: 3.0.3 resolution: "braces@npm:3.0.3" dependencies: @@ -8257,25 +8240,6 @@ __metadata: languageName: node linkType: hard -"chokidar@npm:^3.5.2": - version: 3.6.0 - resolution: "chokidar@npm:3.6.0" - dependencies: - anymatch: "npm:~3.1.2" - braces: "npm:~3.0.2" - fsevents: "npm:~2.3.2" - glob-parent: "npm:~5.1.2" - is-binary-path: "npm:~2.1.0" - is-glob: "npm:~4.0.1" - normalize-path: "npm:~3.0.0" - readdirp: "npm:~3.6.0" - dependenciesMeta: - fsevents: - optional: true - checksum: 10c0/8361dcd013f2ddbe260eacb1f3cb2f2c6f2b0ad118708a343a5ed8158941a39cb8fb1d272e0f389712e74ee90ce8ba864eece9e0e62b9705cb468a2f6d917462 - languageName: node - linkType: hard - "chownr@npm:^3.0.0": version: 3.0.0 resolution: "chownr@npm:3.0.0" @@ -8283,10 +8247,10 @@ __metadata: languageName: node linkType: hard -"chrono-node@npm:^2.10.1": - version: 2.10.1 - resolution: "chrono-node@npm:2.10.1" - checksum: 10c0/bb3a7259b8fd5b8657486db0482c352e2a5959000042a0962660474a438c3ffc90a85ad807bea4b0bc23f319a5e92362d0394ed093c6291c737612d3990dcd00 +"chrono-node@npm:^2.10.3": + version: 2.10.3 + resolution: "chrono-node@npm:2.10.3" + checksum: 10c0/612aee720148dc692456fb022eeb16808333f364ca55270af8c4ad3069b531c57fc9cb5aa47bf3085eae324027e386a5a20fb9477d6b51c6b86179fb17988214 languageName: node linkType: hard @@ -9078,7 +9042,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.3, debug@npm:~4.4.1": +"debug@npm:4, debug@npm:4.4.3, 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: @@ -10450,12 +10414,12 @@ __metadata: linkType: hard "follow-redirects@npm:^1.16.0": - version: 1.16.0 - resolution: "follow-redirects@npm:1.16.0" + version: 1.16.1 + resolution: "follow-redirects@npm:1.16.1" peerDependenciesMeta: debug: optional: true - checksum: 10c0/a1e2900163e6f1b4d1ed5c221b607f41decbab65534c63fe7e287e40a5d552a6496e7d9d7d976fa4ba77b4c51c11e5e9f683f10b43011ea11e442ff128d0e181 + checksum: 10c0/544e24ccb93b7afb5dd5a2199bd556e167b84de2af7c13b2ced08494239677359d7883bae56ae43a9ca98ac5451e75cf4834a5fadd6fa79053b9248fac5447a4 languageName: node linkType: hard @@ -10892,15 +10856,6 @@ __metadata: languageName: node linkType: hard -"glob-parent@npm:~5.1.2": - version: 5.1.2 - resolution: "glob-parent@npm:5.1.2" - dependencies: - is-glob: "npm:^4.0.1" - checksum: 10c0/cab87638e2112bee3f839ef5f6e0765057163d39c66be8ec1602f3823da4692297ad4e972de876ea17c44d652978638d2fd583c6713d0eb6591706825020c9ee - languageName: node - linkType: hard - "glob-stream@npm:^8.0.3": version: 8.0.3 resolution: "glob-stream@npm:8.0.3" @@ -11218,9 +11173,9 @@ __metadata: linkType: hard "hono@npm:^4.11.4": - version: 4.13.7 - resolution: "hono@npm:4.13.7" - checksum: 10c0/29672a94a4f2be7f3f4d959ad69808dd3bbc220909ca4f9660997022ff45d48ae71e42a460e417d808809d68110196f19359aaab2b14ae6a750331d789601b5a + version: 4.13.13 + resolution: "hono@npm:4.13.13" + checksum: 10c0/c8524e685a59b4f23a9bea15385eeac5622218949db251cb871b20fd9ef673b751b44ccdee6c22b3df56e5ed4c1b1cebad17b518bdc1823039da39b53ef9c1cf languageName: node linkType: hard @@ -11422,10 +11377,10 @@ __metadata: languageName: node linkType: hard -"i18next-fs-backend@npm:^2.6.8": - version: 2.6.8 - resolution: "i18next-fs-backend@npm:2.6.8" - checksum: 10c0/c3750724c17bad6276b43bc5342a83a13eebf66b995fa7b2100224451d30754d2c0eb67364b3c025da8e712f01c7aad212fb4440816337552025e0efab9bf470 +"i18next-fs-backend@npm:^2.6.9": + version: 2.6.9 + resolution: "i18next-fs-backend@npm:2.6.9" + checksum: 10c0/881432a5fd1c75cd44db09968807d3d517dec2ac5312629b751f7d0974ec29f6d08018da78f69becb3b43f50d539cb43f4583dd32afcf80691ce90bd6e901b23 languageName: node linkType: hard @@ -11524,13 +11479,6 @@ __metadata: languageName: node linkType: hard -"ignore-by-default@npm:^1.0.1": - version: 1.0.1 - resolution: "ignore-by-default@npm:1.0.1" - checksum: 10c0/9ab6e70e80f7cc12735def7ecb5527cfa56ab4e1152cd64d294522827f2dcf1f6d85531241537dc3713544e88dd888f65cb3c49c7b2cddb9009087c75274e533 - languageName: node - linkType: hard - "ignore@npm:^5.3.0": version: 5.3.2 resolution: "ignore@npm:5.3.2" @@ -11782,15 +11730,6 @@ __metadata: languageName: node linkType: hard -"is-binary-path@npm:~2.1.0": - version: 2.1.0 - resolution: "is-binary-path@npm:2.1.0" - dependencies: - binary-extensions: "npm:^2.0.0" - checksum: 10c0/a16eaee59ae2b315ba36fad5c5dcaf8e49c3e27318f8ab8fa3cdb8772bf559c8d1ba750a589c2ccb096113bb64497084361a25960899cb6172a6925ab6123d38 - languageName: node - linkType: hard - "is-blob@npm:^2.1.0": version: 2.1.0 resolution: "is-blob@npm:2.1.0" @@ -11920,7 +11859,7 @@ __metadata: languageName: node linkType: hard -"is-glob@npm:^4.0.1, is-glob@npm:^4.0.3, is-glob@npm:~4.0.1": +"is-glob@npm:^4.0.3": version: 4.0.3 resolution: "is-glob@npm:4.0.3" dependencies: @@ -13371,9 +13310,9 @@ __metadata: languageName: node linkType: hard -"markdown-it@npm:^14.0.0, markdown-it@npm:^14.3.2": - version: 14.3.2 - resolution: "markdown-it@npm:14.3.2" +"markdown-it@npm:^14.0.0, markdown-it@npm:^14.3.3": + version: 14.3.3 + resolution: "markdown-it@npm:14.3.3" dependencies: argparse: "npm:^2.0.1" entities: "npm:^4.5.0" @@ -13383,7 +13322,7 @@ __metadata: uc.micro: "npm:^2.1.0" bin: markdown-it: bin/markdown-it.mjs - checksum: 10c0/51d03a244bbacc84aa7229fd784ccc16a76cb853cf93f668c4dfc1e9eb22d03138678e7743accac2304e03151a995068492fde56c7a9fbe6785b4169036cf590 + checksum: 10c0/d6075ad320731d7fb9f127e496677f4e36cbdba839d7387dabf1f0d07b5c02bdffb46fb3969033817c04e60017e05d4269e4aa74bee58cc0a562a17cc0b6b8ff languageName: node linkType: hard @@ -13532,7 +13471,7 @@ __metadata: languageName: node linkType: hard -"minimatch@npm:^10.1.1, minimatch@npm:^10.2.1, minimatch@npm:^10.2.2": +"minimatch@npm:^10.1.1, minimatch@npm:^10.2.2": version: 10.2.5 resolution: "minimatch@npm:10.2.5" dependencies: @@ -14038,26 +13977,6 @@ __metadata: languageName: node linkType: hard -"nodemon@npm:^3.1.14": - version: 3.1.14 - resolution: "nodemon@npm:3.1.14" - dependencies: - chokidar: "npm:^3.5.2" - debug: "npm:^4" - ignore-by-default: "npm:^1.0.1" - minimatch: "npm:^10.2.1" - pstree.remy: "npm:^1.1.8" - semver: "npm:^7.5.3" - simple-update-notifier: "npm:^2.0.0" - supports-color: "npm:^5.5.0" - touch: "npm:^3.1.0" - undefsafe: "npm:^2.0.5" - bin: - nodemon: bin/nodemon.js - checksum: 10c0/074f2056051a148ad11cda0d6c3f905bdef93a878792385f16e1dff0c63dcf07f23ebe1ab3763dca7314d0266e12129f066070545d817a205ee050a22eff50b0 - languageName: node - linkType: hard - "nopt@npm:^7.2.1": version: 7.2.1 resolution: "nopt@npm:7.2.1" @@ -14080,7 +13999,7 @@ __metadata: languageName: node linkType: hard -"normalize-path@npm:3.0.0, normalize-path@npm:^3.0.0, normalize-path@npm:~3.0.0": +"normalize-path@npm:3.0.0, normalize-path@npm:^3.0.0": version: 3.0.0 resolution: "normalize-path@npm:3.0.0" checksum: 10c0/e008c8142bcc335b5e38cf0d63cfd39d6cf2d97480af9abdbe9a439221fd4d749763bab492a8ee708ce7a194bb00c9da6d0a115018672310850489137b3da046 @@ -14355,12 +14274,12 @@ __metadata: version: 0.0.0-use.local resolution: "outline@workspace:." dependencies: - "@aws-sdk/client-s3": "npm:^3.1149.0" + "@aws-sdk/client-s3": "npm:^3.1152.0" "@aws-sdk/cloudfront-signer": "npm:^3.1149.0" - "@aws-sdk/lib-storage": "npm:^3.1149.0" - "@aws-sdk/s3-presigned-post": "npm:^3.1149.0" - "@aws-sdk/s3-request-presigner": "npm:^3.1149.0" - "@aws-sdk/signature-v4-crt": "npm:^3.1149.0" + "@aws-sdk/lib-storage": "npm:^3.1152.0" + "@aws-sdk/s3-presigned-post": "npm:^3.1152.0" + "@aws-sdk/s3-request-presigner": "npm:^3.1152.0" + "@aws-sdk/signature-v4-crt": "npm:^3.1152.0" "@benrbray/prosemirror-math": "npm:^0.2.2" "@bull-board/api": "npm:^6.21.3" "@bull-board/koa": "npm:^6.21.3" @@ -14389,7 +14308,7 @@ __metadata: "@koa/router": "npm:^15.7.0" "@koa/send": "npm:^6.0.0" "@linear/sdk": "npm:^97.0.0" - "@modelcontextprotocol/sdk": "npm:^1.31.0" + "@modelcontextprotocol/sdk": "npm:^1.32.1" "@noble/hashes": "npm:^2.4.0" "@node-oauth/oauth2-server": "npm:^5.3.0" "@notionhq/client": "npm:^2.3.0" @@ -14479,7 +14398,7 @@ __metadata: async-sema: "npm:^3.1.1" browserslist-to-esbuild: "npm:^1.2.0" bull: "npm:^4.16.5" - chrono-node: "npm:^2.10.1" + chrono-node: "npm:^2.10.3" class-validator: "npm:^0.15.1" command-score: "npm:^0.1.2" compressorjs: "npm:^1.3.0" @@ -14515,7 +14434,7 @@ __metadata: https-proxy-agent: "npm:^7.0.6" husky: "npm:^8.0.3" i18next: "npm:^22.5.1" - i18next-fs-backend: "npm:^2.6.8" + i18next-fs-backend: "npm:^2.6.9" i18next-http-backend: "npm:^3.0.6" i18next-parser: "npm:^9.4.0" invariant: "npm:^2.2.4" @@ -14542,7 +14461,7 @@ __metadata: lint-staged: "npm:^16.4.0" mailparser: "npm:^3.9.28" mammoth: "npm:^1.11.0" - markdown-it: "npm:^14.3.2" + markdown-it: "npm:^14.3.3" markdown-it-container: "npm:^3.0.0" markdown-it-emoji: "npm:^3.0.0" mime-types: "npm:^3.0.2" @@ -14553,7 +14472,6 @@ __metadata: natural-sort: "npm:^1.0.0" node-fetch: "npm:2.7.0" nodemailer: "npm:^10.0.9" - nodemon: "npm:^3.1.14" octokit: "npm:^5.0.5" outline-icons: "npm:^4.6.0" oxfmt: "npm:0.72.0" @@ -14647,7 +14565,7 @@ __metadata: uuid: "npm:^11.1.1" validator: "npm:13.15.35" vaul: "npm:^1.1.2" - vite: "npm:^8.3.2" + vite: "npm:^8.3.3" vite-plugin-pwa: "npm:1.3.0" vite-tsconfig-paths: "npm:^6.1.1" vitest: "npm:^4.1.11" @@ -15450,7 +15368,7 @@ __metadata: languageName: node linkType: hard -"picomatch@npm:^2.0.4, picomatch@npm:^2.2.1, picomatch@npm:^2.3.1": +"picomatch@npm:^2.0.4, picomatch@npm:^2.3.1": version: 2.3.2 resolution: "picomatch@npm:2.3.2" checksum: 10c0/a554d1709e59be97d1acb9eaedbbc700a5c03dbd4579807baed95100b00420bc729335440ef15004ae2378984e2487a7c1cebd743cfdb72b6fa9ab69223c0d61 @@ -15913,13 +15831,6 @@ __metadata: languageName: node linkType: hard -"pstree.remy@npm:^1.1.8": - version: 1.1.8 - resolution: "pstree.remy@npm:1.1.8" - checksum: 10c0/30f78c88ce6393cb3f7834216cb6e282eb83c92ccb227430d4590298ab2811bc4a4745f850a27c5178e79a8f3e316591de0fec87abc19da648c2b3c6eb766d14 - languageName: node - linkType: hard - "pump@npm:^3.0.0": version: 3.0.3 resolution: "pump@npm:3.0.3" @@ -16389,15 +16300,6 @@ __metadata: languageName: node linkType: hard -"readdirp@npm:~3.6.0": - version: 3.6.0 - resolution: "readdirp@npm:3.6.0" - dependencies: - picomatch: "npm:^2.2.1" - checksum: 10c0/6fa848cf63d1b82ab4e985f4cf72bd55b7dcfd8e0a376905804e48c3634b7e749170940ba77b32804d5fe93b3cc521aa95a8d7e7d725f830da6d93f3669ce66b - languageName: node - linkType: hard - "readline-sync@npm:^1.4.10": version: 1.4.10 resolution: "readline-sync@npm:1.4.10" @@ -17452,15 +17354,6 @@ __metadata: languageName: node linkType: hard -"simple-update-notifier@npm:^2.0.0": - version: 2.0.0 - resolution: "simple-update-notifier@npm:2.0.0" - dependencies: - semver: "npm:^7.5.3" - checksum: 10c0/2a00bd03bfbcbf8a737c47ab230d7920f8bfb92d1159d421bdd194479f6d01ebc995d13fbe13d45dace23066a78a3dc6642999b4e3b38b847e6664191575b20c - languageName: node - linkType: hard - "sirv@npm:^3.0.2": version: 3.0.2 resolution: "sirv@npm:3.0.2" @@ -18123,7 +18016,7 @@ __metadata: languageName: node linkType: hard -"supports-color@npm:^5.3.0, supports-color@npm:^5.5.0": +"supports-color@npm:^5.3.0": version: 5.5.0 resolution: "supports-color@npm:5.5.0" dependencies: @@ -18494,15 +18387,6 @@ __metadata: languageName: node linkType: hard -"touch@npm:^3.1.0": - version: 3.1.1 - resolution: "touch@npm:3.1.1" - bin: - nodetouch: bin/nodetouch.js - checksum: 10c0/d2e4d269a42c846a22a29065b9af0b263de58effc85a1764bb7a2e8fc4b47700e9e2fcbd7eb1f5bffbb7c73d860f93600cef282b93ddac8f0b62321cb498b36e - languageName: node - linkType: hard - "tough-cookie@npm:^4.1.2": version: 4.1.4 resolution: "tough-cookie@npm:4.1.4" @@ -18984,13 +18868,6 @@ __metadata: languageName: node linkType: hard -"undefsafe@npm:^2.0.5": - version: 2.0.5 - resolution: "undefsafe@npm:2.0.5" - checksum: 10c0/96c0466a5fbf395917974a921d5d4eee67bca4b30d3a31ce7e621e0228c479cf893e783a109af6e14329b52fe2f0cb4108665fad2b87b0018c0df6ac771261d5 - languageName: node - linkType: hard - "underscore.string@npm:~3.3.6": version: 3.3.6 resolution: "underscore.string@npm:3.3.6" @@ -19454,9 +19331,9 @@ __metadata: languageName: node linkType: hard -"vite@npm:^6.0.0 || ^7.0.0 || ^8.0.0, vite@npm:^8.3.2": - version: 8.3.2 - resolution: "vite@npm:8.3.2" +"vite@npm:^6.0.0 || ^7.0.0 || ^8.0.0, vite@npm:^8.3.3": + version: 8.3.3 + resolution: "vite@npm:8.3.3" dependencies: fsevents: "npm:~2.3.3" lightningcss: "npm:^1.33.0" @@ -19507,7 +19384,7 @@ __metadata: optional: true bin: vite: bin/vite.js - checksum: 10c0/bc2dc5b9077624686a0e4ddfdbfca9d35bf97a32c53966bf1cdd7f355a8f2c488c0422d1b02328a959cfd06b490f98c7e24938f8a251a1039adf2219f2da552e + checksum: 10c0/a1fa945ad1dd98d43e45d491eee11505083b19e00f8c5549cd0771273717f7bdb431eef71ef3568d1effa6ba63719811e5151f3fbec84be5a017d4975470a0d9 languageName: node linkType: hard