agentrix 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +235 -0
- package/bin/agentrix.js +5 -0
- package/dist/api/auth.d.ts +10 -0
- package/dist/api/auth.d.ts.map +1 -0
- package/dist/api/auth.js +30 -0
- package/dist/api/auth.js.map +1 -0
- package/dist/api/automation.d.ts +52 -0
- package/dist/api/automation.d.ts.map +1 -0
- package/dist/api/automation.js +181 -0
- package/dist/api/automation.js.map +1 -0
- package/dist/api/base-handler.d.ts +62 -0
- package/dist/api/base-handler.d.ts.map +1 -0
- package/dist/api/base-handler.js +55 -0
- package/dist/api/base-handler.js.map +1 -0
- package/dist/api/config.d.ts +5 -0
- package/dist/api/config.d.ts.map +1 -0
- package/dist/api/config.js +14 -0
- package/dist/api/config.js.map +1 -0
- package/dist/api/create-plan.d.ts +8 -0
- package/dist/api/create-plan.d.ts.map +1 -0
- package/dist/api/create-plan.js +77 -0
- package/dist/api/create-plan.js.map +1 -0
- package/dist/api/git-status.d.ts +6 -0
- package/dist/api/git-status.d.ts.map +1 -0
- package/dist/api/git-status.js +57 -0
- package/dist/api/git-status.js.map +1 -0
- package/dist/api/plans.d.ts +6 -0
- package/dist/api/plans.d.ts.map +1 -0
- package/dist/api/plans.js +75 -0
- package/dist/api/plans.js.map +1 -0
- package/dist/api/repo-dashboard.d.ts +13 -0
- package/dist/api/repo-dashboard.d.ts.map +1 -0
- package/dist/api/repo-dashboard.js +47 -0
- package/dist/api/repo-dashboard.js.map +1 -0
- package/dist/api/repo-issue.d.ts +12 -0
- package/dist/api/repo-issue.d.ts.map +1 -0
- package/dist/api/repo-issue.js +47 -0
- package/dist/api/repo-issue.js.map +1 -0
- package/dist/api/repos.d.ts +9 -0
- package/dist/api/repos.d.ts.map +1 -0
- package/dist/api/repos.js +46 -0
- package/dist/api/repos.js.map +1 -0
- package/dist/api/sessions.d.ts +5 -0
- package/dist/api/sessions.d.ts.map +1 -0
- package/dist/api/sessions.js +19 -0
- package/dist/api/sessions.js.map +1 -0
- package/dist/api/tasks.d.ts +6 -0
- package/dist/api/tasks.d.ts.map +1 -0
- package/dist/api/tasks.js +22 -0
- package/dist/api/tasks.js.map +1 -0
- package/dist/api/terminal.d.ts +7 -0
- package/dist/api/terminal.d.ts.map +1 -0
- package/dist/api/terminal.js +16 -0
- package/dist/api/terminal.js.map +1 -0
- package/dist/api/worktrees.d.ts +7 -0
- package/dist/api/worktrees.d.ts.map +1 -0
- package/dist/api/worktrees.js +26 -0
- package/dist/api/worktrees.js.map +1 -0
- package/dist/cli/arg-parser.d.ts +3 -0
- package/dist/cli/arg-parser.d.ts.map +1 -0
- package/dist/cli/arg-parser.js +243 -0
- package/dist/cli/arg-parser.js.map +1 -0
- package/dist/cli/config-resolver.d.ts +29 -0
- package/dist/cli/config-resolver.d.ts.map +1 -0
- package/dist/cli/config-resolver.js +139 -0
- package/dist/cli/config-resolver.js.map +1 -0
- package/dist/cli/config.d.ts +5 -0
- package/dist/cli/config.d.ts.map +1 -0
- package/dist/cli/config.js +224 -0
- package/dist/cli/config.js.map +1 -0
- package/dist/cli/constants.d.ts +7 -0
- package/dist/cli/constants.d.ts.map +1 -0
- package/dist/cli/constants.js +15 -0
- package/dist/cli/constants.js.map +1 -0
- package/dist/cli/help.d.ts +3 -0
- package/dist/cli/help.d.ts.map +1 -0
- package/dist/cli/help.js +35 -0
- package/dist/cli/help.js.map +1 -0
- package/dist/cli/index.d.ts +23 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +23 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/plans-command.d.ts +3 -0
- package/dist/cli/plans-command.d.ts.map +1 -0
- package/dist/cli/plans-command.js +151 -0
- package/dist/cli/plans-command.js.map +1 -0
- package/dist/cli/server-starter.d.ts +26 -0
- package/dist/cli/server-starter.d.ts.map +1 -0
- package/dist/cli/server-starter.js +72 -0
- package/dist/cli/server-starter.js.map +1 -0
- package/dist/cli/types.d.ts +46 -0
- package/dist/cli/types.d.ts.map +1 -0
- package/dist/cli/types.js +2 -0
- package/dist/cli/types.js.map +1 -0
- package/dist/cli/validation.d.ts +14 -0
- package/dist/cli/validation.d.ts.map +1 -0
- package/dist/cli/validation.js +99 -0
- package/dist/cli/validation.js.map +1 -0
- package/dist/cli.d.ts +5 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +73 -0
- package/dist/cli.js.map +1 -0
- package/dist/config/agent-commands.d.ts +27 -0
- package/dist/config/agent-commands.d.ts.map +1 -0
- package/dist/config/agent-commands.js +56 -0
- package/dist/config/agent-commands.js.map +1 -0
- package/dist/config/constants.d.ts +35 -0
- package/dist/config/constants.d.ts.map +1 -0
- package/dist/config/constants.js +35 -0
- package/dist/config/constants.js.map +1 -0
- package/dist/config/developer-messages.d.ts +2 -0
- package/dist/config/developer-messages.d.ts.map +1 -0
- package/dist/config/developer-messages.js +43 -0
- package/dist/config/developer-messages.js.map +1 -0
- package/dist/core/agents.d.ts +23 -0
- package/dist/core/agents.d.ts.map +1 -0
- package/dist/core/agents.js +91 -0
- package/dist/core/agents.js.map +1 -0
- package/dist/core/auth.d.ts +3 -0
- package/dist/core/auth.d.ts.map +1 -0
- package/dist/core/auth.js +69 -0
- package/dist/core/auth.js.map +1 -0
- package/dist/core/automation/branch.d.ts +18 -0
- package/dist/core/automation/branch.d.ts.map +1 -0
- package/dist/core/automation/branch.js +29 -0
- package/dist/core/automation/branch.js.map +1 -0
- package/dist/core/automation/git-orchestration.d.ts +51 -0
- package/dist/core/automation/git-orchestration.d.ts.map +1 -0
- package/dist/core/automation/git-orchestration.js +25 -0
- package/dist/core/automation/git-orchestration.js.map +1 -0
- package/dist/core/automation/plan.d.ts +15 -0
- package/dist/core/automation/plan.d.ts.map +1 -0
- package/dist/core/automation/plan.js +25 -0
- package/dist/core/automation/plan.js.map +1 -0
- package/dist/core/automation/request-validation.d.ts +45 -0
- package/dist/core/automation/request-validation.d.ts.map +1 -0
- package/dist/core/automation/request-validation.js +144 -0
- package/dist/core/automation/request-validation.js.map +1 -0
- package/dist/core/automation/task-runner.d.ts +42 -0
- package/dist/core/automation/task-runner.d.ts.map +1 -0
- package/dist/core/automation/task-runner.js +215 -0
- package/dist/core/automation/task-runner.js.map +1 -0
- package/dist/core/branch-name.d.ts +13 -0
- package/dist/core/branch-name.d.ts.map +1 -0
- package/dist/core/branch-name.js +429 -0
- package/dist/core/branch-name.js.map +1 -0
- package/dist/core/default-branch.d.ts +12 -0
- package/dist/core/default-branch.d.ts.map +1 -0
- package/dist/core/default-branch.js +78 -0
- package/dist/core/default-branch.js.map +1 -0
- package/dist/core/event-bus.d.ts +73 -0
- package/dist/core/event-bus.d.ts.map +1 -0
- package/dist/core/event-bus.js +127 -0
- package/dist/core/event-bus.js.map +1 -0
- package/dist/core/git.d.ts +13 -0
- package/dist/core/git.d.ts.map +1 -0
- package/dist/core/git.js +15 -0
- package/dist/core/git.js.map +1 -0
- package/dist/core/github.d.ts +10 -0
- package/dist/core/github.d.ts.map +1 -0
- package/dist/core/github.js +245 -0
- package/dist/core/github.js.map +1 -0
- package/dist/core/plan-storage.d.ts +46 -0
- package/dist/core/plan-storage.d.ts.map +1 -0
- package/dist/core/plan-storage.js +237 -0
- package/dist/core/plan-storage.js.map +1 -0
- package/dist/core/plan.d.ts +23 -0
- package/dist/core/plan.d.ts.map +1 -0
- package/dist/core/plan.js +445 -0
- package/dist/core/plan.js.map +1 -0
- package/dist/core/repositories.d.ts +2 -0
- package/dist/core/repositories.d.ts.map +1 -0
- package/dist/core/repositories.js +58 -0
- package/dist/core/repositories.js.map +1 -0
- package/dist/core/repository-config.d.ts +9 -0
- package/dist/core/repository-config.d.ts.map +1 -0
- package/dist/core/repository-config.js +65 -0
- package/dist/core/repository-config.js.map +1 -0
- package/dist/core/task-store.d.ts +14 -0
- package/dist/core/task-store.d.ts.map +1 -0
- package/dist/core/task-store.js +105 -0
- package/dist/core/task-store.js.map +1 -0
- package/dist/core/tasks.d.ts +62 -0
- package/dist/core/tasks.d.ts.map +1 -0
- package/dist/core/tasks.js +582 -0
- package/dist/core/tasks.js.map +1 -0
- package/dist/core/terminal-sessions.d.ts +18 -0
- package/dist/core/terminal-sessions.d.ts.map +1 -0
- package/dist/core/terminal-sessions.js +539 -0
- package/dist/core/terminal-sessions.js.map +1 -0
- package/dist/core/tmux.d.ts +29 -0
- package/dist/core/tmux.d.ts.map +1 -0
- package/dist/core/tmux.js +151 -0
- package/dist/core/tmux.js.map +1 -0
- package/dist/core/workdir.d.ts +8 -0
- package/dist/core/workdir.d.ts.map +1 -0
- package/dist/core/workdir.js +26 -0
- package/dist/core/workdir.js.map +1 -0
- package/dist/domain/branch-validator.d.ts +51 -0
- package/dist/domain/branch-validator.d.ts.map +1 -0
- package/dist/domain/branch-validator.js +88 -0
- package/dist/domain/branch-validator.js.map +1 -0
- package/dist/domain/git-url-parser.d.ts +27 -0
- package/dist/domain/git-url-parser.d.ts.map +1 -0
- package/dist/domain/git-url-parser.js +84 -0
- package/dist/domain/git-url-parser.js.map +1 -0
- package/dist/domain/index.d.ts +8 -0
- package/dist/domain/index.d.ts.map +1 -0
- package/dist/domain/index.js +5 -0
- package/dist/domain/index.js.map +1 -0
- package/dist/domain/repository.d.ts +55 -0
- package/dist/domain/repository.d.ts.map +1 -0
- package/dist/domain/repository.js +73 -0
- package/dist/domain/repository.js.map +1 -0
- package/dist/domain/worktree.d.ts +43 -0
- package/dist/domain/worktree.d.ts.map +1 -0
- package/dist/domain/worktree.js +57 -0
- package/dist/domain/worktree.js.map +1 -0
- package/dist/infrastructure/cookies/cookie-manager.d.ts +18 -0
- package/dist/infrastructure/cookies/cookie-manager.d.ts.map +1 -0
- package/dist/infrastructure/cookies/cookie-manager.js +20 -0
- package/dist/infrastructure/cookies/cookie-manager.js.map +1 -0
- package/dist/infrastructure/cookies/cookie-parser.d.ts +43 -0
- package/dist/infrastructure/cookies/cookie-parser.d.ts.map +1 -0
- package/dist/infrastructure/cookies/cookie-parser.js +88 -0
- package/dist/infrastructure/cookies/cookie-parser.js.map +1 -0
- package/dist/infrastructure/cookies/cookie-security.d.ts +15 -0
- package/dist/infrastructure/cookies/cookie-security.d.ts.map +1 -0
- package/dist/infrastructure/cookies/cookie-security.js +35 -0
- package/dist/infrastructure/cookies/cookie-security.js.map +1 -0
- package/dist/infrastructure/cookies/index.d.ts +7 -0
- package/dist/infrastructure/cookies/index.d.ts.map +1 -0
- package/dist/infrastructure/cookies/index.js +4 -0
- package/dist/infrastructure/cookies/index.js.map +1 -0
- package/dist/infrastructure/errors/error-handler.d.ts +22 -0
- package/dist/infrastructure/errors/error-handler.d.ts.map +1 -0
- package/dist/infrastructure/errors/error-handler.js +89 -0
- package/dist/infrastructure/errors/error-handler.js.map +1 -0
- package/dist/infrastructure/errors/http-error.d.ts +30 -0
- package/dist/infrastructure/errors/http-error.d.ts.map +1 -0
- package/dist/infrastructure/errors/http-error.js +46 -0
- package/dist/infrastructure/errors/http-error.js.map +1 -0
- package/dist/infrastructure/errors/index.d.ts +5 -0
- package/dist/infrastructure/errors/index.d.ts.map +1 -0
- package/dist/infrastructure/errors/index.js +5 -0
- package/dist/infrastructure/errors/index.js.map +1 -0
- package/dist/infrastructure/errors/not-found-error.d.ts +8 -0
- package/dist/infrastructure/errors/not-found-error.d.ts.map +1 -0
- package/dist/infrastructure/errors/not-found-error.js +13 -0
- package/dist/infrastructure/errors/not-found-error.js.map +1 -0
- package/dist/infrastructure/errors/validation-error.d.ts +21 -0
- package/dist/infrastructure/errors/validation-error.d.ts.map +1 -0
- package/dist/infrastructure/errors/validation-error.js +31 -0
- package/dist/infrastructure/errors/validation-error.js.map +1 -0
- package/dist/infrastructure/logging/index.d.ts +3 -0
- package/dist/infrastructure/logging/index.d.ts.map +1 -0
- package/dist/infrastructure/logging/index.js +2 -0
- package/dist/infrastructure/logging/index.js.map +1 -0
- package/dist/infrastructure/logging/logger.d.ts +21 -0
- package/dist/infrastructure/logging/logger.d.ts.map +1 -0
- package/dist/infrastructure/logging/logger.js +49 -0
- package/dist/infrastructure/logging/logger.js.map +1 -0
- package/dist/repositories/git-repository.d.ts +67 -0
- package/dist/repositories/git-repository.d.ts.map +1 -0
- package/dist/repositories/git-repository.js +111 -0
- package/dist/repositories/git-repository.js.map +1 -0
- package/dist/repositories/git-status-repository.d.ts +22 -0
- package/dist/repositories/git-status-repository.d.ts.map +1 -0
- package/dist/repositories/git-status-repository.js +620 -0
- package/dist/repositories/git-status-repository.js.map +1 -0
- package/dist/repositories/repository-repository.d.ts +44 -0
- package/dist/repositories/repository-repository.d.ts.map +1 -0
- package/dist/repositories/repository-repository.js +155 -0
- package/dist/repositories/repository-repository.js.map +1 -0
- package/dist/repositories/worktree-repository.d.ts +66 -0
- package/dist/repositories/worktree-repository.d.ts.map +1 -0
- package/dist/repositories/worktree-repository.js +330 -0
- package/dist/repositories/worktree-repository.js.map +1 -0
- package/dist/server/cookies.d.ts +6 -0
- package/dist/server/cookies.d.ts.map +1 -0
- package/dist/server/cookies.js +6 -0
- package/dist/server/cookies.js.map +1 -0
- package/dist/server/events.d.ts +8 -0
- package/dist/server/events.d.ts.map +1 -0
- package/dist/server/events.js +128 -0
- package/dist/server/events.js.map +1 -0
- package/dist/server/index.d.ts +18 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/index.js +173 -0
- package/dist/server/index.js.map +1 -0
- package/dist/server/router.d.ts +16 -0
- package/dist/server/router.d.ts.map +1 -0
- package/dist/server/router.js +256 -0
- package/dist/server/router.js.map +1 -0
- package/dist/server/ui.d.ts +8 -0
- package/dist/server/ui.d.ts.map +1 -0
- package/dist/server/ui.js +211 -0
- package/dist/server/ui.js.map +1 -0
- package/dist/server/websocket.d.ts +9 -0
- package/dist/server/websocket.d.ts.map +1 -0
- package/dist/server/websocket.js +116 -0
- package/dist/server/websocket.js.map +1 -0
- package/dist/services/auth-service.d.ts +49 -0
- package/dist/services/auth-service.d.ts.map +1 -0
- package/dist/services/auth-service.js +53 -0
- package/dist/services/auth-service.js.map +1 -0
- package/dist/services/index.d.ts +11 -0
- package/dist/services/index.d.ts.map +1 -0
- package/dist/services/index.js +6 -0
- package/dist/services/index.js.map +1 -0
- package/dist/services/repository-service.d.ts +57 -0
- package/dist/services/repository-service.d.ts.map +1 -0
- package/dist/services/repository-service.js +62 -0
- package/dist/services/repository-service.js.map +1 -0
- package/dist/services/session-service.d.ts +31 -0
- package/dist/services/session-service.d.ts.map +1 -0
- package/dist/services/session-service.js +134 -0
- package/dist/services/session-service.js.map +1 -0
- package/dist/services/terminal-service.d.ts +43 -0
- package/dist/services/terminal-service.d.ts.map +1 -0
- package/dist/services/terminal-service.js +85 -0
- package/dist/services/terminal-service.js.map +1 -0
- package/dist/services/worktree-service.d.ts +39 -0
- package/dist/services/worktree-service.d.ts.map +1 -0
- package/dist/services/worktree-service.js +208 -0
- package/dist/services/worktree-service.js.map +1 -0
- package/dist/types/auth.d.ts +35 -0
- package/dist/types/auth.d.ts.map +1 -0
- package/dist/types/auth.js +2 -0
- package/dist/types/auth.js.map +1 -0
- package/dist/types/config.d.ts +46 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/config.js +5 -0
- package/dist/types/config.js.map +1 -0
- package/dist/types/git.d.ts +190 -0
- package/dist/types/git.d.ts.map +1 -0
- package/dist/types/git.js +5 -0
- package/dist/types/git.js.map +1 -0
- package/dist/types/http.d.ts +46 -0
- package/dist/types/http.d.ts.map +1 -0
- package/dist/types/http.js +2 -0
- package/dist/types/http.js.map +1 -0
- package/dist/types/index.d.ts +8 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/plan.d.ts +31 -0
- package/dist/types/plan.d.ts.map +1 -0
- package/dist/types/plan.js +5 -0
- package/dist/types/plan.js.map +1 -0
- package/dist/types/services.d.ts +99 -0
- package/dist/types/services.d.ts.map +1 -0
- package/dist/types/services.js +2 -0
- package/dist/types/services.js.map +1 -0
- package/dist/types/tasks.d.ts +68 -0
- package/dist/types/tasks.d.ts.map +1 -0
- package/dist/types/tasks.js +5 -0
- package/dist/types/tasks.js.map +1 -0
- package/dist/types/terminal.d.ts +60 -0
- package/dist/types/terminal.d.ts.map +1 -0
- package/dist/types/terminal.js +2 -0
- package/dist/types/terminal.js.map +1 -0
- package/dist/utils/cookies.d.ts +7 -0
- package/dist/utils/cookies.d.ts.map +1 -0
- package/dist/utils/cookies.js +6 -0
- package/dist/utils/cookies.js.map +1 -0
- package/dist/utils/http.d.ts +23 -0
- package/dist/utils/http.d.ts.map +1 -0
- package/dist/utils/http.js +58 -0
- package/dist/utils/http.js.map +1 -0
- package/dist/utils/random.d.ts +12 -0
- package/dist/utils/random.d.ts.map +1 -0
- package/dist/utils/random.js +25 -0
- package/dist/utils/random.js.map +1 -0
- package/dist/utils/repository-cache.d.ts +8 -0
- package/dist/utils/repository-cache.d.ts.map +1 -0
- package/dist/utils/repository-cache.js +13 -0
- package/dist/utils/repository-cache.js.map +1 -0
- package/dist/validation/index.d.ts +9 -0
- package/dist/validation/index.d.ts.map +1 -0
- package/dist/validation/index.js +6 -0
- package/dist/validation/index.js.map +1 -0
- package/dist/validation/request-validator.d.ts +99 -0
- package/dist/validation/request-validator.d.ts.map +1 -0
- package/dist/validation/request-validator.js +189 -0
- package/dist/validation/request-validator.js.map +1 -0
- package/dist/validation/schemas/repository-schema.d.ts +26 -0
- package/dist/validation/schemas/repository-schema.d.ts.map +1 -0
- package/dist/validation/schemas/repository-schema.js +31 -0
- package/dist/validation/schemas/repository-schema.js.map +1 -0
- package/dist/validation/schemas/terminal-schema.d.ts +21 -0
- package/dist/validation/schemas/terminal-schema.d.ts.map +1 -0
- package/dist/validation/schemas/terminal-schema.js +38 -0
- package/dist/validation/schemas/terminal-schema.js.map +1 -0
- package/dist/validation/schemas/worktree-schema.d.ts +21 -0
- package/dist/validation/schemas/worktree-schema.d.ts.map +1 -0
- package/dist/validation/schemas/worktree-schema.js +29 -0
- package/dist/validation/schemas/worktree-schema.js.map +1 -0
- package/package.json +79 -0
- package/ui/dist/assets/index-BDDrbP3l.js +354 -0
- package/ui/dist/assets/index-CwB7gOl4.css +41 -0
- package/ui/dist/index.html +13 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Worktree domain entity
|
|
3
|
+
*/
|
|
4
|
+
export interface WorktreeData {
|
|
5
|
+
path: string;
|
|
6
|
+
branch: string;
|
|
7
|
+
org: string;
|
|
8
|
+
repo: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Represents a Git worktree
|
|
12
|
+
*/
|
|
13
|
+
export declare class Worktree {
|
|
14
|
+
readonly path: string;
|
|
15
|
+
readonly branch: string;
|
|
16
|
+
readonly org: string;
|
|
17
|
+
readonly repo: string;
|
|
18
|
+
constructor({ path, branch, org, repo }: WorktreeData);
|
|
19
|
+
/**
|
|
20
|
+
* Gets the unique key for this worktree
|
|
21
|
+
* @returns Format: org::repo::branch
|
|
22
|
+
*/
|
|
23
|
+
getKey(): string;
|
|
24
|
+
/**
|
|
25
|
+
* Gets the repository identifier
|
|
26
|
+
* @returns Format: org/repo
|
|
27
|
+
*/
|
|
28
|
+
getRepositoryId(): string;
|
|
29
|
+
/**
|
|
30
|
+
* Checks if this is the main worktree
|
|
31
|
+
* @param defaultBranch - The default branch name
|
|
32
|
+
* @returns True if this is the main worktree
|
|
33
|
+
*/
|
|
34
|
+
isMainWorktree(defaultBranch?: string): boolean;
|
|
35
|
+
toJSON(): WorktreeData;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Creates a worktree instance from raw data
|
|
39
|
+
* @param data - Raw worktree data
|
|
40
|
+
* @returns Worktree instance
|
|
41
|
+
*/
|
|
42
|
+
export declare function createWorktree(data: WorktreeData): Worktree;
|
|
43
|
+
//# sourceMappingURL=worktree.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worktree.d.ts","sourceRoot":"","sources":["../../src/domain/worktree.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,qBAAa,QAAQ;IACnB,SAAgB,IAAI,EAAE,MAAM,CAAC;IAC7B,SAAgB,MAAM,EAAE,MAAM,CAAC;IAC/B,SAAgB,GAAG,EAAE,MAAM,CAAC;IAC5B,SAAgB,IAAI,EAAE,MAAM,CAAC;gBAEjB,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,YAAY;IAOrD;;;OAGG;IACH,MAAM,IAAI,MAAM;IAIhB;;;OAGG;IACH,eAAe,IAAI,MAAM;IAIzB;;;;OAIG;IACH,cAAc,CAAC,aAAa,GAAE,MAAe,GAAG,OAAO;IAIvD,MAAM,IAAI,YAAY;CAQvB;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,YAAY,GAAG,QAAQ,CAE3D"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Worktree domain entity
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Represents a Git worktree
|
|
6
|
+
*/
|
|
7
|
+
export class Worktree {
|
|
8
|
+
path;
|
|
9
|
+
branch;
|
|
10
|
+
org;
|
|
11
|
+
repo;
|
|
12
|
+
constructor({ path, branch, org, repo }) {
|
|
13
|
+
this.path = path;
|
|
14
|
+
this.branch = branch;
|
|
15
|
+
this.org = org;
|
|
16
|
+
this.repo = repo;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Gets the unique key for this worktree
|
|
20
|
+
* @returns Format: org::repo::branch
|
|
21
|
+
*/
|
|
22
|
+
getKey() {
|
|
23
|
+
return `${this.org}::${this.repo}::${this.branch}`;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Gets the repository identifier
|
|
27
|
+
* @returns Format: org/repo
|
|
28
|
+
*/
|
|
29
|
+
getRepositoryId() {
|
|
30
|
+
return `${this.org}/${this.repo}`;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Checks if this is the main worktree
|
|
34
|
+
* @param defaultBranch - The default branch name
|
|
35
|
+
* @returns True if this is the main worktree
|
|
36
|
+
*/
|
|
37
|
+
isMainWorktree(defaultBranch = 'main') {
|
|
38
|
+
return typeof this.branch === 'string' && this.branch.toLowerCase() === defaultBranch.toLowerCase();
|
|
39
|
+
}
|
|
40
|
+
toJSON() {
|
|
41
|
+
return {
|
|
42
|
+
path: this.path,
|
|
43
|
+
branch: this.branch,
|
|
44
|
+
org: this.org,
|
|
45
|
+
repo: this.repo,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Creates a worktree instance from raw data
|
|
51
|
+
* @param data - Raw worktree data
|
|
52
|
+
* @returns Worktree instance
|
|
53
|
+
*/
|
|
54
|
+
export function createWorktree(data) {
|
|
55
|
+
return new Worktree(data);
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=worktree.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worktree.js","sourceRoot":"","sources":["../../src/domain/worktree.ts"],"names":[],"mappings":"AAAA;;GAEG;AASH;;GAEG;AACH,MAAM,OAAO,QAAQ;IACH,IAAI,CAAS;IACb,MAAM,CAAS;IACf,GAAG,CAAS;IACZ,IAAI,CAAS;IAE7B,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAgB;QACnD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED;;;OAGG;IACH,MAAM;QACJ,OAAO,GAAG,IAAI,CAAC,GAAG,KAAK,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,MAAM,EAAE,CAAC;IACrD,CAAC;IAED;;;OAGG;IACH,eAAe;QACb,OAAO,GAAG,IAAI,CAAC,GAAG,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;IACpC,CAAC;IAED;;;;OAIG;IACH,cAAc,CAAC,gBAAwB,MAAM;QAC3C,OAAO,OAAO,IAAI,CAAC,MAAM,KAAK,QAAQ,IAAI,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,KAAK,aAAa,CAAC,WAAW,EAAE,CAAC;IACtG,CAAC;IAED,MAAM;QACJ,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,IAAI,EAAE,IAAI,CAAC,IAAI;SAChB,CAAC;IACJ,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,IAAkB;IAC/C,OAAO,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC;AAC5B,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { IncomingMessage } from 'node:http';
|
|
2
|
+
export interface CookieManagerOptions {
|
|
3
|
+
secureSetting: string | boolean | undefined;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Creates a cookie manager that handles secure flag resolution
|
|
7
|
+
* @param options - Configuration options
|
|
8
|
+
* @returns Cookie manager instance
|
|
9
|
+
*/
|
|
10
|
+
export declare function createCookieManager({ secureSetting }: CookieManagerOptions): {
|
|
11
|
+
/**
|
|
12
|
+
* Resolves whether to use secure cookies for a request
|
|
13
|
+
* @param req - HTTP request object
|
|
14
|
+
* @returns Whether to set Secure flag
|
|
15
|
+
*/
|
|
16
|
+
resolveSecure(req: IncomingMessage): boolean;
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=cookie-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cookie-manager.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/cookies/cookie-manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAGjD,MAAM,WAAW,oBAAoB;IACnC,aAAa,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;CAC7C;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,EAAE,aAAa,EAAE,EAAE,oBAAoB;IAIvE;;;;OAIG;uBACgB,eAAe,GAAG,OAAO;EAI/C"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { determineSecureCookie } from './cookie-security.js';
|
|
2
|
+
/**
|
|
3
|
+
* Creates a cookie manager that handles secure flag resolution
|
|
4
|
+
* @param options - Configuration options
|
|
5
|
+
* @returns Cookie manager instance
|
|
6
|
+
*/
|
|
7
|
+
export function createCookieManager({ secureSetting }) {
|
|
8
|
+
const normalized = typeof secureSetting === 'string' ? secureSetting.trim().toLowerCase() : secureSetting;
|
|
9
|
+
return {
|
|
10
|
+
/**
|
|
11
|
+
* Resolves whether to use secure cookies for a request
|
|
12
|
+
* @param req - HTTP request object
|
|
13
|
+
* @returns Whether to set Secure flag
|
|
14
|
+
*/
|
|
15
|
+
resolveSecure(req) {
|
|
16
|
+
return determineSecureCookie({ configValue: normalized, request: req });
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=cookie-manager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cookie-manager.js","sourceRoot":"","sources":["../../../src/infrastructure/cookies/cookie-manager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAM7D;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAAC,EAAE,aAAa,EAAwB;IACzE,MAAM,UAAU,GAAG,OAAO,aAAa,KAAK,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC;IAE1G,OAAO;QACL;;;;WAIG;QACH,aAAa,CAAC,GAAoB;YAChC,OAAO,qBAAqB,CAAC,EAAE,WAAW,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC;QAC1E,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { ServerResponse } from 'node:http';
|
|
2
|
+
export interface CookieOptions {
|
|
3
|
+
maxAge?: number;
|
|
4
|
+
expires?: Date;
|
|
5
|
+
path?: string;
|
|
6
|
+
domain?: string;
|
|
7
|
+
secure?: boolean;
|
|
8
|
+
httpOnly?: boolean;
|
|
9
|
+
sameSite?: 'Strict' | 'Lax' | 'None';
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Cookie parsing and serialization utilities
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Parses a Cookie header string into an object
|
|
16
|
+
* @param header - The Cookie header value
|
|
17
|
+
* @returns Object mapping cookie names to values
|
|
18
|
+
*/
|
|
19
|
+
export declare function parseCookies(header: string | undefined): Record<string, string>;
|
|
20
|
+
/**
|
|
21
|
+
* Serializes a cookie with options into a Set-Cookie header value
|
|
22
|
+
* @param name - Cookie name
|
|
23
|
+
* @param value - Cookie value
|
|
24
|
+
* @param options - Cookie options
|
|
25
|
+
* @returns Set-Cookie header value
|
|
26
|
+
*/
|
|
27
|
+
export declare function serializeCookie(name: string, value: string, options?: CookieOptions): string;
|
|
28
|
+
/**
|
|
29
|
+
* Sets a cookie on the response
|
|
30
|
+
* @param res - HTTP response object
|
|
31
|
+
* @param name - Cookie name
|
|
32
|
+
* @param value - Cookie value
|
|
33
|
+
* @param options - Cookie options
|
|
34
|
+
*/
|
|
35
|
+
export declare function setCookie(res: ServerResponse, name: string, value: string, options?: CookieOptions): void;
|
|
36
|
+
/**
|
|
37
|
+
* Clears a cookie by setting it to expire
|
|
38
|
+
* @param res - HTTP response object
|
|
39
|
+
* @param name - Cookie name
|
|
40
|
+
* @param options - Cookie options
|
|
41
|
+
*/
|
|
42
|
+
export declare function clearCookie(res: ServerResponse, name: string, options?: CookieOptions): void;
|
|
43
|
+
//# sourceMappingURL=cookie-parser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cookie-parser.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/cookies/cookie-parser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAEhD,MAAM,WAAW,aAAa;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,QAAQ,GAAG,KAAK,GAAG,MAAM,CAAC;CACtC;AAED;;GAEG;AAEH;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAkB/E;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,GAAE,aAAkB,GAAG,MAAM,CA8BhG;AAED;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,GAAE,aAAkB,GAAG,IAAI,CAU7G;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,aAAkB,GAAG,IAAI,CAGhG"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cookie parsing and serialization utilities
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Parses a Cookie header string into an object
|
|
6
|
+
* @param header - The Cookie header value
|
|
7
|
+
* @returns Object mapping cookie names to values
|
|
8
|
+
*/
|
|
9
|
+
export function parseCookies(header) {
|
|
10
|
+
if (typeof header !== 'string' || !header.trim()) {
|
|
11
|
+
return {};
|
|
12
|
+
}
|
|
13
|
+
return header.split(';').reduce((acc, part) => {
|
|
14
|
+
const [name, ...rest] = part.split('=');
|
|
15
|
+
if (!name) {
|
|
16
|
+
return acc;
|
|
17
|
+
}
|
|
18
|
+
const key = name.trim();
|
|
19
|
+
if (!key) {
|
|
20
|
+
return acc;
|
|
21
|
+
}
|
|
22
|
+
const value = rest.join('=').trim();
|
|
23
|
+
acc[key] = value;
|
|
24
|
+
return acc;
|
|
25
|
+
}, {});
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Serializes a cookie with options into a Set-Cookie header value
|
|
29
|
+
* @param name - Cookie name
|
|
30
|
+
* @param value - Cookie value
|
|
31
|
+
* @param options - Cookie options
|
|
32
|
+
* @returns Set-Cookie header value
|
|
33
|
+
*/
|
|
34
|
+
export function serializeCookie(name, value, options = {}) {
|
|
35
|
+
const parts = [`${name}=${value}`];
|
|
36
|
+
if (options.maxAge != null) {
|
|
37
|
+
parts.push(`Max-Age=${options.maxAge}`);
|
|
38
|
+
}
|
|
39
|
+
if (options.expires instanceof Date) {
|
|
40
|
+
parts.push(`Expires=${options.expires.toUTCString()}`);
|
|
41
|
+
}
|
|
42
|
+
const path = options.path || '/';
|
|
43
|
+
if (path) {
|
|
44
|
+
parts.push(`Path=${path}`);
|
|
45
|
+
}
|
|
46
|
+
const sameSite = options.sameSite || 'Strict';
|
|
47
|
+
if (sameSite) {
|
|
48
|
+
parts.push(`SameSite=${sameSite}`);
|
|
49
|
+
}
|
|
50
|
+
if (options.httpOnly !== false) {
|
|
51
|
+
parts.push('HttpOnly');
|
|
52
|
+
}
|
|
53
|
+
if (options.secure) {
|
|
54
|
+
parts.push('Secure');
|
|
55
|
+
}
|
|
56
|
+
return parts.join('; ');
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Sets a cookie on the response
|
|
60
|
+
* @param res - HTTP response object
|
|
61
|
+
* @param name - Cookie name
|
|
62
|
+
* @param value - Cookie value
|
|
63
|
+
* @param options - Cookie options
|
|
64
|
+
*/
|
|
65
|
+
export function setCookie(res, name, value, options = {}) {
|
|
66
|
+
const header = serializeCookie(name, value, options);
|
|
67
|
+
const existing = res.getHeader('Set-Cookie');
|
|
68
|
+
if (Array.isArray(existing)) {
|
|
69
|
+
res.setHeader('Set-Cookie', [...existing, header]);
|
|
70
|
+
}
|
|
71
|
+
else if (existing) {
|
|
72
|
+
res.setHeader('Set-Cookie', [String(existing), header]);
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
res.setHeader('Set-Cookie', header);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Clears a cookie by setting it to expire
|
|
80
|
+
* @param res - HTTP response object
|
|
81
|
+
* @param name - Cookie name
|
|
82
|
+
* @param options - Cookie options
|
|
83
|
+
*/
|
|
84
|
+
export function clearCookie(res, name, options = {}) {
|
|
85
|
+
const expires = new Date(0);
|
|
86
|
+
setCookie(res, name, '', { ...options, maxAge: 0, expires });
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=cookie-parser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cookie-parser.js","sourceRoot":"","sources":["../../../src/infrastructure/cookies/cookie-parser.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { IncomingMessage } from 'node:http';
|
|
2
|
+
export interface SecureCookieOptions {
|
|
3
|
+
configValue: string | boolean | undefined;
|
|
4
|
+
request: IncomingMessage | null;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Cookie security utilities
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Determines whether the Secure flag should be set on cookies
|
|
11
|
+
* @param options - Configuration options
|
|
12
|
+
* @returns Whether to set the Secure flag
|
|
13
|
+
*/
|
|
14
|
+
export declare function determineSecureCookie({ configValue, request }: SecureCookieOptions): boolean;
|
|
15
|
+
//# sourceMappingURL=cookie-security.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cookie-security.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/cookies/cookie-security.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAEjD,MAAM,WAAW,mBAAmB;IAClC,WAAW,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;IAC1C,OAAO,EAAE,eAAe,GAAG,IAAI,CAAC;CACjC;AAED;;GAEG;AAEH;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,EAAE,WAAW,EAAE,OAAO,EAAE,EAAE,mBAAmB,GAAG,OAAO,CA8B5F"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cookie security utilities
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Determines whether the Secure flag should be set on cookies
|
|
6
|
+
* @param options - Configuration options
|
|
7
|
+
* @returns Whether to set the Secure flag
|
|
8
|
+
*/
|
|
9
|
+
export function determineSecureCookie({ configValue, request }) {
|
|
10
|
+
const normalized = typeof configValue === 'string' ? configValue.trim().toLowerCase() : configValue;
|
|
11
|
+
// Explicit configuration
|
|
12
|
+
if (normalized === 'true' || normalized === true) {
|
|
13
|
+
return true;
|
|
14
|
+
}
|
|
15
|
+
if (normalized === 'false' || normalized === false) {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
// Auto-detection based on request
|
|
19
|
+
if (!request || typeof request !== 'object') {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
// Check if connection is encrypted (direct HTTPS)
|
|
23
|
+
const socket = request.socket;
|
|
24
|
+
const encrypted = Boolean(socket && socket.encrypted);
|
|
25
|
+
if (encrypted) {
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
// Check X-Forwarded-Proto header (behind reverse proxy)
|
|
29
|
+
const forwardedProto = request.headers?.['x-forwarded-proto'];
|
|
30
|
+
if (typeof forwardedProto === 'string') {
|
|
31
|
+
return forwardedProto.split(',').map((value) => value.trim().toLowerCase()).includes('https');
|
|
32
|
+
}
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=cookie-security.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cookie-security.js","sourceRoot":"","sources":["../../../src/infrastructure/cookies/cookie-security.ts"],"names":[],"mappings":"AAOA;;GAEG;AAEH;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CAAC,EAAE,WAAW,EAAE,OAAO,EAAuB;IACjF,MAAM,UAAU,GAAG,OAAO,WAAW,KAAK,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC;IAEpG,yBAAyB;IACzB,IAAI,UAAU,KAAK,MAAM,IAAI,UAAU,KAAK,IAAI,EAAE,CAAC;QACjD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,UAAU,KAAK,OAAO,IAAI,UAAU,KAAK,KAAK,EAAE,CAAC;QACnD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,kCAAkC;IAClC,IAAI,CAAC,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;QAC5C,OAAO,KAAK,CAAC;IACf,CAAC;IAED,kDAAkD;IAClD,MAAM,MAAM,GAAG,OAAO,CAAC,MAA6C,CAAC;IACrE,MAAM,SAAS,GAAG,OAAO,CAAC,MAAM,IAAI,MAAM,CAAC,SAAS,CAAC,CAAC;IACtD,IAAI,SAAS,EAAE,CAAC;QACd,OAAO,IAAI,CAAC;IACd,CAAC;IAED,wDAAwD;IACxD,MAAM,cAAc,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,mBAAmB,CAAC,CAAC;IAC9D,IAAI,OAAO,cAAc,KAAK,QAAQ,EAAE,CAAC;QACvC,OAAO,cAAc,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IAChG,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { parseCookies, serializeCookie, setCookie, clearCookie, } from './cookie-parser.js';
|
|
2
|
+
export type { CookieOptions } from './cookie-parser.js';
|
|
3
|
+
export { determineSecureCookie } from './cookie-security.js';
|
|
4
|
+
export type { SecureCookieOptions } from './cookie-security.js';
|
|
5
|
+
export { createCookieManager } from './cookie-manager.js';
|
|
6
|
+
export type { CookieManagerOptions } from './cookie-manager.js';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/cookies/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,eAAe,EACf,SAAS,EACT,WAAW,GACZ,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,YAAY,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAEhE,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,YAAY,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/infrastructure/cookies/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,eAAe,EACf,SAAS,EACT,WAAW,GACZ,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAG7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ServerResponse } from 'node:http';
|
|
2
|
+
import type { RequestContext } from '../../types/http.js';
|
|
3
|
+
/**
|
|
4
|
+
* Extracts an error message from an unknown error object
|
|
5
|
+
* @param error - Error object
|
|
6
|
+
* @param defaultMessage - Default message if extraction fails
|
|
7
|
+
* @returns Error message string
|
|
8
|
+
*/
|
|
9
|
+
export declare function extractErrorMessage(error: unknown, defaultMessage?: string): string;
|
|
10
|
+
/**
|
|
11
|
+
* Centralized error handler that maps errors to HTTP responses
|
|
12
|
+
*/
|
|
13
|
+
export declare function handleError(res: ServerResponse, error: unknown, defaultStatusCode?: number): void;
|
|
14
|
+
/**
|
|
15
|
+
* Wraps an async handler to catch errors and send appropriate HTTP responses
|
|
16
|
+
*/
|
|
17
|
+
export declare function asyncHandler(handler: (context: RequestContext) => Promise<void>): (context: RequestContext) => Promise<void>;
|
|
18
|
+
/**
|
|
19
|
+
* Express-style error middleware wrapper
|
|
20
|
+
*/
|
|
21
|
+
export declare function errorMiddleware(error: unknown, _req: unknown, res: ServerResponse, next: (error?: unknown) => void): void;
|
|
22
|
+
//# sourceMappingURL=error-handler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-handler.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/errors/error-handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAGhD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AA4B1D;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,EAAE,cAAc,GAAE,MAA4B,GAAG,MAAM,CAqBxG;AAED;;GAEG;AACH,wBAAgB,WAAW,CACzB,GAAG,EAAE,cAAc,EACnB,KAAK,EAAE,OAAO,EACd,iBAAiB,GAAE,MAAY,GAC9B,IAAI,CAiBN;AAED;;GAEG;AACH,wBAAgB,YAAY,CAC1B,OAAO,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,OAAO,CAAC,IAAI,CAAC,GAClD,CAAC,OAAO,EAAE,cAAc,KAAK,OAAO,CAAC,IAAI,CAAC,CAQ5C;AAED;;GAEG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,OAAO,EACd,IAAI,EAAE,OAAO,EACb,GAAG,EAAE,cAAc,EACnB,IAAI,EAAE,CAAC,KAAK,CAAC,EAAE,OAAO,KAAK,IAAI,GAC9B,IAAI,CAKN"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { HttpError } from './http-error.js';
|
|
2
|
+
import { sendJson } from '../../utils/http.js';
|
|
3
|
+
/**
|
|
4
|
+
* Type guard for HttpError
|
|
5
|
+
*/
|
|
6
|
+
function isHttpError(error) {
|
|
7
|
+
return error instanceof HttpError;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Type guard for errors with statusCode property
|
|
11
|
+
*/
|
|
12
|
+
function hasStatusCode(error) {
|
|
13
|
+
return (typeof error === 'object' &&
|
|
14
|
+
error !== null &&
|
|
15
|
+
'statusCode' in error &&
|
|
16
|
+
typeof error.statusCode === 'number');
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Type guard for standard Error
|
|
20
|
+
*/
|
|
21
|
+
function isError(error) {
|
|
22
|
+
return error instanceof Error;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Extracts an error message from an unknown error object
|
|
26
|
+
* @param error - Error object
|
|
27
|
+
* @param defaultMessage - Default message if extraction fails
|
|
28
|
+
* @returns Error message string
|
|
29
|
+
*/
|
|
30
|
+
export function extractErrorMessage(error, defaultMessage = 'An error occurred') {
|
|
31
|
+
if (!error) {
|
|
32
|
+
return defaultMessage;
|
|
33
|
+
}
|
|
34
|
+
if (error instanceof Error) {
|
|
35
|
+
return error.message;
|
|
36
|
+
}
|
|
37
|
+
if (typeof error === 'object' && 'message' in error) {
|
|
38
|
+
const err = error;
|
|
39
|
+
if (typeof err.message === 'string') {
|
|
40
|
+
return err.message;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
if (typeof error === 'string') {
|
|
44
|
+
return error;
|
|
45
|
+
}
|
|
46
|
+
return defaultMessage;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Centralized error handler that maps errors to HTTP responses
|
|
50
|
+
*/
|
|
51
|
+
export function handleError(res, error, defaultStatusCode = 500) {
|
|
52
|
+
// If it's already an HttpError, use its status code
|
|
53
|
+
if (isHttpError(error)) {
|
|
54
|
+
sendJson(res, error.statusCode, { error: error.message });
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
// Handle errors with explicit statusCode property
|
|
58
|
+
if (hasStatusCode(error)) {
|
|
59
|
+
const message = error.message || 'An error occurred';
|
|
60
|
+
sendJson(res, error.statusCode, { error: message });
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
// Default error response
|
|
64
|
+
const message = isError(error) ? error.message : 'An unexpected error occurred';
|
|
65
|
+
sendJson(res, defaultStatusCode, { error: message });
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Wraps an async handler to catch errors and send appropriate HTTP responses
|
|
69
|
+
*/
|
|
70
|
+
export function asyncHandler(handler) {
|
|
71
|
+
return async (context) => {
|
|
72
|
+
try {
|
|
73
|
+
await handler(context);
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
handleError(context.res, error);
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Express-style error middleware wrapper
|
|
82
|
+
*/
|
|
83
|
+
export function errorMiddleware(error, _req, res, next) {
|
|
84
|
+
if (res.headersSent) {
|
|
85
|
+
return next(error);
|
|
86
|
+
}
|
|
87
|
+
handleError(res, error);
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=error-handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-handler.js","sourceRoot":"","sources":["../../../src/infrastructure/errors/error-handler.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base HTTP error class with status code support
|
|
3
|
+
*/
|
|
4
|
+
export declare class HttpError extends Error {
|
|
5
|
+
readonly statusCode: number;
|
|
6
|
+
constructor(message: string, statusCode?: number, cause?: Error | null);
|
|
7
|
+
toJSON(): {
|
|
8
|
+
error: string;
|
|
9
|
+
status: number;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* 500 Internal Server Error
|
|
14
|
+
*/
|
|
15
|
+
export declare class InternalServerError extends HttpError {
|
|
16
|
+
constructor(message?: string, cause?: Error | null);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* 503 Service Unavailable
|
|
20
|
+
*/
|
|
21
|
+
export declare class ServiceUnavailableError extends HttpError {
|
|
22
|
+
constructor(message?: string, cause?: Error | null);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* 502 Bad Gateway (for external service failures)
|
|
26
|
+
*/
|
|
27
|
+
export declare class BadGatewayError extends HttpError {
|
|
28
|
+
constructor(message?: string, cause?: Error | null);
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=http-error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-error.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/errors/http-error.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,SAAU,SAAQ,KAAK;IAClC,SAAgB,UAAU,EAAE,MAAM,CAAC;gBAEvB,OAAO,EAAE,MAAM,EAAE,UAAU,GAAE,MAAY,EAAE,KAAK,GAAE,KAAK,GAAG,IAAW;IAUjF,MAAM,IAAI;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE;CAM5C;AAED;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,SAAS;gBACpC,OAAO,GAAE,MAAgC,EAAE,KAAK,GAAE,KAAK,GAAG,IAAW;CAGlF;AAED;;GAEG;AACH,qBAAa,uBAAwB,SAAQ,SAAS;gBACxC,OAAO,GAAE,MAA8B,EAAE,KAAK,GAAE,KAAK,GAAG,IAAW;CAGhF;AAED;;GAEG;AACH,qBAAa,eAAgB,SAAQ,SAAS;gBAChC,OAAO,GAAE,MAAsB,EAAE,KAAK,GAAE,KAAK,GAAG,IAAW;CAGxE"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base HTTP error class with status code support
|
|
3
|
+
*/
|
|
4
|
+
export class HttpError extends Error {
|
|
5
|
+
statusCode;
|
|
6
|
+
constructor(message, statusCode = 500, cause = null) {
|
|
7
|
+
super(message);
|
|
8
|
+
this.name = this.constructor.name;
|
|
9
|
+
this.statusCode = statusCode;
|
|
10
|
+
if (cause) {
|
|
11
|
+
this.cause = cause;
|
|
12
|
+
}
|
|
13
|
+
Error.captureStackTrace(this, this.constructor);
|
|
14
|
+
}
|
|
15
|
+
toJSON() {
|
|
16
|
+
return {
|
|
17
|
+
error: this.message,
|
|
18
|
+
status: this.statusCode,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* 500 Internal Server Error
|
|
24
|
+
*/
|
|
25
|
+
export class InternalServerError extends HttpError {
|
|
26
|
+
constructor(message = 'Internal server error', cause = null) {
|
|
27
|
+
super(message, 500, cause);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* 503 Service Unavailable
|
|
32
|
+
*/
|
|
33
|
+
export class ServiceUnavailableError extends HttpError {
|
|
34
|
+
constructor(message = 'Service unavailable', cause = null) {
|
|
35
|
+
super(message, 503, cause);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* 502 Bad Gateway (for external service failures)
|
|
40
|
+
*/
|
|
41
|
+
export class BadGatewayError extends HttpError {
|
|
42
|
+
constructor(message = 'Bad gateway', cause = null) {
|
|
43
|
+
super(message, 502, cause);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=http-error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-error.js","sourceRoot":"","sources":["../../../src/infrastructure/errors/http-error.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,OAAO,SAAU,SAAQ,KAAK;IAClB,UAAU,CAAS;IAEnC,YAAY,OAAe,EAAE,aAAqB,GAAG,EAAE,QAAsB,IAAI;QAC/E,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;QAClC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,KAAK,EAAE,CAAC;YACV,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACrB,CAAC;QACD,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;IAClD,CAAC;IAED,MAAM;QACJ,OAAO;YACL,KAAK,EAAE,IAAI,CAAC,OAAO;YACnB,MAAM,EAAE,IAAI,CAAC,UAAU;SACxB,CAAC;IACJ,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,mBAAoB,SAAQ,SAAS;IAChD,YAAY,UAAkB,uBAAuB,EAAE,QAAsB,IAAI;QAC/E,KAAK,CAAC,OAAO,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;IAC7B,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,uBAAwB,SAAQ,SAAS;IACpD,YAAY,UAAkB,qBAAqB,EAAE,QAAsB,IAAI;QAC7E,KAAK,CAAC,OAAO,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;IAC7B,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,eAAgB,SAAQ,SAAS;IAC5C,YAAY,UAAkB,aAAa,EAAE,QAAsB,IAAI;QACrE,KAAK,CAAC,OAAO,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;IAC7B,CAAC;CACF"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { HttpError, InternalServerError, ServiceUnavailableError, BadGatewayError } from './http-error.js';
|
|
2
|
+
export { ValidationError, UnauthorizedError, MethodNotAllowedError } from './validation-error.js';
|
|
3
|
+
export { NotFoundError } from './not-found-error.js';
|
|
4
|
+
export { handleError, asyncHandler, errorMiddleware, extractErrorMessage } from './error-handler.js';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/errors/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAC3G,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAClG,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { HttpError, InternalServerError, ServiceUnavailableError, BadGatewayError } from './http-error.js';
|
|
2
|
+
export { ValidationError, UnauthorizedError, MethodNotAllowedError } from './validation-error.js';
|
|
3
|
+
export { NotFoundError } from './not-found-error.js';
|
|
4
|
+
export { handleError, asyncHandler, errorMiddleware, extractErrorMessage } from './error-handler.js';
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/infrastructure/errors/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAC3G,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAClG,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"not-found-error.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/errors/not-found-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C;;GAEG;AACH,qBAAa,aAAc,SAAQ,SAAS;gBAC9B,QAAQ,GAAE,MAAmB,EAAE,KAAK,GAAE,KAAK,GAAG,IAAW;CAMtE"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { HttpError } from './http-error.js';
|
|
2
|
+
/**
|
|
3
|
+
* 404 Not Found
|
|
4
|
+
*/
|
|
5
|
+
export class NotFoundError extends HttpError {
|
|
6
|
+
constructor(resource = 'Resource', cause = null) {
|
|
7
|
+
const message = typeof resource === 'string' && resource
|
|
8
|
+
? `${resource} not found`
|
|
9
|
+
: 'Not found';
|
|
10
|
+
super(message, 404, cause);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=not-found-error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"not-found-error.js","sourceRoot":"","sources":["../../../src/infrastructure/errors/not-found-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C;;GAEG;AACH,MAAM,OAAO,aAAc,SAAQ,SAAS;IAC1C,YAAY,WAAmB,UAAU,EAAE,QAAsB,IAAI;QACnE,MAAM,OAAO,GAAG,OAAO,QAAQ,KAAK,QAAQ,IAAI,QAAQ;YACtD,CAAC,CAAC,GAAG,QAAQ,YAAY;YACzB,CAAC,CAAC,WAAW,CAAC;QAChB,KAAK,CAAC,OAAO,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;IAC7B,CAAC;CACF"}
|