@pcontext/api 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 +151 -0
- package/dist/app.d.mts +44779 -0
- package/dist/app.d.mts.map +1 -0
- package/dist/app.mjs +37 -0
- package/dist/app.mjs.map +1 -0
- package/dist/client.d.mts +22428 -0
- package/dist/client.d.mts.map +1 -0
- package/dist/client.mjs +15 -0
- package/dist/client.mjs.map +1 -0
- package/dist/dev.d.mts +11 -0
- package/dist/dev.d.mts.map +1 -0
- package/dist/dev.mjs +16 -0
- package/dist/dev.mjs.map +1 -0
- package/dist/index.d.mts +3 -0
- package/dist/index.mjs +10 -0
- package/dist/index.mjs.map +1 -0
- package/dist/modules/doc/chat.route.d.mts +18 -0
- package/dist/modules/doc/chat.route.d.mts.map +1 -0
- package/dist/modules/doc/chat.route.mjs +20 -0
- package/dist/modules/doc/chat.route.mjs.map +1 -0
- package/dist/modules/doc/chat.service.d.mts +10 -0
- package/dist/modules/doc/chat.service.d.mts.map +1 -0
- package/dist/modules/doc/chat.service.mjs +29 -0
- package/dist/modules/doc/chat.service.mjs.map +1 -0
- package/dist/modules/doc/doc.dto.d.mts +67 -0
- package/dist/modules/doc/doc.dto.d.mts.map +1 -0
- package/dist/modules/doc/doc.dto.mjs +43 -0
- package/dist/modules/doc/doc.dto.mjs.map +1 -0
- package/dist/modules/doc/doc.entity.d.mts +19 -0
- package/dist/modules/doc/doc.entity.d.mts.map +1 -0
- package/dist/modules/doc/doc.entity.mjs +1 -0
- package/dist/modules/doc/doc.repo.interface.d.mts +28 -0
- package/dist/modules/doc/doc.repo.interface.d.mts.map +1 -0
- package/dist/modules/doc/doc.repo.interface.mjs +1 -0
- package/dist/modules/doc/doc.route.d.mts +14193 -0
- package/dist/modules/doc/doc.route.d.mts.map +1 -0
- package/dist/modules/doc/doc.route.mjs +100 -0
- package/dist/modules/doc/doc.route.mjs.map +1 -0
- package/dist/modules/doc/doc.service.d.mts +38 -0
- package/dist/modules/doc/doc.service.d.mts.map +1 -0
- package/dist/modules/doc/doc.service.mjs +134 -0
- package/dist/modules/doc/doc.service.mjs.map +1 -0
- package/dist/modules/doc/doc.vo.d.mts +17 -0
- package/dist/modules/doc/doc.vo.d.mts.map +1 -0
- package/dist/modules/doc/doc.vo.mjs +1 -0
- package/dist/modules/doc/infrastructure/agent/engine/chat.d.mts +21 -0
- package/dist/modules/doc/infrastructure/agent/engine/chat.d.mts.map +1 -0
- package/dist/modules/doc/infrastructure/agent/engine/chat.mjs +36 -0
- package/dist/modules/doc/infrastructure/agent/engine/chat.mjs.map +1 -0
- package/dist/modules/doc/infrastructure/agent/engine/generate.d.mts +28 -0
- package/dist/modules/doc/infrastructure/agent/engine/generate.d.mts.map +1 -0
- package/dist/modules/doc/infrastructure/agent/engine/generate.mjs +135 -0
- package/dist/modules/doc/infrastructure/agent/engine/generate.mjs.map +1 -0
- package/dist/modules/doc/infrastructure/agent/engine/query-filter.d.mts +7 -0
- package/dist/modules/doc/infrastructure/agent/engine/query-filter.d.mts.map +1 -0
- package/dist/modules/doc/infrastructure/agent/engine/query-filter.mjs +12 -0
- package/dist/modules/doc/infrastructure/agent/engine/query-filter.mjs.map +1 -0
- package/dist/modules/doc/infrastructure/agent/loaders/git-repository-reader.d.mts +54 -0
- package/dist/modules/doc/infrastructure/agent/loaders/git-repository-reader.d.mts.map +1 -0
- package/dist/modules/doc/infrastructure/agent/loaders/git-repository-reader.mjs +142 -0
- package/dist/modules/doc/infrastructure/agent/loaders/git-repository-reader.mjs.map +1 -0
- package/dist/modules/doc/infrastructure/agent/loaders/index.d.mts +3 -0
- package/dist/modules/doc/infrastructure/agent/loaders/index.mjs +4 -0
- package/dist/modules/doc/infrastructure/agent/loaders/website-crawl-reader.d.mts +42 -0
- package/dist/modules/doc/infrastructure/agent/loaders/website-crawl-reader.d.mts.map +1 -0
- package/dist/modules/doc/infrastructure/agent/loaders/website-crawl-reader.mjs +104 -0
- package/dist/modules/doc/infrastructure/agent/loaders/website-crawl-reader.mjs.map +1 -0
- package/dist/modules/doc/infrastructure/agent/settings.d.mts +5 -0
- package/dist/modules/doc/infrastructure/agent/settings.d.mts.map +1 -0
- package/dist/modules/doc/infrastructure/agent/settings.mjs +72 -0
- package/dist/modules/doc/infrastructure/agent/settings.mjs.map +1 -0
- package/dist/modules/doc/infrastructure/agent/storage/index.d.mts +7 -0
- package/dist/modules/doc/infrastructure/agent/storage/index.d.mts.map +1 -0
- package/dist/modules/doc/infrastructure/agent/storage/index.mjs +12 -0
- package/dist/modules/doc/infrastructure/agent/storage/index.mjs.map +1 -0
- package/dist/modules/doc/infrastructure/agent/storage/vector-store.d.mts +14 -0
- package/dist/modules/doc/infrastructure/agent/storage/vector-store.d.mts.map +1 -0
- package/dist/modules/doc/infrastructure/agent/storage/vector-store.mjs +35 -0
- package/dist/modules/doc/infrastructure/agent/storage/vector-store.mjs.map +1 -0
- package/dist/modules/doc/infrastructure/doc.po.d.mts +570 -0
- package/dist/modules/doc/infrastructure/doc.po.d.mts.map +1 -0
- package/dist/modules/doc/infrastructure/doc.po.mjs +54 -0
- package/dist/modules/doc/infrastructure/doc.po.mjs.map +1 -0
- package/dist/modules/doc/infrastructure/doc.repo.pg.d.mts +32 -0
- package/dist/modules/doc/infrastructure/doc.repo.pg.d.mts.map +1 -0
- package/dist/modules/doc/infrastructure/doc.repo.pg.mjs +157 -0
- package/dist/modules/doc/infrastructure/doc.repo.pg.mjs.map +1 -0
- package/dist/modules/doc/infrastructure/doc.repo.sqlite.d.mts +32 -0
- package/dist/modules/doc/infrastructure/doc.repo.sqlite.d.mts.map +1 -0
- package/dist/modules/doc/infrastructure/doc.repo.sqlite.mjs +153 -0
- package/dist/modules/doc/infrastructure/doc.repo.sqlite.mjs.map +1 -0
- package/dist/modules/doc/mcp.route.d.mts +18 -0
- package/dist/modules/doc/mcp.route.d.mts.map +1 -0
- package/dist/modules/doc/mcp.route.mjs +39 -0
- package/dist/modules/doc/mcp.route.mjs.map +1 -0
- package/dist/modules/doc/mcp.service.d.mts +22 -0
- package/dist/modules/doc/mcp.service.d.mts.map +1 -0
- package/dist/modules/doc/mcp.service.mjs +119 -0
- package/dist/modules/doc/mcp.service.mjs.map +1 -0
- package/dist/modules/rank/rank.dto.d.mts +10 -0
- package/dist/modules/rank/rank.dto.d.mts.map +1 -0
- package/dist/modules/rank/rank.dto.mjs +8 -0
- package/dist/modules/rank/rank.dto.mjs.map +1 -0
- package/dist/modules/rank/rank.route.d.mts +2033 -0
- package/dist/modules/rank/rank.route.d.mts.map +1 -0
- package/dist/modules/rank/rank.route.mjs +20 -0
- package/dist/modules/rank/rank.route.mjs.map +1 -0
- package/dist/modules/rank/rank.service.d.mts +32 -0
- package/dist/modules/rank/rank.service.d.mts.map +1 -0
- package/dist/modules/rank/rank.service.mjs +3 -0
- package/dist/modules/rank/rank.vo.d.mts +9 -0
- package/dist/modules/rank/rank.vo.d.mts.map +1 -0
- package/dist/modules/rank/rank.vo.mjs +1 -0
- package/dist/modules/task/infrastructure/mq/task-context.d.mts +29 -0
- package/dist/modules/task/infrastructure/mq/task-context.d.mts.map +1 -0
- package/dist/modules/task/infrastructure/mq/task-context.mjs +70 -0
- package/dist/modules/task/infrastructure/mq/task-context.mjs.map +1 -0
- package/dist/modules/task/infrastructure/mq/task-queue.d.mts +10 -0
- package/dist/modules/task/infrastructure/mq/task-queue.d.mts.map +1 -0
- package/dist/modules/task/infrastructure/mq/task-queue.mjs +12 -0
- package/dist/modules/task/infrastructure/mq/task-queue.mjs.map +1 -0
- package/dist/modules/task/infrastructure/mq/task-worker.d.mts +13 -0
- package/dist/modules/task/infrastructure/mq/task-worker.d.mts.map +1 -0
- package/dist/modules/task/infrastructure/mq/task-worker.mjs +35 -0
- package/dist/modules/task/infrastructure/mq/task-worker.mjs.map +1 -0
- package/dist/modules/task/infrastructure/task.po.d.mts +1147 -0
- package/dist/modules/task/infrastructure/task.po.d.mts.map +1 -0
- package/dist/modules/task/infrastructure/task.po.mjs +55 -0
- package/dist/modules/task/infrastructure/task.po.mjs.map +1 -0
- package/dist/modules/task/infrastructure/task.repo.pg.d.mts +21 -0
- package/dist/modules/task/infrastructure/task.repo.pg.d.mts.map +1 -0
- package/dist/modules/task/infrastructure/task.repo.pg.mjs +86 -0
- package/dist/modules/task/infrastructure/task.repo.pg.mjs.map +1 -0
- package/dist/modules/task/infrastructure/task.repo.sqlite.d.mts +21 -0
- package/dist/modules/task/infrastructure/task.repo.sqlite.d.mts.map +1 -0
- package/dist/modules/task/infrastructure/task.repo.sqlite.mjs +89 -0
- package/dist/modules/task/infrastructure/task.repo.sqlite.mjs.map +1 -0
- package/dist/modules/task/task.dto.d.mts +26 -0
- package/dist/modules/task/task.dto.d.mts.map +1 -0
- package/dist/modules/task/task.dto.mjs +25 -0
- package/dist/modules/task/task.dto.mjs.map +1 -0
- package/dist/modules/task/task.entity.d.mts +43 -0
- package/dist/modules/task/task.entity.d.mts.map +1 -0
- package/dist/modules/task/task.entity.mjs +1 -0
- package/dist/modules/task/task.repo.interface.d.mts +17 -0
- package/dist/modules/task/task.repo.interface.d.mts.map +1 -0
- package/dist/modules/task/task.repo.interface.mjs +1 -0
- package/dist/modules/task/task.route.d.mts +4087 -0
- package/dist/modules/task/task.route.d.mts.map +1 -0
- package/dist/modules/task/task.route.mjs +63 -0
- package/dist/modules/task/task.route.mjs.map +1 -0
- package/dist/modules/task/task.service.d.mts +28 -0
- package/dist/modules/task/task.service.d.mts.map +1 -0
- package/dist/modules/task/task.service.mjs +202 -0
- package/dist/modules/task/task.service.mjs.map +1 -0
- package/dist/modules/task/task.vo.d.mts +18 -0
- package/dist/modules/task/task.vo.d.mts.map +1 -0
- package/dist/modules/task/task.vo.mjs +1 -0
- package/dist/modules/user/application/user.service.d.mts +24 -0
- package/dist/modules/user/application/user.service.d.mts.map +1 -0
- package/dist/modules/user/application/user.service.mjs +153 -0
- package/dist/modules/user/application/user.service.mjs.map +1 -0
- package/dist/modules/user/domain/user.entity.d.mts +24 -0
- package/dist/modules/user/domain/user.entity.d.mts.map +1 -0
- package/dist/modules/user/domain/user.entity.mjs +35 -0
- package/dist/modules/user/domain/user.entity.mjs.map +1 -0
- package/dist/modules/user/domain/user.repo.interface.d.mts +27 -0
- package/dist/modules/user/domain/user.repo.interface.d.mts.map +1 -0
- package/dist/modules/user/domain/user.repo.interface.mjs +1 -0
- package/dist/modules/user/infrastructure/casbin/adapter.d.mts +7 -0
- package/dist/modules/user/infrastructure/casbin/adapter.d.mts.map +1 -0
- package/dist/modules/user/infrastructure/casbin/adapter.mjs +13 -0
- package/dist/modules/user/infrastructure/casbin/adapter.mjs.map +1 -0
- package/dist/modules/user/infrastructure/casbin/adapter.pg.d.mts +19 -0
- package/dist/modules/user/infrastructure/casbin/adapter.pg.d.mts.map +1 -0
- package/dist/modules/user/infrastructure/casbin/adapter.pg.mjs +129 -0
- package/dist/modules/user/infrastructure/casbin/adapter.pg.mjs.map +1 -0
- package/dist/modules/user/infrastructure/casbin/adapter.sqlite.d.mts +19 -0
- package/dist/modules/user/infrastructure/casbin/adapter.sqlite.d.mts.map +1 -0
- package/dist/modules/user/infrastructure/casbin/adapter.sqlite.mjs +129 -0
- package/dist/modules/user/infrastructure/casbin/adapter.sqlite.mjs.map +1 -0
- package/dist/modules/user/infrastructure/casbin/enforcer.d.mts +9 -0
- package/dist/modules/user/infrastructure/casbin/enforcer.d.mts.map +1 -0
- package/dist/modules/user/infrastructure/casbin/enforcer.mjs +150 -0
- package/dist/modules/user/infrastructure/casbin/enforcer.mjs.map +1 -0
- package/dist/modules/user/infrastructure/casbin-rule.po.d.mts +643 -0
- package/dist/modules/user/infrastructure/casbin-rule.po.d.mts.map +1 -0
- package/dist/modules/user/infrastructure/casbin-rule.po.mjs +30 -0
- package/dist/modules/user/infrastructure/casbin-rule.po.mjs.map +1 -0
- package/dist/modules/user/infrastructure/user.po.d.mts +392 -0
- package/dist/modules/user/infrastructure/user.po.d.mts.map +1 -0
- package/dist/modules/user/infrastructure/user.po.mjs +34 -0
- package/dist/modules/user/infrastructure/user.po.mjs.map +1 -0
- package/dist/modules/user/infrastructure/user.repo.pg.d.mts +24 -0
- package/dist/modules/user/infrastructure/user.repo.pg.d.mts.map +1 -0
- package/dist/modules/user/infrastructure/user.repo.pg.mjs +90 -0
- package/dist/modules/user/infrastructure/user.repo.pg.mjs.map +1 -0
- package/dist/modules/user/infrastructure/user.repo.sqlite.d.mts +24 -0
- package/dist/modules/user/infrastructure/user.repo.sqlite.d.mts.map +1 -0
- package/dist/modules/user/infrastructure/user.repo.sqlite.mjs +88 -0
- package/dist/modules/user/infrastructure/user.repo.sqlite.mjs.map +1 -0
- package/dist/modules/user/interfaces/admin.route.d.mts +8270 -0
- package/dist/modules/user/interfaces/admin.route.d.mts.map +1 -0
- package/dist/modules/user/interfaces/admin.route.mjs +74 -0
- package/dist/modules/user/interfaces/admin.route.mjs.map +1 -0
- package/dist/modules/user/interfaces/role.route.d.mts +102 -0
- package/dist/modules/user/interfaces/role.route.d.mts.map +1 -0
- package/dist/modules/user/interfaces/role.route.mjs +60 -0
- package/dist/modules/user/interfaces/role.route.mjs.map +1 -0
- package/dist/modules/user/interfaces/user.dto.d.mts +106 -0
- package/dist/modules/user/interfaces/user.dto.d.mts.map +1 -0
- package/dist/modules/user/interfaces/user.dto.mjs +32 -0
- package/dist/modules/user/interfaces/user.dto.mjs.map +1 -0
- package/dist/modules/user/interfaces/user.route.d.mts +2093 -0
- package/dist/modules/user/interfaces/user.route.d.mts.map +1 -0
- package/dist/modules/user/interfaces/user.route.mjs +69 -0
- package/dist/modules/user/interfaces/user.route.mjs.map +1 -0
- package/dist/modules/user/interfaces/user.vo.d.mts +28 -0
- package/dist/modules/user/interfaces/user.vo.d.mts.map +1 -0
- package/dist/modules/user/interfaces/user.vo.mjs +18 -0
- package/dist/modules/user/interfaces/user.vo.mjs.map +1 -0
- package/dist/rank.service-D2h-2iJA.mjs +109 -0
- package/dist/rank.service-D2h-2iJA.mjs.map +1 -0
- package/dist/settings.d.mts +12 -0
- package/dist/settings.d.mts.map +1 -0
- package/dist/settings.mjs +27 -0
- package/dist/settings.mjs.map +1 -0
- package/dist/shared/create-app.d.mts +13 -0
- package/dist/shared/create-app.d.mts.map +1 -0
- package/dist/shared/create-app.mjs +45 -0
- package/dist/shared/create-app.mjs.map +1 -0
- package/dist/shared/db/bootstrap.d.mts +5 -0
- package/dist/shared/db/bootstrap.d.mts.map +1 -0
- package/dist/shared/db/bootstrap.mjs +51 -0
- package/dist/shared/db/bootstrap.mjs.map +1 -0
- package/dist/shared/db/connection.d.mts +1567 -0
- package/dist/shared/db/connection.d.mts.map +1 -0
- package/dist/shared/db/connection.mjs +59 -0
- package/dist/shared/db/connection.mjs.map +1 -0
- package/dist/shared/db/migrations/pg/0000_init.sql +74 -0
- package/dist/shared/db/migrations/pg/0001_snippets & tokens.sql +6 -0
- package/dist/shared/db/migrations/pg/0002_change_task_id_to_uuid_v7.sql +3 -0
- package/dist/shared/db/migrations/pg/meta/0000_snapshot.json +498 -0
- package/dist/shared/db/migrations/pg/meta/0001_snapshot.json +513 -0
- package/dist/shared/db/migrations/pg/meta/0002_snapshot.json +514 -0
- package/dist/shared/db/migrations/pg/meta/_journal.json +27 -0
- package/dist/shared/db/migrations/sqlite/0000_init.sql +72 -0
- package/dist/shared/db/migrations/sqlite/0001_snippets & tokens.sql +2 -0
- package/dist/shared/db/migrations/sqlite/0002_change_task_id_to_uuid_v7.sql +35 -0
- package/dist/shared/db/migrations/sqlite/meta/0000_snapshot.json +493 -0
- package/dist/shared/db/migrations/sqlite/meta/0001_snapshot.json +509 -0
- package/dist/shared/db/migrations/sqlite/meta/0002_snapshot.json +509 -0
- package/dist/shared/db/migrations/sqlite/meta/_journal.json +27 -0
- package/dist/shared/db/seed.d.mts +5 -0
- package/dist/shared/db/seed.d.mts.map +1 -0
- package/dist/shared/db/seed.mjs +42 -0
- package/dist/shared/db/seed.mjs.map +1 -0
- package/dist/shared/deps.d.mts +28 -0
- package/dist/shared/deps.d.mts.map +1 -0
- package/dist/shared/deps.mjs +69 -0
- package/dist/shared/deps.mjs.map +1 -0
- package/dist/shared/dto/index.d.mts +11 -0
- package/dist/shared/dto/index.d.mts.map +1 -0
- package/dist/shared/dto/index.mjs +11 -0
- package/dist/shared/dto/index.mjs.map +1 -0
- package/dist/shared/logger.d.mts +14 -0
- package/dist/shared/logger.d.mts.map +1 -0
- package/dist/shared/logger.mjs +37 -0
- package/dist/shared/logger.mjs.map +1 -0
- package/dist/shared/mcp/createTool.d.mts +15 -0
- package/dist/shared/mcp/createTool.d.mts.map +1 -0
- package/dist/shared/mcp/createTool.mjs +8 -0
- package/dist/shared/mcp/createTool.mjs.map +1 -0
- package/dist/shared/middleware/authorization.d.mts +15 -0
- package/dist/shared/middleware/authorization.d.mts.map +1 -0
- package/dist/shared/middleware/authorization.mjs +46 -0
- package/dist/shared/middleware/authorization.mjs.map +1 -0
- package/dist/shared/middleware/http-logger.d.mts +7 -0
- package/dist/shared/middleware/http-logger.d.mts.map +1 -0
- package/dist/shared/middleware/http-logger.mjs +40 -0
- package/dist/shared/middleware/http-logger.mjs.map +1 -0
- package/dist/shared/middleware/jwt.d.mts +7 -0
- package/dist/shared/middleware/jwt.d.mts.map +1 -0
- package/dist/shared/middleware/jwt.mjs +34 -0
- package/dist/shared/middleware/jwt.mjs.map +1 -0
- package/dist/shared/middleware/limiter.d.mts +7 -0
- package/dist/shared/middleware/limiter.d.mts.map +1 -0
- package/dist/shared/middleware/limiter.mjs +10 -0
- package/dist/shared/middleware/limiter.mjs.map +1 -0
- package/dist/shared/middleware/services.d.mts +8 -0
- package/dist/shared/middleware/services.d.mts.map +1 -0
- package/dist/shared/middleware/services.mjs +19 -0
- package/dist/shared/middleware/services.mjs.map +1 -0
- package/dist/shared/redis/decorator.d.mts +113 -0
- package/dist/shared/redis/decorator.d.mts.map +1 -0
- package/dist/shared/redis/decorator.mjs +203 -0
- package/dist/shared/redis/decorator.mjs.map +1 -0
- package/dist/shared/redis/factory.d.mts +18 -0
- package/dist/shared/redis/factory.d.mts.map +1 -0
- package/dist/shared/redis/factory.mjs +41 -0
- package/dist/shared/redis/factory.mjs.map +1 -0
- package/dist/shared/redis/index.d.mts +12 -0
- package/dist/shared/redis/index.d.mts.map +1 -0
- package/dist/shared/redis/index.mjs +14 -0
- package/dist/shared/redis/index.mjs.map +1 -0
- package/dist/shared/types.d.mts +36 -0
- package/dist/shared/types.d.mts.map +1 -0
- package/dist/shared/types.mjs +1 -0
- package/dist/shared/utils/date.d.mts +1 -0
- package/dist/shared/utils/date.mjs +1 -0
- package/dist/shared/utils/error-handler.d.mts +7 -0
- package/dist/shared/utils/error-handler.d.mts.map +1 -0
- package/dist/shared/utils/error-handler.mjs +22 -0
- package/dist/shared/utils/error-handler.mjs.map +1 -0
- package/dist/shared/utils/format.d.mts +8 -0
- package/dist/shared/utils/format.d.mts.map +1 -0
- package/dist/shared/utils/format.mjs +24 -0
- package/dist/shared/utils/format.mjs.map +1 -0
- package/dist/shared/utils/pagination.d.mts +9 -0
- package/dist/shared/utils/pagination.d.mts.map +1 -0
- package/dist/shared/utils/pagination.mjs +12 -0
- package/dist/shared/utils/pagination.mjs.map +1 -0
- package/dist/shared/utils/response-template.d.mts +69 -0
- package/dist/shared/utils/response-template.d.mts.map +1 -0
- package/dist/shared/utils/response-template.mjs +96 -0
- package/dist/shared/utils/response-template.mjs.map +1 -0
- package/dist/shared/utils/url.d.mts +18 -0
- package/dist/shared/utils/url.d.mts.map +1 -0
- package/dist/shared/utils/url.mjs +39 -0
- package/dist/shared/utils/url.mjs.map +1 -0
- package/dist/shared/utils/user.d.mts +8 -0
- package/dist/shared/utils/user.d.mts.map +1 -0
- package/dist/shared/utils/user.mjs +11 -0
- package/dist/shared/utils/user.mjs.map +1 -0
- package/dist/shared/utils/validator.d.mts +5984 -0
- package/dist/shared/utils/validator.d.mts.map +1 -0
- package/dist/shared/utils/validator.mjs +34 -0
- package/dist/shared/utils/validator.mjs.map +1 -0
- package/dist/shared/vo/index.d.mts +11 -0
- package/dist/shared/vo/index.d.mts.map +1 -0
- package/dist/shared/vo/index.mjs +1 -0
- package/package.json +86 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.mts","names":[],"sources":["../src/client.ts"],"mappings":";;;;;;;;;;;;;;;;;;;iBAcgB,YAAA,CAAA,GAAgB,IAAA,EAAM,UAAA,QAAkB,EAAA;;;;;;cAAR,iBAAA,CAAA,SAAA"}
|
package/dist/client.mjs
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { paginationQuerySchema } from "./shared/dto/index.mjs";
|
|
2
|
+
import { CreateDocSchema, DocAddBodySchema, DocListQuerySchema, DocSearchQuerySchema, DocSnippetsQuerySchema, DocSourceEnum, PositiveIntOptionalSchema } from "./modules/doc/doc.dto.mjs";
|
|
3
|
+
import { userSchema } from "./modules/user/interfaces/user.vo.mjs";
|
|
4
|
+
import { adminCreateUserBodySchema, adminUpdateUserBodySchema, baseUserSchema, createUserSchema, listUsersQuerySchema, updateSelfSchema, updateUserRolesSchema, updateUserSchema, userLoginSchema } from "./modules/user/interfaces/user.dto.mjs";
|
|
5
|
+
import { CreateTaskLogSchema, CreateTaskSchema } from "./modules/task/task.dto.mjs";
|
|
6
|
+
import { hc } from "hono/client";
|
|
7
|
+
|
|
8
|
+
//#region src/client.ts
|
|
9
|
+
function createClient(...args) {
|
|
10
|
+
return hc(...args);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
//#endregion
|
|
14
|
+
export { CreateDocSchema, CreateTaskLogSchema, CreateTaskSchema, DocAddBodySchema, DocListQuerySchema, DocSearchQuerySchema, DocSnippetsQuerySchema, DocSourceEnum, PositiveIntOptionalSchema, adminCreateUserBodySchema, adminUpdateUserBodySchema, baseUserSchema, createClient, createUserSchema, listUsersQuerySchema, paginationQuerySchema, updateSelfSchema, updateUserRolesSchema, updateUserSchema, userLoginSchema, userSchema };
|
|
15
|
+
//# sourceMappingURL=client.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.mjs","names":[],"sources":["../src/client.ts"],"sourcesContent":["import type { AppType } from './app'\nimport { hc } from 'hono/client'\n\nexport * from './shared/dto'\nexport type * from './shared/types'\nexport * from './shared/vo'\nexport * from '@/modules/doc/doc.dto'\nexport * from '@/modules/doc/doc.vo'\nexport * from '@/modules/rank/rank.vo'\nexport * from '@/modules/task/task.dto'\nexport * from '@/modules/task/task.vo'\nexport * from '@/modules/user/interfaces/user.dto'\nexport * from '@/modules/user/interfaces/user.vo'\n\nexport function createClient(...args: Parameters<typeof hc>) {\n return hc<AppType>(...args)\n}\n"],"mappings":";;;;;;;;AAcA,SAAgB,aAAa,GAAG,MAA6B;AAC3D,QAAO,GAAY,GAAG,KAAK"}
|
package/dist/dev.d.mts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as hono from "hono";
|
|
2
|
+
|
|
3
|
+
//#region src/dev.d.ts
|
|
4
|
+
declare const _default: {
|
|
5
|
+
port: any;
|
|
6
|
+
fetch: (request: Request, Env?: unknown, executionCtx?: hono.ExecutionContext) => Response | Promise<Response>;
|
|
7
|
+
idleTimeout: number;
|
|
8
|
+
};
|
|
9
|
+
//#endregion
|
|
10
|
+
export { _default as default };
|
|
11
|
+
//# sourceMappingURL=dev.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev.d.mts","names":[],"sources":["../src/dev.ts"],"mappings":""}
|
package/dist/dev.mjs
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import AppSettings, { loadSettingsConfig } from "./settings.mjs";
|
|
2
|
+
import "./rank.service-D2h-2iJA.mjs";
|
|
3
|
+
import { app, initApp } from "./app.mjs";
|
|
4
|
+
|
|
5
|
+
//#region src/dev.ts
|
|
6
|
+
await loadSettingsConfig("../../../pcontext.config.local.js");
|
|
7
|
+
await initApp();
|
|
8
|
+
var dev_default = {
|
|
9
|
+
port: AppSettings.config.port,
|
|
10
|
+
fetch: app.fetch,
|
|
11
|
+
idleTimeout: 60
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
export { dev_default as default };
|
|
16
|
+
//# sourceMappingURL=dev.mjs.map
|
package/dist/dev.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev.mjs","names":[],"sources":["../src/dev.ts"],"sourcesContent":["// import { initSettings as initAgentSettings } from '@/modules/doc/infrastructure/agent/settings'\n// import { initEnforcer } from '@/modules/user/infrastructure/casbin/enforcer'\n// import { bootstrap } from '@/shared/db/bootstrap'\n// import { initDb } from '@/shared/db/connection'\nimport { app, initApp } from './app'\nimport AppSettings, { loadSettingsConfig } from './settings'\n\nawait loadSettingsConfig('../../../pcontext.config.local.js')\nawait initApp()\n\nexport default {\n port: AppSettings.config.port,\n fetch: app.fetch,\n idleTimeout: 60,\n}\n"],"mappings":";;;;;AAOA,MAAM,mBAAmB,oCAAoC;AAC7D,MAAM,SAAS;AAEf,kBAAe;CACb,MAAM,YAAY,OAAO;CACzB,OAAO,IAAI;CACX,aAAa;CACd"}
|
package/dist/index.d.mts
ADDED
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { loadSettingsConfig } from "./settings.mjs";
|
|
2
|
+
import "./rank.service-D2h-2iJA.mjs";
|
|
3
|
+
import { app, initApp } from "./app.mjs";
|
|
4
|
+
|
|
5
|
+
//#region src/index.ts
|
|
6
|
+
var src_default = app;
|
|
7
|
+
|
|
8
|
+
//#endregion
|
|
9
|
+
export { src_default as default, initApp, loadSettingsConfig };
|
|
10
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["import { app, initApp } from './app'\nimport { loadSettingsConfig } from './settings'\n\nexport { initApp, loadSettingsConfig }\nexport default app\n"],"mappings":";;;;;AAIA,kBAAe"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { AppBindings } from "../../shared/types.mjs";
|
|
2
|
+
import * as hono_utils_http_status0 from "hono/utils/http-status";
|
|
3
|
+
import * as hono_hono_base0 from "hono/hono-base";
|
|
4
|
+
|
|
5
|
+
//#region src/modules/doc/chat.route.d.ts
|
|
6
|
+
declare const router: hono_hono_base0.HonoBase<AppBindings, {
|
|
7
|
+
"/": {
|
|
8
|
+
$post: {
|
|
9
|
+
input: {};
|
|
10
|
+
output: {};
|
|
11
|
+
outputFormat: string;
|
|
12
|
+
status: hono_utils_http_status0.StatusCode;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
}, "/", "/">;
|
|
16
|
+
//#endregion
|
|
17
|
+
export { router as default };
|
|
18
|
+
//# sourceMappingURL=chat.route.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat.route.d.mts","names":[],"sources":["../../../src/modules/doc/chat.route.ts"],"mappings":";;;;;cAKM,MAAA,kBAAM,QAAA,CAkBR,WAAA;;;;;;cAlBQ,uBAAA,CAAA,UAAA;IAAA;EAAA;AAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import "../../rank.service-D2h-2iJA.mjs";
|
|
2
|
+
import { createRouter } from "../../shared/create-app.mjs";
|
|
3
|
+
import { toUIMessageStream } from "@ai-sdk/llamaindex";
|
|
4
|
+
import { createUIMessageStreamResponse } from "ai";
|
|
5
|
+
|
|
6
|
+
//#region src/modules/doc/chat.route.ts
|
|
7
|
+
const router = createRouter().post("/", async (c) => {
|
|
8
|
+
const { messages, libraryName } = await c.req.json();
|
|
9
|
+
const stream = await c.var.chatService.chat(messages, libraryName);
|
|
10
|
+
return createUIMessageStreamResponse({
|
|
11
|
+
status: 200,
|
|
12
|
+
statusText: "OK",
|
|
13
|
+
headers: { "Custom-Header": "value" },
|
|
14
|
+
stream: toUIMessageStream(stream)
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
//#endregion
|
|
19
|
+
export { router as default };
|
|
20
|
+
//# sourceMappingURL=chat.route.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat.route.mjs","names":[],"sources":["../../../src/modules/doc/chat.route.ts"],"sourcesContent":["import { createRouter } from '@/shared/create-app'\nimport { UIMessage } from 'ai'\nimport { toUIMessageStream } from '@ai-sdk/llamaindex'\nimport { createUIMessageStreamResponse } from 'ai'\n\nconst router = createRouter()\n .post('/', async (c)=>{\n\n const body = await c.req.json()\n const { messages, libraryName }: { messages: UIMessage[], libraryName?: string } = body\n \n const stream = await c.var.chatService.chat(messages, libraryName)\n\n return createUIMessageStreamResponse({\n status: 200,\n statusText: 'OK',\n headers: {\n 'Custom-Header': 'value',\n },\n // @ts-expect-error\n stream: toUIMessageStream(stream),\n })\n\n })\n\nexport default router\n"],"mappings":";;;;;;AAKA,MAAM,SAAS,cAAc,CAC1B,KAAK,KAAK,OAAO,MAAI;CAGpB,MAAM,EAAE,UAAW,gBADR,MAAM,EAAE,IAAI,MAAM;CAG7B,MAAM,SAAS,MAAM,EAAE,IAAI,YAAY,KAAK,UAAU,YAAY;AAElE,QAAO,8BAA8B;EACnC,QAAQ;EACR,YAAY;EACZ,SAAS,EACP,iBAAiB,SAClB;EAED,QAAQ,kBAAkB,OAAO;EAClC,CAAC;EAEF"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as llamaindex from "llamaindex";
|
|
2
|
+
import { UIMessage } from "ai";
|
|
3
|
+
|
|
4
|
+
//#region src/modules/doc/chat.service.d.ts
|
|
5
|
+
declare class ChatService {
|
|
6
|
+
chat(messages: UIMessage[], libraryName?: string): Promise<AsyncIterable<llamaindex.EngineResponse>>;
|
|
7
|
+
}
|
|
8
|
+
//#endregion
|
|
9
|
+
export { ChatService };
|
|
10
|
+
//# sourceMappingURL=chat.service.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat.service.d.mts","names":[],"sources":["../../../src/modules/doc/chat.service.ts"],"mappings":";;;;cAMa,WAAA;EACL,IAAA,CAAK,QAAA,EAAU,SAAA,IAAa,WAAA,YAAoB,OAAA,CAAA,aAAA,CAAxB,UAAA,CAAwB,cAAA;AAAA"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { createChatEngine } from "./infrastructure/agent/engine/chat.mjs";
|
|
2
|
+
import "../../rank.service-D2h-2iJA.mjs";
|
|
3
|
+
import { getServiceDeps } from "../../shared/deps.mjs";
|
|
4
|
+
|
|
5
|
+
//#region src/modules/doc/chat.service.ts
|
|
6
|
+
var ChatService = class {
|
|
7
|
+
async chat(messages, libraryName) {
|
|
8
|
+
const userMessage = messages.pop();
|
|
9
|
+
if (!messages || !userMessage || userMessage.role !== "user") throw new Error("messages are required in the request body and the last message must be from the user");
|
|
10
|
+
if (libraryName) {
|
|
11
|
+
const { rankService } = getServiceDeps();
|
|
12
|
+
rankService.incrementDocScore(libraryName, 2);
|
|
13
|
+
}
|
|
14
|
+
const { chatEngine, retriever } = await createChatEngine(libraryName ? [libraryName] : []);
|
|
15
|
+
const userText = (userMessage.parts ?? []).map((p) => p.type === "text" ? p.text : "").join("");
|
|
16
|
+
return await chatEngine.chat({
|
|
17
|
+
message: userText,
|
|
18
|
+
chatHistory: messages.slice(-10).map((m) => ({
|
|
19
|
+
role: m.role,
|
|
20
|
+
content: (m.parts ?? []).map((p) => p.type === "text" ? p.text : "").join("") ?? ""
|
|
21
|
+
})),
|
|
22
|
+
stream: true
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
export { ChatService };
|
|
29
|
+
//# sourceMappingURL=chat.service.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat.service.mjs","names":[],"sources":["../../../src/modules/doc/chat.service.ts"],"sourcesContent":["import type { UIMessage } from 'ai'\nimport { MetadataMode } from 'llamaindex'\nimport { createChatEngine } from '@/modules/doc/infrastructure/agent/engine/chat'\nimport { getServiceDeps } from '@/shared/deps'\nimport { logger } from '@/shared/logger'\n\nexport class ChatService {\n async chat(messages: UIMessage[], libraryName?: string) {\n const userMessage = messages.pop()\n if (!messages || !userMessage || userMessage.role !== 'user') {\n throw new Error('messages are required in the request body and the last message must be from the user')\n }\n if (libraryName) {\n const { rankService } = getServiceDeps()\n rankService.incrementDocScore(libraryName, 2)\n }\n\n const ids: string[] = libraryName ? [libraryName] : []\n const { chatEngine, retriever } = await createChatEngine(ids)\n\n const userText = (userMessage.parts ?? [])\n .map(p => (p.type === 'text' ? (p as any).text : ''))\n .join('')\n // console.log('用户输入: %s', userText)\n // 打印 retriever 中间结果\n // const retrievedNodes = await retriever.retrieve(userText)\n // console.log('===== Retriever 中间结果 =====')\n // console.log(`搜索到的节点数量: ${retrievedNodes.length}`)\n // retrievedNodes.forEach((node, index) => {\n // console.log(`\\n--- 节点 ${index + 1} ---`)\n // console.log('ID:', node.node.id_)\n // console.log('分数:', node.score)\n // console.log('内容摘要:', node.node.getContent(MetadataMode.NONE).slice(0, 400) + '...')\n // })\n // console.log('=============================')\n\n const stream = await chatEngine.chat({\n message: userText,\n chatHistory: messages.slice(-10).map(m => ({\n role: m.role,\n content: (m.parts ?? [])\n .map(p => (p.type === 'text' ? (p as any).text : ''))\n .join('') ?? '',\n })),\n stream: true,\n })\n\n // 调试:打印流式响应内容\n // logger.info('===== LLM 流式响应开始 =====')\n // let chunkCount = 0\n // const originalIterator = stream[Symbol.asyncIterator]()\n // const debugStream = {\n // [Symbol.asyncIterator]() {\n // return {\n // async next() {\n // const result = await originalIterator.next()\n // chunkCount++\n // const value = result.value\n // logger.info(`Chunk ${chunkCount}: ${JSON.stringify(value)}`)\n // return result\n // }\n // }\n // }\n // }\n // return debugStream;\n return stream\n }\n}\n"],"mappings":";;;;;AAMA,IAAa,cAAb,MAAyB;CACvB,MAAM,KAAK,UAAuB,aAAsB;EACtD,MAAM,cAAc,SAAS,KAAK;AAClC,MAAI,CAAC,YAAY,CAAC,eAAe,YAAY,SAAS,OACpD,OAAM,IAAI,MAAM,uFAAuF;AAEzG,MAAI,aAAa;GACf,MAAM,EAAE,gBAAgB,gBAAgB;AACxC,eAAY,kBAAkB,aAAa,EAAE;;EAI/C,MAAM,EAAE,YAAY,cAAc,MAAM,iBADlB,cAAc,CAAC,YAAY,GAAG,EAAE,CACO;EAE7D,MAAM,YAAY,YAAY,SAAS,EAAE,EACtC,KAAI,MAAM,EAAE,SAAS,SAAU,EAAU,OAAO,GAAI,CACpD,KAAK,GAAG;AA2CX,SA7Be,MAAM,WAAW,KAAK;GACnC,SAAS;GACT,aAAa,SAAS,MAAM,IAAI,CAAC,KAAI,OAAM;IACzC,MAAM,EAAE;IACR,UAAU,EAAE,SAAS,EAAE,EACpB,KAAI,MAAM,EAAE,SAAS,SAAU,EAAU,OAAO,GAAI,CACpD,KAAK,GAAG,IAAI;IAChB,EAAE;GACH,QAAQ;GACT,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { z as z$1 } from "zod";
|
|
2
|
+
|
|
3
|
+
//#region src/modules/doc/doc.dto.d.ts
|
|
4
|
+
declare const PositiveIntOptionalSchema: z$1.ZodOptional<z$1.ZodCoercedNumber<unknown>>;
|
|
5
|
+
declare const DocSourceEnum: z$1.ZodEnum<{
|
|
6
|
+
github: "github";
|
|
7
|
+
gitee: "gitee";
|
|
8
|
+
website: "website";
|
|
9
|
+
}>;
|
|
10
|
+
declare const CreateDocSchema: z$1.ZodObject<{
|
|
11
|
+
slug: z$1.ZodString;
|
|
12
|
+
name: z$1.ZodString;
|
|
13
|
+
source: z$1.ZodEnum<{
|
|
14
|
+
github: "github";
|
|
15
|
+
gitee: "gitee";
|
|
16
|
+
website: "website";
|
|
17
|
+
}>;
|
|
18
|
+
url: z$1.ZodURL;
|
|
19
|
+
taskId: z$1.ZodOptional<z$1.ZodUUID>;
|
|
20
|
+
tokens: z$1.ZodDefault<z$1.ZodNumber>;
|
|
21
|
+
snippets: z$1.ZodDefault<z$1.ZodNumber>;
|
|
22
|
+
}, z$1.core.$strip>;
|
|
23
|
+
declare const DocAddBodySchema: z$1.ZodObject<{
|
|
24
|
+
url: z$1.ZodURL;
|
|
25
|
+
source: z$1.ZodEnum<{
|
|
26
|
+
github: "github";
|
|
27
|
+
gitee: "gitee";
|
|
28
|
+
website: "website";
|
|
29
|
+
}>;
|
|
30
|
+
}, z$1.core.$strip>;
|
|
31
|
+
declare const DocListQuerySchema: z$1.ZodObject<{
|
|
32
|
+
page: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodCoercedNumber<unknown>>>;
|
|
33
|
+
pageSize: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodCoercedNumber<unknown>>>;
|
|
34
|
+
name: z$1.ZodOptional<z$1.ZodString>;
|
|
35
|
+
source: z$1.ZodOptional<z$1.ZodEnum<{
|
|
36
|
+
github: "github";
|
|
37
|
+
gitee: "gitee";
|
|
38
|
+
website: "website";
|
|
39
|
+
}>>;
|
|
40
|
+
createdFrom: z$1.ZodOptional<z$1.ZodCoercedNumber<unknown>>;
|
|
41
|
+
createdTo: z$1.ZodOptional<z$1.ZodCoercedNumber<unknown>>;
|
|
42
|
+
updatedFrom: z$1.ZodOptional<z$1.ZodCoercedNumber<unknown>>;
|
|
43
|
+
updatedTo: z$1.ZodOptional<z$1.ZodCoercedNumber<unknown>>;
|
|
44
|
+
}, z$1.core.$strip>;
|
|
45
|
+
declare const DocSnippetsQuerySchema: z$1.ZodObject<{
|
|
46
|
+
topic: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodString>>;
|
|
47
|
+
tokens: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodCoercedNumber<unknown>>>;
|
|
48
|
+
}, z$1.core.$strip>;
|
|
49
|
+
declare const DocSearchQuerySchema: z$1.ZodObject<{
|
|
50
|
+
q: z$1.ZodString;
|
|
51
|
+
limit: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodCoercedNumber<unknown>>>;
|
|
52
|
+
}, z$1.core.$strip>;
|
|
53
|
+
type CreateDocDTO = z$1.infer<typeof CreateDocSchema>;
|
|
54
|
+
type DocAddBodyDTO = z$1.infer<typeof DocAddBodySchema>;
|
|
55
|
+
type DocListQueryDTO = z$1.infer<typeof DocListQuerySchema>;
|
|
56
|
+
type DocSearchQueryDTO = z$1.infer<typeof DocSearchQuerySchema>;
|
|
57
|
+
type DocSourceEnumDTO = z$1.infer<typeof DocSourceEnum>;
|
|
58
|
+
interface TaskDocDTO {
|
|
59
|
+
id: string;
|
|
60
|
+
slug: string;
|
|
61
|
+
name: string;
|
|
62
|
+
source: DocSourceEnumDTO;
|
|
63
|
+
url: string;
|
|
64
|
+
}
|
|
65
|
+
//#endregion
|
|
66
|
+
export { CreateDocDTO, CreateDocSchema, DocAddBodyDTO, DocAddBodySchema, DocListQueryDTO, DocListQuerySchema, DocSearchQueryDTO, DocSearchQuerySchema, DocSnippetsQuerySchema, DocSourceEnum, DocSourceEnumDTO, PositiveIntOptionalSchema, TaskDocDTO };
|
|
67
|
+
//# sourceMappingURL=doc.dto.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doc.dto.d.mts","names":[],"sources":["../../../src/modules/doc/doc.dto.ts"],"mappings":";;;cAGa,yBAAA,EAAyB,GAAA,CAAA,WAAA,CAAA,GAAA,CAAA,gBAAA;AAAA,cAEzB,aAAA,EAAa,GAAA,CAAA,OAAA;;;;;cAEb,eAAA,EAAe,GAAA,CAAA,SAAA;;;;;;;;;;;;;cAUf,gBAAA,EAAgB,GAAA,CAAA,SAAA;;;;;;;;cAKhB,kBAAA,EAAkB,GAAA,CAAA,SAAA;;;;;;;;;;;;;;cASlB,sBAAA,EAAsB,GAAA,CAAA,SAAA;;;;cAKtB,oBAAA,EAAoB,GAAA,CAAA,SAAA;;;;KAKrB,YAAA,GAAe,GAAA,CAAE,KAAA,QAAa,eAAA;AAAA,KAC9B,aAAA,GAAgB,GAAA,CAAE,KAAA,QAAa,gBAAA;AAAA,KAC/B,eAAA,GAAkB,GAAA,CAAE,KAAA,QAAa,kBAAA;AAAA,KACjC,iBAAA,GAAoB,GAAA,CAAE,KAAA,QAAa,oBAAA;AAAA,KAEnC,gBAAA,GAAmB,GAAA,CAAE,KAAA,QAAa,aAAA;AAAA,UAE7B,UAAA;EACf,EAAA;EACA,IAAA;EACA,IAAA;EACA,MAAA,EAAQ,gBAAA;EACR,GAAA;AAAA"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { paginationQuerySchema } from "../../shared/dto/index.mjs";
|
|
2
|
+
import { z as z$1 } from "zod";
|
|
3
|
+
|
|
4
|
+
//#region src/modules/doc/doc.dto.ts
|
|
5
|
+
const PositiveIntOptionalSchema = z$1.coerce.number().int().positive().optional();
|
|
6
|
+
const DocSourceEnum = z$1.enum([
|
|
7
|
+
"github",
|
|
8
|
+
"gitee",
|
|
9
|
+
"website"
|
|
10
|
+
]);
|
|
11
|
+
const CreateDocSchema = z$1.object({
|
|
12
|
+
slug: z$1.string().min(1).max(256),
|
|
13
|
+
name: z$1.string().min(1).max(256),
|
|
14
|
+
source: DocSourceEnum,
|
|
15
|
+
url: z$1.url({ message: "Invalid URL" }),
|
|
16
|
+
taskId: z$1.uuid().optional(),
|
|
17
|
+
tokens: z$1.number().int().default(0),
|
|
18
|
+
snippets: z$1.number().int().default(0)
|
|
19
|
+
});
|
|
20
|
+
const DocAddBodySchema = z$1.object({
|
|
21
|
+
url: z$1.url({ message: "Invalid URL" }),
|
|
22
|
+
source: DocSourceEnum
|
|
23
|
+
});
|
|
24
|
+
const DocListQuerySchema = paginationQuerySchema.extend({
|
|
25
|
+
name: z$1.string().optional(),
|
|
26
|
+
source: DocSourceEnum.optional(),
|
|
27
|
+
createdFrom: z$1.coerce.number().int().optional(),
|
|
28
|
+
createdTo: z$1.coerce.number().int().optional(),
|
|
29
|
+
updatedFrom: z$1.coerce.number().int().optional(),
|
|
30
|
+
updatedTo: z$1.coerce.number().int().optional()
|
|
31
|
+
});
|
|
32
|
+
const DocSnippetsQuerySchema = z$1.object({
|
|
33
|
+
topic: z$1.string().optional().default(""),
|
|
34
|
+
tokens: PositiveIntOptionalSchema.default(1e4)
|
|
35
|
+
});
|
|
36
|
+
const DocSearchQuerySchema = z$1.object({
|
|
37
|
+
q: z$1.string().min(1, "搜索关键词不能为空"),
|
|
38
|
+
limit: z$1.coerce.number().int().positive().max(10).optional().default(10)
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
//#endregion
|
|
42
|
+
export { CreateDocSchema, DocAddBodySchema, DocListQuerySchema, DocSearchQuerySchema, DocSnippetsQuerySchema, DocSourceEnum, PositiveIntOptionalSchema };
|
|
43
|
+
//# sourceMappingURL=doc.dto.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doc.dto.mjs","names":["z"],"sources":["../../../src/modules/doc/doc.dto.ts"],"sourcesContent":["import { z } from 'zod'\nimport { paginationQuerySchema } from '@/shared/dto'\n\nexport const PositiveIntOptionalSchema = z.coerce.number().int().positive().optional()\n\nexport const DocSourceEnum = z.enum(['github', 'gitee', 'website'])\n\nexport const CreateDocSchema = z.object({\n slug: z.string().min(1).max(256),\n name: z.string().min(1).max(256),\n source: DocSourceEnum,\n url: z.url({ message: 'Invalid URL' }),\n taskId: z.uuid().optional(),\n tokens: z.number().int().default(0),\n snippets: z.number().int().default(0),\n})\n\nexport const DocAddBodySchema = z.object({\n url: z.url({ message: 'Invalid URL' }),\n source: DocSourceEnum,\n})\n\nexport const DocListQuerySchema = paginationQuerySchema.extend({\n name: z.string().optional(),\n source: DocSourceEnum.optional(),\n createdFrom: z.coerce.number().int().optional(),\n createdTo: z.coerce.number().int().optional(),\n updatedFrom: z.coerce.number().int().optional(),\n updatedTo: z.coerce.number().int().optional(),\n})\n\nexport const DocSnippetsQuerySchema = z.object({\n topic: z.string().optional().default(''),\n tokens: PositiveIntOptionalSchema.default(10000),\n})\n\nexport const DocSearchQuerySchema = z.object({\n q: z.string().min(1, '搜索关键词不能为空'),\n limit: z.coerce.number().int().positive().max(10).optional().default(10),\n})\n\nexport type CreateDocDTO = z.infer<typeof CreateDocSchema>\nexport type DocAddBodyDTO = z.infer<typeof DocAddBodySchema>\nexport type DocListQueryDTO = z.infer<typeof DocListQuerySchema>\nexport type DocSearchQueryDTO = z.infer<typeof DocSearchQuerySchema>\n\nexport type DocSourceEnumDTO = z.infer<typeof DocSourceEnum>\n\nexport interface TaskDocDTO {\n id: string\n slug: string\n name: string\n source: DocSourceEnumDTO\n url: string\n}\n"],"mappings":";;;;AAGA,MAAa,4BAA4BA,IAAE,OAAO,QAAQ,CAAC,KAAK,CAAC,UAAU,CAAC,UAAU;AAEtF,MAAa,gBAAgBA,IAAE,KAAK;CAAC;CAAU;CAAS;CAAU,CAAC;AAEnE,MAAa,kBAAkBA,IAAE,OAAO;CACtC,MAAMA,IAAE,QAAQ,CAAC,IAAI,EAAE,CAAC,IAAI,IAAI;CAChC,MAAMA,IAAE,QAAQ,CAAC,IAAI,EAAE,CAAC,IAAI,IAAI;CAChC,QAAQ;CACR,KAAKA,IAAE,IAAI,EAAE,SAAS,eAAe,CAAC;CACtC,QAAQA,IAAE,MAAM,CAAC,UAAU;CAC3B,QAAQA,IAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE;CACnC,UAAUA,IAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE;CACtC,CAAC;AAEF,MAAa,mBAAmBA,IAAE,OAAO;CACvC,KAAKA,IAAE,IAAI,EAAE,SAAS,eAAe,CAAC;CACtC,QAAQ;CACT,CAAC;AAEF,MAAa,qBAAqB,sBAAsB,OAAO;CAC7D,MAAMA,IAAE,QAAQ,CAAC,UAAU;CAC3B,QAAQ,cAAc,UAAU;CAChC,aAAaA,IAAE,OAAO,QAAQ,CAAC,KAAK,CAAC,UAAU;CAC/C,WAAWA,IAAE,OAAO,QAAQ,CAAC,KAAK,CAAC,UAAU;CAC7C,aAAaA,IAAE,OAAO,QAAQ,CAAC,KAAK,CAAC,UAAU;CAC/C,WAAWA,IAAE,OAAO,QAAQ,CAAC,KAAK,CAAC,UAAU;CAC9C,CAAC;AAEF,MAAa,yBAAyBA,IAAE,OAAO;CAC7C,OAAOA,IAAE,QAAQ,CAAC,UAAU,CAAC,QAAQ,GAAG;CACxC,QAAQ,0BAA0B,QAAQ,IAAM;CACjD,CAAC;AAEF,MAAa,uBAAuBA,IAAE,OAAO;CAC3C,GAAGA,IAAE,QAAQ,CAAC,IAAI,GAAG,YAAY;CACjC,OAAOA,IAAE,OAAO,QAAQ,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,GAAG,CAAC,UAAU,CAAC,QAAQ,GAAG;CACzE,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { DocSourceEnumDTO } from "./doc.dto.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/modules/doc/doc.entity.d.ts
|
|
4
|
+
interface DocEntity<TDate> {
|
|
5
|
+
id: number;
|
|
6
|
+
slug: string;
|
|
7
|
+
name: string;
|
|
8
|
+
source: DocSourceEnumDTO;
|
|
9
|
+
url: string;
|
|
10
|
+
taskId?: string;
|
|
11
|
+
accessCount: number;
|
|
12
|
+
tokens: number;
|
|
13
|
+
snippets: number;
|
|
14
|
+
createdAt: TDate;
|
|
15
|
+
updatedAt: TDate;
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
export { DocEntity };
|
|
19
|
+
//# sourceMappingURL=doc.entity.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doc.entity.d.mts","names":[],"sources":["../../../src/modules/doc/doc.entity.ts"],"mappings":";;;UAEiB,SAAA;EACf,EAAA;EACA,IAAA;EACA,IAAA;EACA,MAAA,EAAQ,gBAAA;EACR,GAAA;EACA,MAAA;EACA,WAAA;EACA,MAAA;EACA,QAAA;EACA,SAAA,EAAW,KAAA;EACX,SAAA,EAAW,KAAA;AAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { CreateDocDTO, DocSourceEnumDTO } from "./doc.dto.mjs";
|
|
2
|
+
import { DocEntity } from "./doc.entity.mjs";
|
|
3
|
+
import { PaginationVO } from "../../shared/vo/index.mjs";
|
|
4
|
+
|
|
5
|
+
//#region src/modules/doc/doc.repo.interface.d.ts
|
|
6
|
+
interface IDocRepository {
|
|
7
|
+
list: (page: number, pageSize: number, filters?: {
|
|
8
|
+
q?: string;
|
|
9
|
+
source?: DocSourceEnumDTO;
|
|
10
|
+
createdFrom?: number;
|
|
11
|
+
createdTo?: number;
|
|
12
|
+
updatedFrom?: number;
|
|
13
|
+
updatedTo?: number;
|
|
14
|
+
}, sort?: 'popularity' | 'createdAt' | 'updatedAt') => Promise<PaginationVO<DocEntity<Date>>>;
|
|
15
|
+
listLatest: (limit: number) => Promise<DocEntity<Date>[]>;
|
|
16
|
+
listFavoritesByUser: (userId: number, page: number, pageSize: number) => Promise<PaginationVO<DocEntity<Date>>>;
|
|
17
|
+
search: (q: string, limit: number) => Promise<DocEntity<Date>[]>;
|
|
18
|
+
findById: (id: number) => Promise<DocEntity<Date> | null>;
|
|
19
|
+
findBySlug: (slug: string) => Promise<DocEntity<Date> | null>;
|
|
20
|
+
invalidateCache: (slug: string) => Promise<void>;
|
|
21
|
+
create: (input: CreateDocDTO) => Promise<DocEntity<Date>>;
|
|
22
|
+
incrementAccess: (docId: number) => Promise<void>;
|
|
23
|
+
toggleFavorite: (userId: number, docId: number, like: boolean) => Promise<boolean>;
|
|
24
|
+
isFavorite: (userId: number, docId: number) => Promise<boolean>;
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
export { IDocRepository };
|
|
28
|
+
//# sourceMappingURL=doc.repo.interface.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doc.repo.interface.d.mts","names":[],"sources":["../../../src/modules/doc/doc.repo.interface.ts"],"mappings":";;;;;UAIiB,cAAA;EACf,IAAA,GAAO,IAAA,UAAc,QAAA,UAAkB,OAAA;IAAY,CAAA;IAAY,MAAA,GAAS,gBAAA;IAAkB,WAAA;IAAsB,SAAA;IAAoB,WAAA;IAAsB,SAAA;EAAA,GAAsB,IAAA,gDAAoD,OAAA,CAAQ,YAAA,CAAa,SAAA,CAAU,IAAA;EACnQ,UAAA,GAAa,KAAA,aAAkB,OAAA,CAAQ,SAAA,CAAU,IAAA;EACjD,mBAAA,GAAsB,MAAA,UAAgB,IAAA,UAAc,QAAA,aAAqB,OAAA,CAAQ,YAAA,CAAa,SAAA,CAAU,IAAA;EACxG,MAAA,GAAS,CAAA,UAAW,KAAA,aAAkB,OAAA,CAAQ,SAAA,CAAU,IAAA;EACxD,QAAA,GAAW,EAAA,aAAe,OAAA,CAAQ,SAAA,CAAU,IAAA;EAC5C,UAAA,GAAa,IAAA,aAAiB,OAAA,CAAQ,SAAA,CAAU,IAAA;EAChD,eAAA,GAAkB,IAAA,aAAiB,OAAA;EACnC,MAAA,GAAS,KAAA,EAAO,YAAA,KAAiB,OAAA,CAAQ,SAAA,CAAU,IAAA;EACnD,eAAA,GAAkB,KAAA,aAAkB,OAAA;EACpC,cAAA,GAAiB,MAAA,UAAgB,KAAA,UAAe,IAAA,cAAkB,OAAA;EAClE,UAAA,GAAa,MAAA,UAAgB,KAAA,aAAkB,OAAA;AAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|