* feat(api): add webhook CRUD API router and tests Add tRPC router for managing workspace webhooks: - list, create, update, delete endpoints (admin role required) - test endpoint to send a synthetic payload to a webhook URL - URL validation, event subscription filtering - Unit tests for all router procedures - Integration tests with PGlite test database - Add vitest config and test infrastructure for API package Depends on #391 (DB schema & repository). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * refactor(api): use assertPermission instead of assertUserInWorkspace Replace assertUserInWorkspace with assertPermission("workspace:manage") per project conventions. The permissions system is the preferred authorization approach for new code. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix(api): use @kan/db alias instead of relative imports in tests Replace relative path imports (../../db/src/...) with the @kan/db alias configured in vitest.config.ts for consistency and robustness. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * refactor(api): use webhookUrlSchema in router input validation Cherry-pick router-related changes from b2cc9ac: - Use extracted webhookUrlSchema zod validator in create/update input schemas for consistent SSRF checks Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * refactor(api): replace dynamic import with static import for webhook utility Add packages/api/src/utils/webhook.ts with sendWebhookToUrl, createCardWebhookPayload, and webhookUrlSchema. Replace the dynamic import() in the test endpoint with a static import at the top of the file for better tree-shaking, type-checking, and readability. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix(api): align sendWebhooksForWorkspace tests with merged PR #392 The merged delivery utility uses client-side event filtering (getActiveByWorkspaceId takes 2 args, not 3). Update test assertions to match the actual implementation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: Henry <30578846+hjball@users.noreply.github.com>
70 lines
1.8 KiB
JSON
70 lines
1.8 KiB
JSON
{
|
|
"name": "@kan/api",
|
|
"version": "0.1.0",
|
|
"private": true,
|
|
"type": "module",
|
|
"exports": {
|
|
".": {
|
|
"types": "./dist/index.d.ts",
|
|
"default": "./src/index.ts"
|
|
},
|
|
"./root": {
|
|
"types": "./dist/root.d.ts",
|
|
"default": "./src/root.ts"
|
|
},
|
|
"./trpc": {
|
|
"types": "./dist/trpc.d.ts",
|
|
"default": "./src/trpc.ts"
|
|
},
|
|
"./types": {
|
|
"types": "./dist/types.d.ts",
|
|
"default": "./src/types/router.types.ts"
|
|
},
|
|
"./openapi": {
|
|
"types": "./dist/openapi.d.ts",
|
|
"default": "./src/openapi.ts"
|
|
},
|
|
"./utils/rateLimit": {
|
|
"types": "./dist/utils/rateLimit.d.ts",
|
|
"default": "./src/utils/rateLimit.ts"
|
|
},
|
|
"./utils/permissions": {
|
|
"types": "./dist/utils/permissions.d.ts",
|
|
"default": "./src/utils/permissions.ts"
|
|
}
|
|
},
|
|
"license": "GPL-3.0",
|
|
"scripts": {
|
|
"build": "tsc",
|
|
"clean": "git clean -xdf .cache .turbo dist node_modules",
|
|
"dev": "tsc",
|
|
"format": "prettier --check . --ignore-path ../../.gitignore",
|
|
"lint": "eslint",
|
|
"test": "vitest run",
|
|
"test:watch": "vitest",
|
|
"typecheck": "tsc --noEmit --emitDeclarationOnly false"
|
|
},
|
|
"dependencies": {
|
|
"@kan/auth": "workspace:*",
|
|
"@kan/db": "workspace:*",
|
|
"@kan/email": "workspace:^",
|
|
"@kan/shared": "workspace:^",
|
|
"@kan/stripe": "workspace:^",
|
|
"@trpc/server": "catalog:",
|
|
"rate-limiter-flexible": "^9.0.1",
|
|
"superjson": "2.2.1",
|
|
"trpc-to-openapi": "^2.3.2",
|
|
"zod": "catalog:"
|
|
},
|
|
"devDependencies": {
|
|
"@kan/eslint-config": "workspace:*",
|
|
"@kan/prettier-config": "workspace:*",
|
|
"@kan/tsconfig": "workspace:*",
|
|
"eslint": "catalog:",
|
|
"prettier": "catalog:",
|
|
"typescript": "catalog:",
|
|
"vitest": "^3.0.0"
|
|
},
|
|
"prettier": "@kan/prettier-config"
|
|
}
|