mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-17 07:04:36 +00:00
src/auth/authenticator.ts is swap point 1: what the user submitted on the consent page → an upstream credential plus the identity it belongs to. The M1 implementation proxies Artcraft's own sign-in (POST /v1/login or /v1/accounts/google_sso through the auth-use upstream client), then identifies the user with the new session (GET /v1/session through a read client carrying that credential). Failures map to user-facing reasons (invalid_credentials, account_needs_password, google_rejected, not_signed_in, upstream_unavailable); 5xx and network errors never echo upstream details or the submission. test/helpers/contract.ts validates values against the spec snapshot with Ajv (2020-12 + formats); `fixture(schema, value)` validates a fixture at declaration. All authenticator fixtures pass — including a full SessionInfoSuccessResponse — so the tests exercise shapes the backend actually publishes. Tests (8): password success with the exact request sequence, headers, and body; InvalidCredentials and AccountNeedsPassword mapping; 5xx and network failures → upstream_unavailable without echo; anonymous session → not_signed_in; Google success and rejection with the server message. Also: pnpm workspace saveExact so `pnpm add` pins exactly. Claude-Session: https://claude.ai/code/session_01H3gfN2NCx3hBXSrZXYHUQ3
46 lines
1.3 KiB
JSON
46 lines
1.3 KiB
JSON
{
|
|
"name": "@artcraft/mcp",
|
|
"version": "0.0.0",
|
|
"private": true,
|
|
"description": "Artcraft MCP server — Cloudflare Worker at mcp.getartcraft.com",
|
|
"type": "module",
|
|
"packageManager": "pnpm@11.23.0",
|
|
"engines": {
|
|
"node": ">=22"
|
|
},
|
|
"scripts": {
|
|
"dev": "wrangler dev",
|
|
"deploy:preview": "wrangler deploy --env preview",
|
|
"deploy:production": "wrangler deploy --env production",
|
|
"gen:api": "node scripts/gen-api.mjs",
|
|
"types": "wrangler types",
|
|
"typecheck": "pnpm types && tsc --noEmit -p tsconfig.json",
|
|
"lint": "eslint .",
|
|
"format": "prettier --check .",
|
|
"format:write": "prettier --write .",
|
|
"test": "vitest run",
|
|
"test:watch": "vitest",
|
|
"check": "pnpm typecheck && pnpm lint && pnpm format && pnpm test"
|
|
},
|
|
"dependencies": {
|
|
"@cloudflare/workers-oauth-provider": "0.10.3",
|
|
"hono": "4.13.4",
|
|
"openapi-fetch": "0.17.0",
|
|
"zod": "4.4.3"
|
|
},
|
|
"devDependencies": {
|
|
"@cloudflare/vitest-pool-workers": "0.22.0",
|
|
"@eslint/js": "10.0.1",
|
|
"ajv": "8.20.0",
|
|
"ajv-formats": "3.0.1",
|
|
"eslint": "10.9.1",
|
|
"openapi-typescript": "7.13.0",
|
|
"prettier": "3.9.6",
|
|
"smol-toml": "1.8.0",
|
|
"typescript": "5.9.3",
|
|
"typescript-eslint": "8.68.0",
|
|
"vitest": "4.1.11",
|
|
"wrangler": "4.125.0"
|
|
}
|
|
}
|