mirror of
https://github.com/outline/outline.git
synced 2026-11-25 07:04:37 +03:00
chore: Rename APIContext to Context and flatten its fields (#14684)
* chore: Rename APIContext to Context and flatten its fields Auth and transaction now live directly on the context instead of in ctx.state and a nested ctx.context, and model helpers read them directly. APIContext remains as a deprecated alias. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016MJXFeUxvU46KyvKnP8sXf * chore: Remove deprecated APIContext alias Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016MJXFeUxvU46KyvKnP8sXf * fix: Read auth from context in OAuth provider callbacks Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016MJXFeUxvU46KyvKnP8sXf * chore: Add withUser and withTransaction context helpers Replaces manual createContext rebuilds that copy fields from an existing context. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016MJXFeUxvU46KyvKnP8sXf * chore: Remove arbitrary property access from Koa context types AppContext and Context no longer inherit the any index signature from Koa's DefaultContext, custom fields are declared explicitly, and importing Koa's loose Context type is disallowed by lint. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016MJXFeUxvU46KyvKnP8sXf --------- Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
1 parent
fd66b5e020
commit
00b124d03c
164 files changed
+1574
-1592
No files matched your search
@@ -10,7 +10,7 @@ import validate from "@server/middlewares/validate";
|
||||
import validateWebhook from "@server/middlewares/validateWebhook";
|
||||
import { IntegrationAuthentication, Integration } from "@server/models";
|
||||
import { authorize } from "@server/policies";
|
||||
import type { APIContext } from "@server/types";
|
||||
import type { Context } from "@server/types";
|
||||
import { verifyOAuthStateNonce } from "@server/utils/oauth";
|
||||
import { RequestHelper } from "@server/utils/RequestHelper";
|
||||
import { GitHubOAuthNonceCookie, GitHubUtils } from "../../shared/GitHubUtils";
|
||||
@@ -35,7 +35,7 @@ router.get(
|
||||
getErrorPath: () => GitHubUtils.errorUrl("unauthenticated"),
|
||||
}),
|
||||
transaction(),
|
||||
async (ctx: APIContext<T.GitHubCallbackReq>) => {
|
||||
async (ctx: Context<T.GitHubCallbackReq>) => {
|
||||
const {
|
||||
code,
|
||||
state,
|
||||
@@ -43,8 +43,8 @@ router.get(
|
||||
installation_id: installationId,
|
||||
setup_action: setupAction,
|
||||
} = ctx.input.query;
|
||||
const { user } = ctx.state.auth;
|
||||
const { transaction } = ctx.state;
|
||||
const { user } = ctx.auth;
|
||||
const { transaction } = ctx;
|
||||
|
||||
if (error) {
|
||||
ctx.redirect(GitHubUtils.errorUrl(error));
|
||||
@@ -129,7 +129,7 @@ router.post(
|
||||
return signature?.split("=")[1];
|
||||
},
|
||||
}),
|
||||
async (ctx: APIContext) => {
|
||||
async (ctx: Context) => {
|
||||
const { headers } = ctx.request;
|
||||
const body = RequestHelper.getBodyObject(ctx.request);
|
||||
|
||||
|
||||
Reference in new issue
Block a user