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,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @deprecated Use infrastructure/cookies instead
|
|
3
|
+
* This file re-exports for backward compatibility
|
|
4
|
+
*/
|
|
5
|
+
export { parseCookies, serializeCookie, setCookie, clearCookie, } from '../infrastructure/cookies/index.js';
|
|
6
|
+
export type { CookieOptions } from '../infrastructure/cookies/index.js';
|
|
7
|
+
//# sourceMappingURL=cookies.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cookies.d.ts","sourceRoot":"","sources":["../../src/utils/cookies.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EACL,YAAY,EACZ,eAAe,EACf,SAAS,EACT,WAAW,GACZ,MAAM,oCAAoC,CAAC;AAC5C,YAAY,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cookies.js","sourceRoot":"","sources":["../../src/utils/cookies.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EACL,YAAY,EACZ,eAAe,EACf,SAAS,EACT,WAAW,GACZ,MAAM,oCAAoC,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { IncomingMessage, ServerResponse } from 'node:http';
|
|
2
|
+
export interface JsonPayload {
|
|
3
|
+
[key: string]: unknown;
|
|
4
|
+
}
|
|
5
|
+
export declare function sendJson(res: ServerResponse, statusCode: number, payload: JsonPayload | unknown): void;
|
|
6
|
+
/**
|
|
7
|
+
* Handles HEAD requests by sending a 200 response with no-store cache control
|
|
8
|
+
* @param res - Server response object
|
|
9
|
+
* @returns true if handled, false otherwise
|
|
10
|
+
*/
|
|
11
|
+
export declare function handleHeadRequest(res: ServerResponse): void;
|
|
12
|
+
/**
|
|
13
|
+
* @deprecated Use extractErrorMessage from infrastructure/errors instead
|
|
14
|
+
* Re-exported for backward compatibility
|
|
15
|
+
*/
|
|
16
|
+
export { extractErrorMessage } from '../infrastructure/errors/index.js';
|
|
17
|
+
export declare function readJsonBody(req: IncomingMessage): Promise<JsonPayload>;
|
|
18
|
+
/**
|
|
19
|
+
* @deprecated Use infrastructure/cookies instead
|
|
20
|
+
* This function re-exports for backward compatibility
|
|
21
|
+
*/
|
|
22
|
+
export { determineSecureCookie } from '../infrastructure/cookies/index.js';
|
|
23
|
+
//# sourceMappingURL=http.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/utils/http.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAGjE,MAAM,WAAW,WAAW;IAC1B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,wBAAgB,QAAQ,CAAC,GAAG,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,GAAG,OAAO,GAAG,IAAI,CAKtG;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,cAAc,GAAG,IAAI,CAI3D;AAED;;;GAGG;AACH,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAExE,wBAAsB,YAAY,CAAC,GAAG,EAAE,eAAe,GAAG,OAAO,CAAC,WAAW,CAAC,CAiC7E;AAED;;;GAGG;AACH,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { MAX_REQUEST_BODY_SIZE } from '../config/constants.js';
|
|
2
|
+
export function sendJson(res, statusCode, payload) {
|
|
3
|
+
res.statusCode = statusCode;
|
|
4
|
+
res.setHeader('Content-Type', 'application/json; charset=utf-8');
|
|
5
|
+
res.setHeader('Cache-Control', 'no-store');
|
|
6
|
+
res.end(JSON.stringify(payload));
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Handles HEAD requests by sending a 200 response with no-store cache control
|
|
10
|
+
* @param res - Server response object
|
|
11
|
+
* @returns true if handled, false otherwise
|
|
12
|
+
*/
|
|
13
|
+
export function handleHeadRequest(res) {
|
|
14
|
+
res.statusCode = 200;
|
|
15
|
+
res.setHeader('Cache-Control', 'no-store');
|
|
16
|
+
res.end();
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* @deprecated Use extractErrorMessage from infrastructure/errors instead
|
|
20
|
+
* Re-exported for backward compatibility
|
|
21
|
+
*/
|
|
22
|
+
export { extractErrorMessage } from '../infrastructure/errors/index.js';
|
|
23
|
+
export async function readJsonBody(req) {
|
|
24
|
+
return new Promise((resolve, reject) => {
|
|
25
|
+
const chunks = [];
|
|
26
|
+
let length = 0;
|
|
27
|
+
req.on('data', (chunk) => {
|
|
28
|
+
chunks.push(chunk);
|
|
29
|
+
length += chunk.length;
|
|
30
|
+
if (length > MAX_REQUEST_BODY_SIZE) {
|
|
31
|
+
reject(new Error('Request body too large'));
|
|
32
|
+
req.destroy();
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
req.on('end', () => {
|
|
36
|
+
if (chunks.length === 0) {
|
|
37
|
+
resolve({});
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
try {
|
|
41
|
+
const buffer = Buffer.concat(chunks);
|
|
42
|
+
resolve(JSON.parse(buffer.toString('utf8')));
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
reject(new Error('Invalid JSON payload'));
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
req.on('error', (error) => {
|
|
49
|
+
reject(error);
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* @deprecated Use infrastructure/cookies instead
|
|
55
|
+
* This function re-exports for backward compatibility
|
|
56
|
+
*/
|
|
57
|
+
export { determineSecureCookie } from '../infrastructure/cookies/index.js';
|
|
58
|
+
//# sourceMappingURL=http.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.js","sourceRoot":"","sources":["../../src/utils/http.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAM/D,MAAM,UAAU,QAAQ,CAAC,GAAmB,EAAE,UAAkB,EAAE,OAA8B;IAC9F,GAAG,CAAC,UAAU,GAAG,UAAU,CAAC;IAC5B,GAAG,CAAC,SAAS,CAAC,cAAc,EAAE,iCAAiC,CAAC,CAAC;IACjE,GAAG,CAAC,SAAS,CAAC,eAAe,EAAE,UAAU,CAAC,CAAC;IAC3C,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC;AACnC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAAC,GAAmB;IACnD,GAAG,CAAC,UAAU,GAAG,GAAG,CAAC;IACrB,GAAG,CAAC,SAAS,CAAC,eAAe,EAAE,UAAU,CAAC,CAAC;IAC3C,GAAG,CAAC,GAAG,EAAE,CAAC;AACZ,CAAC;AAED;;;GAGG;AACH,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAExE,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,GAAoB;IACrD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,MAAM,GAAa,EAAE,CAAC;QAC5B,IAAI,MAAM,GAAG,CAAC,CAAC;QAEf,GAAG,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,KAAa,EAAE,EAAE;YAC/B,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACnB,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC;YAEvB,IAAI,MAAM,GAAG,qBAAqB,EAAE,CAAC;gBACnC,MAAM,CAAC,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC,CAAC;gBAC5C,GAAG,CAAC,OAAO,EAAE,CAAC;YAChB,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,GAAG,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE;YACjB,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACxB,OAAO,CAAC,EAAE,CAAC,CAAC;gBACZ,OAAO;YACT,CAAC;YAED,IAAI,CAAC;gBACH,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;gBACrC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAgB,CAAC,CAAC;YAC9D,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,MAAM,CAAC,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC,CAAC;YAC5C,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,GAAG,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,KAAY,EAAE,EAAE;YAC/B,MAAM,CAAC,KAAK,CAAC,CAAC;QAChB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;GAGG;AACH,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generates a random session token
|
|
3
|
+
* @returns Random token string
|
|
4
|
+
*/
|
|
5
|
+
export declare function generateSessionToken(): string;
|
|
6
|
+
/**
|
|
7
|
+
* Generates a random password
|
|
8
|
+
* @param length - Password length (default: 12)
|
|
9
|
+
* @returns Random password string
|
|
10
|
+
*/
|
|
11
|
+
export declare function generateRandomPassword(length?: number): string;
|
|
12
|
+
//# sourceMappingURL=random.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"random.d.ts","sourceRoot":"","sources":["../../src/utils/random.ts"],"names":[],"mappings":"AAMA;;;GAGG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAE7C;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,GAAE,MAAwB,GAAG,MAAM,CAO/E"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { randomBytes } from 'node:crypto';
|
|
2
|
+
const TOKEN_LENGTH = 32;
|
|
3
|
+
const PASSWORD_LENGTH = 12;
|
|
4
|
+
const CHARSET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
|
5
|
+
/**
|
|
6
|
+
* Generates a random session token
|
|
7
|
+
* @returns Random token string
|
|
8
|
+
*/
|
|
9
|
+
export function generateSessionToken() {
|
|
10
|
+
return randomBytes(TOKEN_LENGTH).toString('base64url');
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Generates a random password
|
|
14
|
+
* @param length - Password length (default: 12)
|
|
15
|
+
* @returns Random password string
|
|
16
|
+
*/
|
|
17
|
+
export function generateRandomPassword(length = PASSWORD_LENGTH) {
|
|
18
|
+
const bytes = randomBytes(length);
|
|
19
|
+
let result = '';
|
|
20
|
+
for (let i = 0; i < length; i++) {
|
|
21
|
+
result += CHARSET[bytes[i] % CHARSET.length];
|
|
22
|
+
}
|
|
23
|
+
return result;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=random.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"random.js","sourceRoot":"","sources":["../../src/utils/random.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,MAAM,YAAY,GAAG,EAAE,CAAC;AACxB,MAAM,eAAe,GAAG,EAAE,CAAC;AAC3B,MAAM,OAAO,GAAG,gEAAgE,CAAC;AAEjF;;;GAGG;AACH,MAAM,UAAU,oBAAoB;IAClC,OAAO,WAAW,CAAC,YAAY,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;AACzD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,sBAAsB,CAAC,SAAiB,eAAe;IACrE,MAAM,KAAK,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;IAClC,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAChC,MAAM,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC,CAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAChD,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { RepositoriesMap } from '../repositories/repository-repository.js';
|
|
2
|
+
/**
|
|
3
|
+
* Refreshes the repository cache by discovering repositories and emitting an update event
|
|
4
|
+
* @param workdir - Work directory root
|
|
5
|
+
* @returns Updated repository data
|
|
6
|
+
*/
|
|
7
|
+
export declare function refreshRepositoryCache(workdir: string): Promise<RepositoriesMap>;
|
|
8
|
+
//# sourceMappingURL=repository-cache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repository-cache.d.ts","sourceRoot":"","sources":["../../src/utils/repository-cache.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAEhF;;;;GAIG;AACH,wBAAsB,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CAItF"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { discoverRepositories } from '../repositories/repository-repository.js';
|
|
2
|
+
import { emitReposUpdate } from '../core/event-bus.js';
|
|
3
|
+
/**
|
|
4
|
+
* Refreshes the repository cache by discovering repositories and emitting an update event
|
|
5
|
+
* @param workdir - Work directory root
|
|
6
|
+
* @returns Updated repository data
|
|
7
|
+
*/
|
|
8
|
+
export async function refreshRepositoryCache(workdir) {
|
|
9
|
+
const data = await discoverRepositories(workdir);
|
|
10
|
+
emitReposUpdate(data);
|
|
11
|
+
return data;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=repository-cache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repository-cache.js","sourceRoot":"","sources":["../../src/utils/repository-cache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,0CAA0C,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAGvD;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAAC,OAAe;IAC1D,MAAM,IAAI,GAAG,MAAM,oBAAoB,CAAC,OAAO,CAAC,CAAC;IACjD,eAAe,CAAC,IAAI,CAAC,CAAC;IACtB,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { validateRequired, validateOptional, validateBoolean, validatePositiveInteger, validateQueryParams, validateOptionalQueryParams, requireNonEmpty, validateRepositoryIdentifier, validateWorktreeIdentifier, extractRepositoryParams, extractWorktreeParams, } from './request-validator.js';
|
|
2
|
+
export { validateRepositoryCreate, validateRepositoryDelete, validateInitCommandUpdate } from './schemas/repository-schema.js';
|
|
3
|
+
export type { RepositoryCreateInput, RepositoryDeleteInput, InitCommandUpdateInput } from './schemas/repository-schema.js';
|
|
4
|
+
export { validateWorktreeCreate, validateWorktreeDelete } from './schemas/worktree-schema.js';
|
|
5
|
+
export type { WorktreeCreateInput, WorktreeDeleteInput } from './schemas/worktree-schema.js';
|
|
6
|
+
export { validateTerminalOpen, validateTerminalSend } from './schemas/terminal-schema.js';
|
|
7
|
+
export type { TerminalOpenInput, TerminalSendInput } from './schemas/terminal-schema.js';
|
|
8
|
+
export { ValidationError } from '../infrastructure/errors/index.js';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/validation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,uBAAuB,EACvB,mBAAmB,EACnB,2BAA2B,EAC3B,eAAe,EACf,4BAA4B,EAC5B,0BAA0B,EAC1B,uBAAuB,EACvB,qBAAqB,GACtB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,wBAAwB,EAAE,wBAAwB,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC/H,YAAY,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAE3H,OAAO,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAC9F,YAAY,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAE7F,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAC1F,YAAY,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAEzF,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { validateRequired, validateOptional, validateBoolean, validatePositiveInteger, validateQueryParams, validateOptionalQueryParams, requireNonEmpty, validateRepositoryIdentifier, validateWorktreeIdentifier, extractRepositoryParams, extractWorktreeParams, } from './request-validator.js';
|
|
2
|
+
export { validateRepositoryCreate, validateRepositoryDelete, validateInitCommandUpdate } from './schemas/repository-schema.js';
|
|
3
|
+
export { validateWorktreeCreate, validateWorktreeDelete } from './schemas/worktree-schema.js';
|
|
4
|
+
export { validateTerminalOpen, validateTerminalSend } from './schemas/terminal-schema.js';
|
|
5
|
+
export { ValidationError } from '../infrastructure/errors/index.js';
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/validation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,uBAAuB,EACvB,mBAAmB,EACnB,2BAA2B,EAC3B,eAAe,EACf,4BAA4B,EAC5B,0BAA0B,EAC1B,uBAAuB,EACvB,qBAAqB,GACtB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,wBAAwB,EAAE,wBAAwB,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAG/H,OAAO,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAG9F,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAG1F,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import type { URL } from 'node:url';
|
|
2
|
+
/**
|
|
3
|
+
* Validates that required fields are present and non-empty
|
|
4
|
+
* @param data - The data object to validate
|
|
5
|
+
* @param requiredFields - Array of field names that must be present
|
|
6
|
+
* @returns Object with normalized field values
|
|
7
|
+
* @throws {ValidationError} If any required field is missing or empty
|
|
8
|
+
*/
|
|
9
|
+
export declare function validateRequired<T extends string>(data: unknown, requiredFields: readonly T[]): Record<T, string>;
|
|
10
|
+
/**
|
|
11
|
+
* Validates and extracts optional fields with default values
|
|
12
|
+
* @param data - The data object to validate
|
|
13
|
+
* @param fieldDefaults - Object mapping field names to default values
|
|
14
|
+
* @returns Object with field values or defaults
|
|
15
|
+
*/
|
|
16
|
+
export declare function validateOptional<T extends Record<string, string>>(data: unknown, fieldDefaults: T): T;
|
|
17
|
+
/**
|
|
18
|
+
* Validates a boolean field
|
|
19
|
+
* @param value - The value to validate
|
|
20
|
+
* @param defaultValue - Default value if validation fails
|
|
21
|
+
* @returns Boolean value
|
|
22
|
+
*/
|
|
23
|
+
export declare function validateBoolean(value: unknown, defaultValue?: boolean): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Validates a positive integer
|
|
26
|
+
* @param value - The value to validate
|
|
27
|
+
* @param defaultValue - Default value if validation fails
|
|
28
|
+
* @param min - Minimum allowed value (inclusive)
|
|
29
|
+
* @returns Integer value
|
|
30
|
+
*/
|
|
31
|
+
export declare function validatePositiveInteger(value: unknown, defaultValue?: number, min?: number): number;
|
|
32
|
+
/**
|
|
33
|
+
* Validates query parameters from URL
|
|
34
|
+
* @param url - The URL object
|
|
35
|
+
* @param requiredParams - Array of required parameter names
|
|
36
|
+
* @returns Object with parameter values
|
|
37
|
+
* @throws {ValidationError} If any required parameter is missing
|
|
38
|
+
*/
|
|
39
|
+
export declare function validateQueryParams<T extends string>(url: URL, requiredParams: readonly T[]): Record<T, string>;
|
|
40
|
+
/**
|
|
41
|
+
* Validates optional query parameters with defaults
|
|
42
|
+
* @param url - The URL object
|
|
43
|
+
* @param paramDefaults - Object mapping parameter names to default values
|
|
44
|
+
* @returns Object with parameter values or defaults
|
|
45
|
+
*/
|
|
46
|
+
export declare function validateOptionalQueryParams<T extends Record<string, string>>(url: URL, paramDefaults: T): T;
|
|
47
|
+
/**
|
|
48
|
+
* Validates that a string is non-empty
|
|
49
|
+
* @param value - The value to validate
|
|
50
|
+
* @param fieldName - Name of the field for error messages
|
|
51
|
+
* @throws {ValidationError} If the value is empty
|
|
52
|
+
*/
|
|
53
|
+
export declare function requireNonEmpty(value: unknown, fieldName?: string): string;
|
|
54
|
+
/**
|
|
55
|
+
* Validates repository identifiers (org, repo)
|
|
56
|
+
* @param data - Data object containing org and repo
|
|
57
|
+
* @returns Validated {org, repo}
|
|
58
|
+
* @throws {ValidationError} If org or repo is invalid
|
|
59
|
+
*/
|
|
60
|
+
export declare function validateRepositoryIdentifier(data: unknown): {
|
|
61
|
+
org: string;
|
|
62
|
+
repo: string;
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* Validates worktree identifiers (org, repo, branch)
|
|
66
|
+
* @param data - Data object containing org, repo, and branch
|
|
67
|
+
* @returns Validated {org, repo, branch}
|
|
68
|
+
* @throws {ValidationError} If any identifier is invalid
|
|
69
|
+
*/
|
|
70
|
+
export declare function validateWorktreeIdentifier(data: unknown): {
|
|
71
|
+
org: string;
|
|
72
|
+
repo: string;
|
|
73
|
+
branch: string;
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* Extracts and validates repository parameters from URL search params
|
|
77
|
+
* @param searchParams - URL search params
|
|
78
|
+
* @returns Validated {org, repo}
|
|
79
|
+
* @throws {ValidationError} If org or repo is missing
|
|
80
|
+
*/
|
|
81
|
+
export declare function extractRepositoryParams(searchParams: URLSearchParams): {
|
|
82
|
+
org: string;
|
|
83
|
+
repo: string;
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* Extracts and validates worktree parameters from URL search params
|
|
87
|
+
* @param searchParams - URL search params
|
|
88
|
+
* @param options - Options for normalization
|
|
89
|
+
* @returns Validated {org, repo, branch}
|
|
90
|
+
* @throws {ValidationError} If any parameter is missing or invalid
|
|
91
|
+
*/
|
|
92
|
+
export declare function extractWorktreeParams(searchParams: URLSearchParams, options?: {
|
|
93
|
+
normalizeBranch?: boolean;
|
|
94
|
+
}): {
|
|
95
|
+
org: string;
|
|
96
|
+
repo: string;
|
|
97
|
+
branch: string;
|
|
98
|
+
};
|
|
99
|
+
//# sourceMappingURL=request-validator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request-validator.d.ts","sourceRoot":"","sources":["../../src/validation/request-validator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAgBpC;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,MAAM,EAC/C,IAAI,EAAE,OAAO,EACb,cAAc,EAAE,SAAS,CAAC,EAAE,GAC3B,MAAM,CAAC,C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E,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CASpG;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACnC,YAAY,EAAE,eAAe,EAC7B,OAAO,GAAE;IAAE,eAAe,CAAC,EAAE,OAAO,CAAA;CAAO,GAC1C;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAc/C"}
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { ValidationError } from '../infrastructure/errors/index.js';
|
|
2
|
+
import { normalizeBranchName } from '../domain/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* Normalizes a string value by trimming whitespace
|
|
5
|
+
*/
|
|
6
|
+
function normalizeString(value) {
|
|
7
|
+
return typeof value === 'string' ? value.trim() : '';
|
|
8
|
+
}
|
|
9
|
+
// Type helper for required fields (currently unused but kept for future use)
|
|
10
|
+
// type RequiredFields<T extends Record<string, unknown>> = {
|
|
11
|
+
// [K in keyof T]: string;
|
|
12
|
+
// };
|
|
13
|
+
/**
|
|
14
|
+
* Validates that required fields are present and non-empty
|
|
15
|
+
* @param data - The data object to validate
|
|
16
|
+
* @param requiredFields - Array of field names that must be present
|
|
17
|
+
* @returns Object with normalized field values
|
|
18
|
+
* @throws {ValidationError} If any required field is missing or empty
|
|
19
|
+
*/
|
|
20
|
+
export function validateRequired(data, requiredFields) {
|
|
21
|
+
if (!data || typeof data !== 'object') {
|
|
22
|
+
throw new ValidationError('Invalid request payload');
|
|
23
|
+
}
|
|
24
|
+
const result = {};
|
|
25
|
+
const missingFields = [];
|
|
26
|
+
for (const field of requiredFields) {
|
|
27
|
+
const value = normalizeString(data[field]);
|
|
28
|
+
if (!value) {
|
|
29
|
+
missingFields.push(field);
|
|
30
|
+
}
|
|
31
|
+
result[field] = value;
|
|
32
|
+
}
|
|
33
|
+
if (missingFields.length > 0) {
|
|
34
|
+
const fieldList = missingFields.join(', ');
|
|
35
|
+
throw new ValidationError(`Missing required field(s): ${fieldList}`);
|
|
36
|
+
}
|
|
37
|
+
return result;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Validates and extracts optional fields with default values
|
|
41
|
+
* @param data - The data object to validate
|
|
42
|
+
* @param fieldDefaults - Object mapping field names to default values
|
|
43
|
+
* @returns Object with field values or defaults
|
|
44
|
+
*/
|
|
45
|
+
export function validateOptional(data, fieldDefaults) {
|
|
46
|
+
if (!data || typeof data !== 'object') {
|
|
47
|
+
return { ...fieldDefaults };
|
|
48
|
+
}
|
|
49
|
+
const result = {};
|
|
50
|
+
for (const [field, defaultValue] of Object.entries(fieldDefaults)) {
|
|
51
|
+
const value = normalizeString(data[field]);
|
|
52
|
+
result[field] = value || defaultValue;
|
|
53
|
+
}
|
|
54
|
+
return result;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Validates a boolean field
|
|
58
|
+
* @param value - The value to validate
|
|
59
|
+
* @param defaultValue - Default value if validation fails
|
|
60
|
+
* @returns Boolean value
|
|
61
|
+
*/
|
|
62
|
+
export function validateBoolean(value, defaultValue = false) {
|
|
63
|
+
if (typeof value === 'boolean') {
|
|
64
|
+
return value;
|
|
65
|
+
}
|
|
66
|
+
return defaultValue;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Validates a positive integer
|
|
70
|
+
* @param value - The value to validate
|
|
71
|
+
* @param defaultValue - Default value if validation fails
|
|
72
|
+
* @param min - Minimum allowed value (inclusive)
|
|
73
|
+
* @returns Integer value
|
|
74
|
+
*/
|
|
75
|
+
export function validatePositiveInteger(value, defaultValue = 1, min = 1) {
|
|
76
|
+
const parsed = Number.parseInt(String(value), 10);
|
|
77
|
+
if (Number.isInteger(parsed) && parsed >= min) {
|
|
78
|
+
return parsed;
|
|
79
|
+
}
|
|
80
|
+
return defaultValue;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Validates query parameters from URL
|
|
84
|
+
* @param url - The URL object
|
|
85
|
+
* @param requiredParams - Array of required parameter names
|
|
86
|
+
* @returns Object with parameter values
|
|
87
|
+
* @throws {ValidationError} If any required parameter is missing
|
|
88
|
+
*/
|
|
89
|
+
export function validateQueryParams(url, requiredParams) {
|
|
90
|
+
if (!url || !url.searchParams) {
|
|
91
|
+
throw new ValidationError('Invalid URL');
|
|
92
|
+
}
|
|
93
|
+
const result = {};
|
|
94
|
+
const missingParams = [];
|
|
95
|
+
for (const param of requiredParams) {
|
|
96
|
+
const value = normalizeString(url.searchParams.get(param));
|
|
97
|
+
if (!value) {
|
|
98
|
+
missingParams.push(param);
|
|
99
|
+
}
|
|
100
|
+
result[param] = value;
|
|
101
|
+
}
|
|
102
|
+
if (missingParams.length > 0) {
|
|
103
|
+
const paramList = missingParams.join(', ');
|
|
104
|
+
throw new ValidationError(`Missing required query parameter(s): ${paramList}`);
|
|
105
|
+
}
|
|
106
|
+
return result;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Validates optional query parameters with defaults
|
|
110
|
+
* @param url - The URL object
|
|
111
|
+
* @param paramDefaults - Object mapping parameter names to default values
|
|
112
|
+
* @returns Object with parameter values or defaults
|
|
113
|
+
*/
|
|
114
|
+
export function validateOptionalQueryParams(url, paramDefaults) {
|
|
115
|
+
if (!url || !url.searchParams) {
|
|
116
|
+
return { ...paramDefaults };
|
|
117
|
+
}
|
|
118
|
+
const result = {};
|
|
119
|
+
for (const [param, defaultValue] of Object.entries(paramDefaults)) {
|
|
120
|
+
const value = normalizeString(url.searchParams.get(param));
|
|
121
|
+
result[param] = value || defaultValue;
|
|
122
|
+
}
|
|
123
|
+
return result;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Validates that a string is non-empty
|
|
127
|
+
* @param value - The value to validate
|
|
128
|
+
* @param fieldName - Name of the field for error messages
|
|
129
|
+
* @throws {ValidationError} If the value is empty
|
|
130
|
+
*/
|
|
131
|
+
export function requireNonEmpty(value, fieldName = 'Field') {
|
|
132
|
+
const normalized = normalizeString(value);
|
|
133
|
+
if (!normalized) {
|
|
134
|
+
throw new ValidationError(`${fieldName} is required and cannot be empty`);
|
|
135
|
+
}
|
|
136
|
+
return normalized;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Validates repository identifiers (org, repo)
|
|
140
|
+
* @param data - Data object containing org and repo
|
|
141
|
+
* @returns Validated {org, repo}
|
|
142
|
+
* @throws {ValidationError} If org or repo is invalid
|
|
143
|
+
*/
|
|
144
|
+
export function validateRepositoryIdentifier(data) {
|
|
145
|
+
return validateRequired(data, ['org', 'repo']);
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Validates worktree identifiers (org, repo, branch)
|
|
149
|
+
* @param data - Data object containing org, repo, and branch
|
|
150
|
+
* @returns Validated {org, repo, branch}
|
|
151
|
+
* @throws {ValidationError} If any identifier is invalid
|
|
152
|
+
*/
|
|
153
|
+
export function validateWorktreeIdentifier(data) {
|
|
154
|
+
return validateRequired(data, ['org', 'repo', 'branch']);
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Extracts and validates repository parameters from URL search params
|
|
158
|
+
* @param searchParams - URL search params
|
|
159
|
+
* @returns Validated {org, repo}
|
|
160
|
+
* @throws {ValidationError} If org or repo is missing
|
|
161
|
+
*/
|
|
162
|
+
export function extractRepositoryParams(searchParams) {
|
|
163
|
+
const org = normalizeString(searchParams.get('org'));
|
|
164
|
+
const repo = normalizeString(searchParams.get('repo'));
|
|
165
|
+
if (!org || !repo) {
|
|
166
|
+
throw new ValidationError('org and repo query parameters are required');
|
|
167
|
+
}
|
|
168
|
+
return { org, repo };
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Extracts and validates worktree parameters from URL search params
|
|
172
|
+
* @param searchParams - URL search params
|
|
173
|
+
* @param options - Options for normalization
|
|
174
|
+
* @returns Validated {org, repo, branch}
|
|
175
|
+
* @throws {ValidationError} If any parameter is missing or invalid
|
|
176
|
+
*/
|
|
177
|
+
export function extractWorktreeParams(searchParams, options = {}) {
|
|
178
|
+
const org = normalizeString(searchParams.get('org'));
|
|
179
|
+
const repo = normalizeString(searchParams.get('repo'));
|
|
180
|
+
const branchParam = searchParams.get('branch') || '';
|
|
181
|
+
const branch = options.normalizeBranch !== false
|
|
182
|
+
? normalizeBranchName(branchParam)
|
|
183
|
+
: normalizeString(branchParam);
|
|
184
|
+
if (!org || !repo || !branch) {
|
|
185
|
+
throw new ValidationError('org, repo, and branch are required');
|
|
186
|
+
}
|
|
187
|
+
return { org, repo, branch };
|
|
188
|
+
}
|
|
189
|
+
//# sourceMappingURL=request-validator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request-validator.js","sourceRoot":"","sources":["../../src/validation/request-validator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAEzD;;GAEG;AACH,SAAS,eAAe,CAAC,KAAc;IACrC,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;AACvD,CAAC;AAED,6EAA6E;AAC7E,6DAA6D;AAC7D,4BAA4B;AAC5B,KAAK;AAEL;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAC9B,IAAa,EACb,cAA4B;IAE5B,IAAI,CAAC,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;QACtC,MAAM,IAAI,eAAe,CAAC,yBAAyB,CAAC,CAAC;IACvD,CAAC;IAED,MAAM,MAAM,GAA2B,EAAE,CAAC;IAC1C,MAAM,aAAa,GAAa,EAAE,CAAC;IAEnC,KAAK,MAAM,KAAK,IAAI,cAAc,EAAE,CAAC;QACnC,MAAM,KAAK,GAAG,eAAe,CAAE,IAAgC,CAAC,KAAK,CAAC,CAAC,CAAC;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AAO,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC;AACvB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,qBAAqB,CACnC,YAA6B,EAC7B,UAAyC,EAAE;IAE3C,MAAM,GAAG,GAAG,eAAe,CAAC,YAAY,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;IACrD,MAAM,IAAI,GAAG,eAAe,CAAC,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;IACvD,MAAM,WAAW,GAAG,YAAY,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;IAErD,MAAM,MAAM,GAAG,OAAO,CAAC,eAAe,KAAK,KAAK;QAC9C,CAAC,CAAC,mBAAmB,CAAC,WAAW,CAAC;QAClC,CAAC,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC;IAEjC,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;QAC7B,MAAM,IAAI,eAAe,CAAC,oCAAoC,CAAC,CAAC;IAClE,CAAC;IAED,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;AAC/B,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export interface RepositoryCreateInput {
|
|
2
|
+
url: string;
|
|
3
|
+
initCommand: string;
|
|
4
|
+
}
|
|
5
|
+
export interface RepositoryDeleteInput {
|
|
6
|
+
org: string;
|
|
7
|
+
repo: string;
|
|
8
|
+
}
|
|
9
|
+
export interface InitCommandUpdateInput {
|
|
10
|
+
org: string;
|
|
11
|
+
repo: string;
|
|
12
|
+
initCommand: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Validates a repository creation request
|
|
16
|
+
*/
|
|
17
|
+
export declare function validateRepositoryCreate(payload: unknown): RepositoryCreateInput;
|
|
18
|
+
/**
|
|
19
|
+
* Validates a repository deletion request
|
|
20
|
+
*/
|
|
21
|
+
export declare function validateRepositoryDelete(payload: unknown): RepositoryDeleteInput;
|
|
22
|
+
/**
|
|
23
|
+
* Validates an init command update request
|
|
24
|
+
*/
|
|
25
|
+
export declare function validateInitCommandUpdate(payload: unknown): InitCommandUpdateInput;
|
|
26
|
+
//# sourceMappingURL=repository-schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repository-schema.d.ts","sourceRoot":"","sources":["../../../src/validation/schemas/repository-schema.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,qBAAqB;IACpC,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,qBAAqB;IACpC,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,sBAAsB;IACrC,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,OAAO,GAAG,qBAAqB,CAUhF;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,OAAO,GAAG,qBAAqB,CAEhF;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,OAAO,GAAG,sBAAsB,CAQlF"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { validateRequired, validateOptional, requireNonEmpty, } from '../request-validator.js';
|
|
2
|
+
/**
|
|
3
|
+
* Validates a repository creation request
|
|
4
|
+
*/
|
|
5
|
+
export function validateRepositoryCreate(payload) {
|
|
6
|
+
if (!payload || typeof payload !== 'object') {
|
|
7
|
+
throw new Error('Invalid request payload');
|
|
8
|
+
}
|
|
9
|
+
const data = payload;
|
|
10
|
+
const url = requireNonEmpty(data['url'] || data['repoUrl'], 'Repository URL');
|
|
11
|
+
const { initCommand } = validateOptional(data, { initCommand: '' });
|
|
12
|
+
return { url, initCommand };
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Validates a repository deletion request
|
|
16
|
+
*/
|
|
17
|
+
export function validateRepositoryDelete(payload) {
|
|
18
|
+
return validateRequired(payload, ['org', 'repo']);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Validates an init command update request
|
|
22
|
+
*/
|
|
23
|
+
export function validateInitCommandUpdate(payload) {
|
|
24
|
+
const { org, repo } = validateRequired(payload, ['org', 'repo']);
|
|
25
|
+
const data = payload;
|
|
26
|
+
const initCommand = typeof data['initCommand'] === 'string'
|
|
27
|
+
? data['initCommand']
|
|
28
|
+
: '';
|
|
29
|
+
return { org, repo, initCommand };
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=repository-schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repository-schema.js","sourceRoot":"","sources":["../../../src/validation/schemas/repository-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,GAChB,MAAM,yBAAyB,CAAC;AAkBjC;;GAEG;AACH,MAAM,UAAU,wBAAwB,CAAC,OAAgB;IACvD,IAAI,CAAC,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;QAC5C,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IAED,MAAM,IAAI,GAAG,OAAkC,CAAC;IAChD,MAAM,GAAG,GAAG,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,SAAS,CAAC,EAAE,gBAAgB,CAAC,CAAC;IAC9E,MAAM,EAAE,WAAW,EAAE,GAAG,gBAAgB,CAAC,IAAI,EAAE,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC,CAAC;IAEpE,OAAO,EAAE,GAAG,EAAE,WAAW,EAAE,CAAC;AAC9B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,wBAAwB,CAAC,OAAgB;IACvD,OAAO,gBAAgB,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,CAAU,CAAC,CAAC;AAC7D,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,yBAAyB,CAAC,OAAgB;IACxD,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,gBAAgB,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,CAAU,CAAC,CAAC;IAC1E,MAAM,IAAI,GAAG,OAAkC,CAAC;IAChD,MAAM,WAAW,GAAG,OAAO,IAAI,CAAC,aAAa,CAAC,KAAK,QAAQ;QACzD,CAAC,CAAC,IAAI,CAAC,aAAa,CAAW;QAC/B,CAAC,CAAC,EAAE,CAAC;IAEP,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC;AACpC,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface TerminalOpenInput {
|
|
2
|
+
org: string;
|
|
3
|
+
repo: string;
|
|
4
|
+
branch: string;
|
|
5
|
+
command: string;
|
|
6
|
+
hasPrompt: boolean;
|
|
7
|
+
prompt?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface TerminalSendInput {
|
|
10
|
+
sessionId: string;
|
|
11
|
+
input: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Validates a terminal open request
|
|
15
|
+
*/
|
|
16
|
+
export declare function validateTerminalOpen(payload: unknown): TerminalOpenInput;
|
|
17
|
+
/**
|
|
18
|
+
* Validates a terminal send input request
|
|
19
|
+
*/
|
|
20
|
+
export declare function validateTerminalSend(payload: unknown): TerminalSendInput;
|
|
21
|
+
//# sourceMappingURL=terminal-schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"terminal-schema.d.ts","sourceRoot":"","sources":["../../../src/validation/schemas/terminal-schema.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,iBAAiB;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,iBAAiB,CAyBxE;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,iBAAiB,CAUxE"}
|