Files
Docwell/Database/pb_migrations/1764600000_integrations.js
T
tajniak81andClaude Opus 5.5 f1963f1391 Add Confluence import, a Slack app per workspace, and GitHub, Linear and Figma link previews
Link previews: link cards for GitHub issues, pull requests and
repositories, Linear issues and Figma files are read through the
services' APIs and show a status pill (Open, Merged, In Progress…) and a
line of details. Public items need nothing; a workspace's tokens, set by
its admins under Workspace settings → Integrations and checked with each
service before being sealed, reach private ones and Linear.
GET /link-preview takes the workspace; the link card stores kind,
status, state and meta.

Slack: each workspace connects its own Slack app, made from a manifest
the settings page fills in. Docwell posts chosen page and comment events
to a channel (edits at most every 30 minutes per page), previews links
to Docwell pages posted in Slack, and answers /docwell with a search as
the member whose email matches the Slack user, shown only to them. Only
pages every member can open are posted or previewed. Requests from Slack
are signature-checked; the webhook dispatcher gained listeners so Slack
follows the same events.

Confluence: a space's HTML export imports with its page tree (from
index.html, else breadcrumbs), links between pages, pictures and
attachments. Panels become callouts, code macros code blocks with their
language, expand macros toggles, task lists to-dos.

New collection workspace_integrations (schema snapshot regenerated),
OpenAPI and generated Go, TypeScript and Dart types, strings in all five
languages, the user guide, and a rebuilt mobile editor bundle.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 20:42:11 +01:00

47 lines
2.0 KiB
JavaScript

// SPDX-License-Identifier: AGPL-3.0-or-later
/// <reference path="../pb_data/types.d.ts" />
// Workspace integrations (ADR-18): one record per workspace.
//
// - github, linear, figma: tokens (sealed by docwell-server) that let link
// previews read private issues, pull requests and files.
// - slack_*: the workspace's own Slack app. slack_bot and slack_signing are
// sealed; slack_team is the Slack workspace the bot belongs to;
// slack_channel gets the slack_events Docwell posts; slack_unfurl previews
// Docwell links in Slack, slack_search answers /docwell.
migrate(
(app) => {
const workspaces = app.findCollectionByNameOrId("workspaces");
app.save(
new Collection({
type: "base",
name: "workspace_integrations",
fields: [
{ name: "workspace", type: "relation", collectionId: workspaces.id, maxSelect: 1, required: true, cascadeDelete: true },
{ name: "github", type: "text", max: 2000 },
{ name: "linear", type: "text", max: 2000 },
{ name: "figma", type: "text", max: 2000 },
{ name: "slack_bot", type: "text", max: 2000 },
{ name: "slack_signing", type: "text", max: 2000 },
{ name: "slack_team", type: "text", max: 40 },
{ name: "slack_team_name", type: "text", max: 200 },
{ name: "slack_channel", type: "text", max: 40 },
{ name: "slack_channel_name", type: "text", max: 200 },
{ name: "slack_events", type: "json", maxSize: 4000 },
{ name: "slack_unfurl", type: "bool" },
{ name: "slack_search", type: "bool" },
{ name: "slack_error", type: "text", max: 1000 },
{ name: "created", type: "autodate", onCreate: true, onUpdate: false },
{ name: "updated", type: "autodate", onCreate: true, onUpdate: true },
],
indexes: ["CREATE UNIQUE INDEX idx_workspace_integrations_workspace ON workspace_integrations (workspace)"],
}),
);
},
(app) => {
app.delete(app.findCollectionByNameOrId("workspace_integrations"));
},
);