@hed-hog/core 0.0.387 → 0.0.390
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 +12 -11
- package/dist/access-log/access-log.interceptor.d.ts.map +1 -1
- package/dist/access-log/access-log.interceptor.js +4 -2
- package/dist/access-log/access-log.interceptor.js.map +1 -1
- package/dist/ai/ai-attachment.fragments.d.ts +23 -0
- package/dist/ai/ai-attachment.fragments.d.ts.map +1 -0
- package/dist/ai/ai-attachment.fragments.js +34 -0
- package/dist/ai/ai-attachment.fragments.js.map +1 -0
- package/dist/ai/ai.controller.d.ts +7 -16
- package/dist/ai/ai.controller.d.ts.map +1 -1
- package/dist/ai/ai.prompts.d.ts +16 -0
- package/dist/ai/ai.prompts.d.ts.map +1 -0
- package/dist/ai/ai.prompts.js +37 -0
- package/dist/ai/ai.prompts.js.map +1 -0
- package/dist/ai/ai.service.d.ts +63 -12
- package/dist/ai/ai.service.d.ts.map +1 -1
- package/dist/ai/ai.service.js +215 -88
- package/dist/ai/ai.service.js.map +1 -1
- package/dist/ai/dto/chat.dto.d.ts +4 -1
- package/dist/ai/dto/chat.dto.d.ts.map +1 -1
- package/dist/ai/dto/chat.dto.js +23 -1
- package/dist/ai/dto/chat.dto.js.map +1 -1
- package/dist/ai/dto/create-agent.dto.d.ts +1 -1
- package/dist/ai/dto/create-agent.dto.d.ts.map +1 -1
- package/dist/ai/dto/create-agent.dto.js +1 -1
- package/dist/ai/dto/create-agent.dto.js.map +1 -1
- package/dist/ai/dto/update-agent.dto.d.ts +1 -1
- package/dist/ai/dto/update-agent.dto.d.ts.map +1 -1
- package/dist/ai/dto/update-agent.dto.js +1 -1
- package/dist/ai/dto/update-agent.dto.js.map +1 -1
- package/dist/ai-instruction/ai-instruction.controller.d.ts +61 -7
- package/dist/ai-instruction/ai-instruction.controller.d.ts.map +1 -1
- package/dist/ai-instruction/ai-instruction.controller.js +63 -20
- package/dist/ai-instruction/ai-instruction.controller.js.map +1 -1
- package/dist/ai-instruction/ai-instruction.module.d.ts.map +1 -1
- package/dist/ai-instruction/ai-instruction.module.js +13 -2
- package/dist/ai-instruction/ai-instruction.module.js.map +1 -1
- package/dist/ai-instruction/ai-instruction.service.d.ts +131 -6
- package/dist/ai-instruction/ai-instruction.service.d.ts.map +1 -1
- package/dist/ai-instruction/ai-instruction.service.js +533 -60
- package/dist/ai-instruction/ai-instruction.service.js.map +1 -1
- package/dist/ai-instruction/ai-prompt-builder.service.d.ts +8 -0
- package/dist/ai-instruction/ai-prompt-builder.service.d.ts.map +1 -1
- package/dist/ai-instruction/ai-prompt-builder.service.js +10 -1
- package/dist/ai-instruction/ai-prompt-builder.service.js.map +1 -1
- package/dist/ai-instruction/ai-prompt-registry.d.ts +45 -0
- package/dist/ai-instruction/ai-prompt-registry.d.ts.map +1 -0
- package/dist/ai-instruction/ai-prompt-registry.js +49 -0
- package/dist/ai-instruction/ai-prompt-registry.js.map +1 -0
- package/dist/ai-instruction/ai-prompt-resolver.service.d.ts +89 -0
- package/dist/ai-instruction/ai-prompt-resolver.service.d.ts.map +1 -0
- package/dist/ai-instruction/ai-prompt-resolver.service.js +222 -0
- package/dist/ai-instruction/ai-prompt-resolver.service.js.map +1 -0
- package/dist/ai-instruction/ai-prompt-template.util.d.ts +70 -0
- package/dist/ai-instruction/ai-prompt-template.util.d.ts.map +1 -0
- package/dist/ai-instruction/ai-prompt-template.util.js +154 -0
- package/dist/ai-instruction/ai-prompt-template.util.js.map +1 -0
- package/dist/ai-instruction/dto/create-ai-instruction.dto.d.ts +5 -0
- package/dist/ai-instruction/dto/create-ai-instruction.dto.d.ts.map +1 -1
- package/dist/ai-instruction/dto/create-ai-instruction.dto.js +27 -1
- package/dist/ai-instruction/dto/create-ai-instruction.dto.js.map +1 -1
- package/dist/ai-instruction/dto/preview-ai-instruction.dto.d.ts +14 -0
- package/dist/ai-instruction/dto/preview-ai-instruction.dto.d.ts.map +1 -0
- package/dist/ai-instruction/dto/preview-ai-instruction.dto.js +42 -0
- package/dist/ai-instruction/dto/preview-ai-instruction.dto.js.map +1 -0
- package/dist/ai-instruction/dto/update-ai-instruction.dto.d.ts +11 -0
- package/dist/ai-instruction/dto/update-ai-instruction.dto.d.ts.map +1 -1
- package/dist/ai-instruction/dto/update-ai-instruction.dto.js +34 -0
- package/dist/ai-instruction/dto/update-ai-instruction.dto.js.map +1 -1
- package/dist/ai-instruction/types/ai-instruction.types.d.ts +13 -1
- package/dist/ai-instruction/types/ai-instruction.types.d.ts.map +1 -1
- package/dist/ai-instruction/types/ai-instruction.types.js +10 -0
- package/dist/ai-instruction/types/ai-instruction.types.js.map +1 -1
- package/dist/auth/auth.controller.d.ts +24 -9
- package/dist/auth/auth.controller.d.ts.map +1 -1
- package/dist/auth/auth.controller.js +49 -21
- package/dist/auth/auth.controller.js.map +1 -1
- package/dist/auth/auth.service.d.ts +33 -8
- package/dist/auth/auth.service.d.ts.map +1 -1
- package/dist/auth/auth.service.js +78 -29
- package/dist/auth/auth.service.js.map +1 -1
- package/dist/captcha/captcha.module.d.ts +3 -0
- package/dist/captcha/captcha.module.d.ts.map +1 -0
- package/dist/captcha/captcha.module.js +23 -0
- package/dist/captcha/captcha.module.js.map +1 -0
- package/dist/captcha/captcha.service.d.ts +38 -0
- package/dist/captcha/captcha.service.d.ts.map +1 -0
- package/dist/captcha/captcha.service.js +144 -0
- package/dist/captcha/captcha.service.js.map +1 -0
- package/dist/challenge/challenge.service.d.ts +16 -7
- package/dist/challenge/challenge.service.d.ts.map +1 -1
- package/dist/challenge/challenge.service.js +64 -16
- package/dist/challenge/challenge.service.js.map +1 -1
- package/dist/core.module.d.ts +3 -1
- package/dist/core.module.d.ts.map +1 -1
- package/dist/core.module.js +29 -2
- package/dist/core.module.js.map +1 -1
- package/dist/dashboard/dashboard/dashboard.controller.d.ts +15 -15
- package/dist/dashboard/dashboard/dashboard.service.d.ts +15 -15
- package/dist/dashboard/dashboard-component/dashboard-component.controller.d.ts +6 -6
- package/dist/dashboard/dashboard-component/dashboard-component.service.d.ts +6 -6
- package/dist/dashboard/dashboard-component-role/dashboard-component-role.controller.d.ts +20 -20
- package/dist/dashboard/dashboard-component-role/dashboard-component-role.service.d.ts +20 -20
- package/dist/dashboard/dashboard-core/dashboard-core.controller.d.ts +1 -1
- package/dist/dashboard/dashboard-core/dashboard-core.service.d.ts +1 -1
- package/dist/dashboard/dashboard-role/dashboard-role.controller.d.ts +13 -13
- package/dist/dashboard/dashboard-role/dashboard-role.service.d.ts +13 -13
- package/dist/file/file.service.d.ts +6 -0
- package/dist/file/file.service.d.ts.map +1 -1
- package/dist/file/file.service.js +44 -4
- package/dist/file/file.service.js.map +1 -1
- package/dist/incident/incident-notifier.service.d.ts +36 -0
- package/dist/incident/incident-notifier.service.d.ts.map +1 -0
- package/dist/incident/incident-notifier.service.js +208 -0
- package/dist/incident/incident-notifier.service.js.map +1 -0
- package/dist/incident/incident.controller.d.ts +23 -0
- package/dist/incident/incident.controller.d.ts.map +1 -0
- package/dist/incident/incident.controller.js +75 -0
- package/dist/incident/incident.controller.js.map +1 -0
- package/dist/incident/incident.module.d.ts +7 -0
- package/dist/incident/incident.module.d.ts.map +1 -0
- package/dist/incident/incident.module.js +32 -0
- package/dist/incident/incident.module.js.map +1 -0
- package/dist/incident/incident.service.d.ts +72 -0
- package/dist/incident/incident.service.d.ts.map +1 -0
- package/dist/incident/incident.service.js +184 -0
- package/dist/incident/incident.service.js.map +1 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +30 -0
- package/dist/index.js.map +1 -1
- package/dist/integration-profile/dto/test.dto.d.ts +13 -0
- package/dist/integration-profile/dto/test.dto.d.ts.map +1 -0
- package/dist/integration-profile/dto/test.dto.js +26 -0
- package/dist/integration-profile/dto/test.dto.js.map +1 -0
- package/dist/integration-profile/integration-profile.controller.d.ts +12 -1
- package/dist/integration-profile/integration-profile.controller.d.ts.map +1 -1
- package/dist/integration-profile/integration-profile.controller.js +9 -1
- package/dist/integration-profile/integration-profile.controller.js.map +1 -1
- package/dist/integration-profile/integration-profile.module.d.ts +6 -1
- package/dist/integration-profile/integration-profile.module.d.ts.map +1 -1
- package/dist/integration-profile/integration-profile.module.js +26 -3
- package/dist/integration-profile/integration-profile.module.js.map +1 -1
- package/dist/integration-profile/integration-profile.secrets.d.ts.map +1 -1
- package/dist/integration-profile/integration-profile.secrets.js +9 -1
- package/dist/integration-profile/integration-profile.secrets.js.map +1 -1
- package/dist/integration-profile/integration-profile.service.d.ts +26 -7
- package/dist/integration-profile/integration-profile.service.d.ts.map +1 -1
- package/dist/integration-profile/integration-profile.service.js +94 -91
- package/dist/integration-profile/integration-profile.service.js.map +1 -1
- package/dist/integration-profile/integration-profile.utils.d.ts +13 -1
- package/dist/integration-profile/integration-profile.utils.d.ts.map +1 -1
- package/dist/integration-profile/integration-profile.utils.js +20 -5
- package/dist/integration-profile/integration-profile.utils.js.map +1 -1
- package/dist/integration-profile/testers/ai.testers.d.ts +3 -0
- package/dist/integration-profile/testers/ai.testers.d.ts.map +1 -0
- package/dist/integration-profile/testers/ai.testers.js +125 -0
- package/dist/integration-profile/testers/ai.testers.js.map +1 -0
- package/dist/integration-profile/testers/captcha.testers.d.ts +3 -0
- package/dist/integration-profile/testers/captcha.testers.d.ts.map +1 -0
- package/dist/integration-profile/testers/captcha.testers.js +121 -0
- package/dist/integration-profile/testers/captcha.testers.js.map +1 -0
- package/dist/integration-profile/testers/email.testers.d.ts +3 -0
- package/dist/integration-profile/testers/email.testers.d.ts.map +1 -0
- package/dist/integration-profile/testers/email.testers.js +128 -0
- package/dist/integration-profile/testers/email.testers.js.map +1 -0
- package/dist/integration-profile/testers/http-probe.d.ts +57 -0
- package/dist/integration-profile/testers/http-probe.d.ts.map +1 -0
- package/dist/integration-profile/testers/http-probe.js +140 -0
- package/dist/integration-profile/testers/http-probe.js.map +1 -0
- package/dist/integration-profile/testers/index.d.ts +12 -0
- package/dist/integration-profile/testers/index.d.ts.map +1 -0
- package/dist/integration-profile/testers/index.js +45 -0
- package/dist/integration-profile/testers/index.js.map +1 -0
- package/dist/integration-profile/testers/infrastructure.testers.d.ts +3 -0
- package/dist/integration-profile/testers/infrastructure.testers.d.ts.map +1 -0
- package/dist/integration-profile/testers/infrastructure.testers.js +105 -0
- package/dist/integration-profile/testers/infrastructure.testers.js.map +1 -0
- package/dist/integration-profile/testers/integration-tester.registry.d.ts +17 -0
- package/dist/integration-profile/testers/integration-tester.registry.d.ts.map +1 -0
- package/dist/integration-profile/testers/integration-tester.registry.js +52 -0
- package/dist/integration-profile/testers/integration-tester.registry.js.map +1 -0
- package/dist/integration-profile/testers/integration-tester.types.d.ts +55 -0
- package/dist/integration-profile/testers/integration-tester.types.d.ts.map +1 -0
- package/dist/integration-profile/testers/integration-tester.types.js +16 -0
- package/dist/integration-profile/testers/integration-tester.types.js.map +1 -0
- package/dist/integration-profile/testers/messaging.testers.d.ts +3 -0
- package/dist/integration-profile/testers/messaging.testers.d.ts.map +1 -0
- package/dist/integration-profile/testers/messaging.testers.js +70 -0
- package/dist/integration-profile/testers/messaging.testers.js.map +1 -0
- package/dist/integration-profile/testers/oauth.testers.d.ts +3 -0
- package/dist/integration-profile/testers/oauth.testers.d.ts.map +1 -0
- package/dist/integration-profile/testers/oauth.testers.js +285 -0
- package/dist/integration-profile/testers/oauth.testers.js.map +1 -0
- package/dist/integration-profile/testers/payment.testers.d.ts +3 -0
- package/dist/integration-profile/testers/payment.testers.d.ts.map +1 -0
- package/dist/integration-profile/testers/payment.testers.js +169 -0
- package/dist/integration-profile/testers/payment.testers.js.map +1 -0
- package/dist/integration-profile/testers/storage.testers.d.ts +3 -0
- package/dist/integration-profile/testers/storage.testers.d.ts.map +1 -0
- package/dist/integration-profile/testers/storage.testers.js +208 -0
- package/dist/integration-profile/testers/storage.testers.js.map +1 -0
- package/dist/language/en.json +4 -2
- package/dist/language/pt.json +4 -2
- package/dist/leaked-password/leaked-password.controller.d.ts +24 -0
- package/dist/leaked-password/leaked-password.controller.d.ts.map +1 -0
- package/dist/leaked-password/leaked-password.controller.js +78 -0
- package/dist/leaked-password/leaked-password.controller.js.map +1 -0
- package/dist/leaked-password/leaked-password.module.d.ts +8 -0
- package/dist/leaked-password/leaked-password.module.d.ts.map +1 -0
- package/dist/leaked-password/leaked-password.module.js +31 -0
- package/dist/leaked-password/leaked-password.module.js.map +1 -0
- package/dist/leaked-password/leaked-password.service.d.ts +64 -0
- package/dist/leaked-password/leaked-password.service.d.ts.map +1 -0
- package/dist/leaked-password/leaked-password.service.js +218 -0
- package/dist/leaked-password/leaked-password.service.js.map +1 -0
- package/dist/locale/locale.controller.d.ts +1 -1
- package/dist/locale/locale.service.d.ts +1 -1
- package/dist/mail/dto/preview.dto.d.ts +18 -0
- package/dist/mail/dto/preview.dto.d.ts.map +1 -0
- package/dist/mail/dto/preview.dto.js +66 -0
- package/dist/mail/dto/preview.dto.js.map +1 -0
- package/dist/mail/dto/send.dto.d.ts +7 -0
- package/dist/mail/dto/send.dto.d.ts.map +1 -1
- package/dist/mail/dto/send.dto.js +10 -0
- package/dist/mail/dto/send.dto.js.map +1 -1
- package/dist/mail/mail.controller.d.ts +4 -0
- package/dist/mail/mail.controller.d.ts.map +1 -1
- package/dist/mail/mail.controller.js +16 -2
- package/dist/mail/mail.controller.js.map +1 -1
- package/dist/mail/mail.service.d.ts +23 -2
- package/dist/mail/mail.service.d.ts.map +1 -1
- package/dist/mail/mail.service.js +102 -13
- package/dist/mail/mail.service.js.map +1 -1
- package/dist/mail-layout/dto/update.dto.d.ts +17 -0
- package/dist/mail-layout/dto/update.dto.d.ts.map +1 -0
- package/dist/mail-layout/dto/update.dto.js +27 -0
- package/dist/mail-layout/dto/update.dto.js.map +1 -0
- package/dist/mail-layout/mail-layout.controller.d.ts +15 -0
- package/dist/mail-layout/mail-layout.controller.d.ts.map +1 -0
- package/dist/mail-layout/mail-layout.controller.js +71 -0
- package/dist/mail-layout/mail-layout.controller.js.map +1 -0
- package/dist/mail-layout/mail-layout.module.d.ts +3 -0
- package/dist/mail-layout/mail-layout.module.d.ts.map +1 -0
- package/dist/mail-layout/mail-layout.module.js +35 -0
- package/dist/mail-layout/mail-layout.module.js.map +1 -0
- package/dist/mail-layout/mail-layout.service.d.ts +27 -0
- package/dist/mail-layout/mail-layout.service.d.ts.map +1 -0
- package/dist/mail-layout/mail-layout.service.js +80 -0
- package/dist/mail-layout/mail-layout.service.js.map +1 -0
- package/dist/mcp-chat/mcp-chat.controller.d.ts +2 -2
- package/dist/mcp-chat/mcp-chat.service.d.ts +24 -2
- package/dist/mcp-chat/mcp-chat.service.d.ts.map +1 -1
- package/dist/mcp-chat/mcp-chat.service.js +80 -24
- package/dist/mcp-chat/mcp-chat.service.js.map +1 -1
- package/dist/menu/menu.controller.d.ts +3 -3
- package/dist/menu/menu.service.d.ts +3 -3
- package/dist/notification/notification.controller.d.ts +12 -12
- package/dist/notification/notification.service.d.ts +12 -12
- package/dist/oauth/oauth-token-broker.service.d.ts +72 -0
- package/dist/oauth/oauth-token-broker.service.d.ts.map +1 -0
- package/dist/oauth/oauth-token-broker.service.js +258 -0
- package/dist/oauth/oauth-token-broker.service.js.map +1 -0
- package/dist/oauth/oauth.module.d.ts.map +1 -1
- package/dist/oauth/oauth.module.js +3 -1
- package/dist/oauth/oauth.module.js.map +1 -1
- package/dist/oauth/oauth.service.d.ts +2 -0
- package/dist/oauth/oauth.service.d.ts.map +1 -1
- package/dist/oauth/oauth.service.js +6 -3
- package/dist/oauth/oauth.service.js.map +1 -1
- package/dist/pdf/pdf.service.d.ts +8 -0
- package/dist/pdf/pdf.service.d.ts.map +1 -1
- package/dist/pdf/pdf.service.js +52 -0
- package/dist/pdf/pdf.service.js.map +1 -1
- package/dist/presence/presence.controller.d.ts +16 -0
- package/dist/presence/presence.controller.d.ts.map +1 -0
- package/dist/presence/presence.controller.js +60 -0
- package/dist/presence/presence.controller.js.map +1 -0
- package/dist/presence/presence.listener.d.ts +29 -0
- package/dist/presence/presence.listener.d.ts.map +1 -0
- package/dist/presence/presence.listener.js +82 -0
- package/dist/presence/presence.listener.js.map +1 -0
- package/dist/presence/presence.module.d.ts +3 -0
- package/dist/presence/presence.module.d.ts.map +1 -0
- package/dist/presence/presence.module.js +32 -0
- package/dist/presence/presence.module.js.map +1 -0
- package/dist/presence/presence.service.d.ts +42 -0
- package/dist/presence/presence.service.d.ts.map +1 -0
- package/dist/presence/presence.service.js +147 -0
- package/dist/presence/presence.service.js.map +1 -0
- package/dist/profile/dto/delete-account.dto.d.ts +8 -0
- package/dist/profile/dto/delete-account.dto.d.ts.map +1 -0
- package/dist/profile/dto/delete-account.dto.js +22 -0
- package/dist/profile/dto/delete-account.dto.js.map +1 -0
- package/dist/profile/events/profile-account-deleted.event.d.ts +12 -0
- package/dist/profile/events/profile-account-deleted.event.d.ts.map +1 -0
- package/dist/profile/events/profile-account-deleted.event.js +17 -0
- package/dist/profile/events/profile-account-deleted.event.js.map +1 -0
- package/dist/profile/profile.controller.d.ts +21 -15
- package/dist/profile/profile.controller.d.ts.map +1 -1
- package/dist/profile/profile.controller.js +75 -46
- package/dist/profile/profile.controller.js.map +1 -1
- package/dist/profile/profile.service.d.ts +30 -18
- package/dist/profile/profile.service.d.ts.map +1 -1
- package/dist/profile/profile.service.js +113 -37
- package/dist/profile/profile.service.js.map +1 -1
- package/dist/realtime/realtime.gateway.d.ts +48 -0
- package/dist/realtime/realtime.gateway.d.ts.map +1 -0
- package/dist/realtime/realtime.gateway.js +156 -0
- package/dist/realtime/realtime.gateway.js.map +1 -0
- package/dist/realtime/realtime.module.d.ts +8 -0
- package/dist/realtime/realtime.module.d.ts.map +1 -0
- package/dist/realtime/realtime.module.js +29 -0
- package/dist/realtime/realtime.module.js.map +1 -0
- package/dist/realtime/realtime.service.d.ts +51 -0
- package/dist/realtime/realtime.service.d.ts.map +1 -0
- package/dist/realtime/realtime.service.js +177 -0
- package/dist/realtime/realtime.service.js.map +1 -0
- package/dist/redis/redis-pubsub.d.ts +27 -0
- package/dist/redis/redis-pubsub.d.ts.map +1 -0
- package/dist/redis/redis-pubsub.js +140 -0
- package/dist/redis/redis-pubsub.js.map +1 -0
- package/dist/role/role.controller.d.ts +3 -3
- package/dist/role/role.service.d.ts +3 -3
- package/dist/setting/dto/create.dto.d.ts.map +1 -1
- package/dist/setting/dto/create.dto.js +9 -2
- package/dist/setting/dto/create.dto.js.map +1 -1
- package/dist/setting/setting.controller.d.ts +5 -5
- package/dist/setting/setting.service.d.ts +8 -5
- package/dist/setting/setting.service.d.ts.map +1 -1
- package/dist/setting/setting.service.js +25 -1
- package/dist/setting/setting.service.js.map +1 -1
- package/dist/user/dto/create-with-email-and-password.dto.d.ts +2 -0
- package/dist/user/dto/create-with-email-and-password.dto.d.ts.map +1 -1
- package/dist/user/dto/create-with-email-and-password.dto.js +5 -0
- package/dist/user/dto/create-with-email-and-password.dto.js.map +1 -1
- package/dist/user/dto/query-user-mail-list.dto.d.ts +5 -0
- package/dist/user/dto/query-user-mail-list.dto.d.ts.map +1 -0
- package/dist/user/dto/query-user-mail-list.dto.js +25 -0
- package/dist/user/dto/query-user-mail-list.dto.js.map +1 -0
- package/dist/user/user-credential.util.d.ts +19 -0
- package/dist/user/user-credential.util.d.ts.map +1 -0
- package/dist/user/user-credential.util.js +32 -0
- package/dist/user/user-credential.util.js.map +1 -0
- package/dist/user/user.controller.d.ts +17 -5
- package/dist/user/user.controller.d.ts.map +1 -1
- package/dist/user/user.controller.js +18 -3
- package/dist/user/user.controller.js.map +1 -1
- package/dist/user/user.service.d.ts +28 -6
- package/dist/user/user.service.d.ts.map +1 -1
- package/dist/user/user.service.js +204 -13
- package/dist/user/user.service.js.map +1 -1
- package/dist/validators/is-strong-password-with-settings.validator.d.ts.map +1 -1
- package/dist/validators/is-strong-password-with-settings.validator.js +11 -0
- package/dist/validators/is-strong-password-with-settings.validator.js.map +1 -1
- package/dist/validators/service-locator.d.ts +9 -0
- package/dist/validators/service-locator.d.ts.map +1 -1
- package/dist/validators/service-locator.js +12 -0
- package/dist/validators/service-locator.js.map +1 -1
- package/dist/whatsapp-sender/whatsapp-sender.module.d.ts +3 -0
- package/dist/whatsapp-sender/whatsapp-sender.module.d.ts.map +1 -0
- package/dist/whatsapp-sender/whatsapp-sender.module.js +23 -0
- package/dist/whatsapp-sender/whatsapp-sender.module.js.map +1 -0
- package/dist/whatsapp-sender/whatsapp-sender.service.d.ts +50 -0
- package/dist/whatsapp-sender/whatsapp-sender.service.d.ts.map +1 -0
- package/dist/whatsapp-sender/whatsapp-sender.service.js +224 -0
- package/dist/whatsapp-sender/whatsapp-sender.service.js.map +1 -0
- package/hedhog/data/integration_provider.yaml +16 -0
- package/hedhog/data/mail.yaml +88 -61
- package/hedhog/data/mail_layout.yaml +188 -0
- package/hedhog/data/menu.yaml +67 -3
- package/hedhog/data/route.yaml +135 -0
- package/hedhog/data/setting_group.yaml +139 -1
- package/hedhog/frontend/app/account/components/mfa-setup-dialog.tsx.ejs +36 -0
- package/hedhog/frontend/app/account/components/two-factor-auth.tsx.ejs +2 -0
- package/hedhog/frontend/app/account/hooks/use-mfa-setup.ts.ejs +10 -7
- package/hedhog/frontend/app/ai_agent/page.tsx.ejs +7 -4
- package/hedhog/frontend/app/ai_instruction/_components/ai-instruction-form.tsx.ejs +580 -0
- package/hedhog/frontend/app/ai_instruction/_components/ai-instruction-preview.tsx.ejs +150 -0
- package/hedhog/frontend/app/ai_instruction/_components/ai-instruction-versions.tsx.ejs +199 -0
- package/hedhog/frontend/app/ai_instruction/_components/prompt-diff.tsx.ejs +63 -0
- package/hedhog/frontend/app/ai_instruction/_lib/line-diff.spec.ts.ejs +59 -0
- package/hedhog/frontend/app/ai_instruction/_lib/line-diff.ts.ejs +72 -0
- package/hedhog/frontend/app/ai_instruction/_lib/prompt-template.spec.ts.ejs +170 -0
- package/hedhog/frontend/app/ai_instruction/_lib/prompt-template.ts.ejs +167 -0
- package/hedhog/frontend/app/ai_instruction/_lib/types.ts.ejs +99 -0
- package/hedhog/frontend/app/ai_instruction/page.tsx.ejs +422 -0
- package/hedhog/frontend/app/configurations/[slug]/components/setting-field.tsx.ejs +51 -4
- package/hedhog/frontend/app/incidents/page.tsx.ejs +400 -0
- package/hedhog/frontend/app/integration/profiles/page.tsx.ejs +153 -84
- package/hedhog/frontend/app/mail/layout/page.tsx.ejs +344 -0
- package/hedhog/frontend/app/mail/template/page.tsx.ejs +155 -121
- package/hedhog/frontend/app/mcp_chat/page.tsx.ejs +129 -17
- package/hedhog/frontend/app/pages/_components/page-delete-dialog.tsx.ejs +343 -0
- package/hedhog/frontend/app/pages/_components/page-detail-sheet.tsx.ejs +438 -0
- package/hedhog/frontend/app/pages/_components/page-wizard-sheet.tsx.ejs +1009 -0
- package/hedhog/frontend/app/pages/_components/system-page-types.ts.ejs +56 -0
- package/hedhog/frontend/app/pages/_components/use-system-pages.ts.ejs +171 -0
- package/hedhog/frontend/app/pages/page.tsx.ejs +514 -0
- package/hedhog/frontend/app/users/page.tsx.ejs +119 -13
- package/hedhog/frontend/app/users/user-activity-timeline.tsx.ejs +231 -0
- package/hedhog/frontend/app/users/user-mails.tsx.ejs +399 -0
- package/hedhog/frontend/app/users/user-sheet.tsx.ejs +60 -75
- package/hedhog/frontend/messages/en.json +499 -3
- package/hedhog/frontend/messages/pt.json +499 -3
- package/hedhog/table/ai_agent.yaml +1 -0
- package/hedhog/table/ai_instruction.yaml +15 -0
- package/hedhog/table/leaked_password.yaml +18 -0
- package/hedhog/table/mail_layout.yaml +35 -0
- package/hedhog/table/mail_var.yaml +4 -0
- package/hedhog/table/setting.yaml +1 -0
- package/hedhog/table/system_incident.yaml +59 -0
- package/hedhog/table/user_presence.yaml +36 -0
- package/package.json +8 -4
- package/src/access-log/access-log.interceptor.ts +4 -2
- package/src/ai/ai-attachment.fragments.spec.ts +319 -0
- package/src/ai/ai-attachment.fragments.ts +35 -0
- package/src/ai/ai.prompts.ts +38 -0
- package/src/ai/ai.service.spec.ts +280 -0
- package/src/ai/ai.service.ts +338 -82
- package/src/ai/dto/chat.dto.ts +33 -3
- package/src/ai/dto/create-agent.dto.ts +2 -2
- package/src/ai/dto/update-agent.dto.ts +2 -2
- package/src/ai-instruction/ai-instruction.controller.ts +40 -9
- package/src/ai-instruction/ai-instruction.module.ts +13 -2
- package/src/ai-instruction/ai-instruction.service.spec.ts +658 -0
- package/src/ai-instruction/ai-instruction.service.ts +661 -62
- package/src/ai-instruction/ai-prompt-builder.service.ts +10 -1
- package/src/ai-instruction/ai-prompt-registry.ts +87 -0
- package/src/ai-instruction/ai-prompt-resolver.service.spec.ts +375 -0
- package/src/ai-instruction/ai-prompt-resolver.service.ts +295 -0
- package/src/ai-instruction/ai-prompt-template.util.spec.ts +162 -0
- package/src/ai-instruction/ai-prompt-template.util.ts +199 -0
- package/src/ai-instruction/dto/create-ai-instruction.dto.ts +39 -3
- package/src/ai-instruction/dto/preview-ai-instruction.dto.ts +26 -0
- package/src/ai-instruction/dto/update-ai-instruction.dto.ts +42 -1
- package/src/ai-instruction/types/ai-instruction.types.ts +24 -1
- package/src/auth/auth.controller.ts +31 -5
- package/src/auth/auth.service.spec.ts +3 -1
- package/src/auth/auth.service.ts +101 -36
- package/src/captcha/captcha.module.ts +10 -0
- package/src/captcha/captcha.service.spec.ts +210 -0
- package/src/captcha/captcha.service.ts +191 -0
- package/src/challenge/challenge.service.spec.ts +39 -4
- package/src/challenge/challenge.service.ts +72 -17
- package/src/core.module.ts +27 -1
- package/src/file/file.service.spec.ts +105 -0
- package/src/file/file.service.ts +60 -3
- package/src/incident/incident-notifier.service.spec.ts +205 -0
- package/src/incident/incident-notifier.service.ts +241 -0
- package/src/incident/incident.controller.ts +38 -0
- package/src/incident/incident.module.ts +19 -0
- package/src/incident/incident.service.spec.ts +150 -0
- package/src/incident/incident.service.ts +209 -0
- package/src/index.ts +37 -0
- package/src/integration-profile/dto/test.dto.ts +19 -0
- package/src/integration-profile/integration-profile.controller.ts +10 -1
- package/src/integration-profile/integration-profile.module.spec.ts +51 -0
- package/src/integration-profile/integration-profile.module.ts +23 -4
- package/src/integration-profile/integration-profile.secrets.ts +9 -1
- package/src/integration-profile/integration-profile.service.spec.ts +279 -0
- package/src/integration-profile/integration-profile.service.ts +120 -124
- package/src/integration-profile/integration-profile.utils.spec.ts +22 -0
- package/src/integration-profile/integration-profile.utils.ts +40 -3
- package/src/integration-profile/testers/ai.testers.ts +165 -0
- package/src/integration-profile/testers/captcha.testers.spec.ts +92 -0
- package/src/integration-profile/testers/captcha.testers.ts +139 -0
- package/src/integration-profile/testers/email.testers.ts +161 -0
- package/src/integration-profile/testers/http-probe.spec.ts +153 -0
- package/src/integration-profile/testers/http-probe.ts +171 -0
- package/src/integration-profile/testers/index.ts +30 -0
- package/src/integration-profile/testers/infrastructure.testers.ts +122 -0
- package/src/integration-profile/testers/integration-tester.registry.spec.ts +75 -0
- package/src/integration-profile/testers/integration-tester.registry.ts +43 -0
- package/src/integration-profile/testers/integration-tester.types.ts +61 -0
- package/src/integration-profile/testers/messaging.testers.ts +102 -0
- package/src/integration-profile/testers/oauth.testers.spec.ts +220 -0
- package/src/integration-profile/testers/oauth.testers.ts +305 -0
- package/src/integration-profile/testers/payment.testers.ts +185 -0
- package/src/integration-profile/testers/remaining.testers.spec.ts +401 -0
- package/src/integration-profile/testers/storage.testers.spec.ts +185 -0
- package/src/integration-profile/testers/storage.testers.ts +226 -0
- package/src/integration-profile/testers/tester-coverage.spec.ts +58 -0
- package/src/language/en.json +4 -2
- package/src/language/pt.json +4 -2
- package/src/leaked-password/README.md +83 -0
- package/src/leaked-password/leaked-password.controller.ts +52 -0
- package/src/leaked-password/leaked-password.module.ts +18 -0
- package/src/leaked-password/leaked-password.service.ts +242 -0
- package/src/leaked-password/seed/build-seed-sql.mjs +180 -0
- package/src/leaked-password/seed/common-passwords.txt +335 -0
- package/src/mail/dto/preview.dto.ts +50 -0
- package/src/mail/dto/send.dto.ts +14 -1
- package/src/mail/mail-template.spec.ts +197 -0
- package/src/mail/mail.controller.ts +9 -2
- package/src/mail/mail.service.spec.ts +116 -1
- package/src/mail/mail.service.ts +118 -12
- package/src/mail-layout/dto/update.dto.ts +19 -0
- package/src/mail-layout/mail-layout.controller.ts +47 -0
- package/src/mail-layout/mail-layout.module.ts +22 -0
- package/src/mail-layout/mail-layout.service.ts +94 -0
- package/src/mcp-chat/mcp-chat.service.spec.ts +236 -0
- package/src/mcp-chat/mcp-chat.service.ts +122 -26
- package/src/oauth/oauth-token-broker.service.spec.ts +172 -0
- package/src/oauth/oauth-token-broker.service.ts +363 -0
- package/src/oauth/oauth.module.ts +3 -1
- package/src/oauth/oauth.service.ts +8 -2
- package/src/pdf/pdf.service.ts +75 -0
- package/src/presence/presence.controller.ts +29 -0
- package/src/presence/presence.listener.ts +53 -0
- package/src/presence/presence.module.ts +19 -0
- package/src/presence/presence.service.spec.ts +97 -0
- package/src/presence/presence.service.ts +160 -0
- package/src/profile/dto/delete-account.dto.ts +11 -0
- package/src/profile/events/profile-account-deleted.event.ts +13 -0
- package/src/profile/profile.controller.ts +46 -34
- package/src/profile/profile.service.ts +138 -38
- package/src/realtime/realtime.gateway.ts +138 -0
- package/src/realtime/realtime.module.ts +16 -0
- package/src/realtime/realtime.service.spec.ts +50 -0
- package/src/realtime/realtime.service.ts +187 -0
- package/src/redis/redis-pubsub.ts +179 -0
- package/src/setting/dto/create.dto.ts +13 -2
- package/src/setting/setting.service.spec.ts +56 -0
- package/src/setting/setting.service.ts +29 -1
- package/src/user/dto/create-with-email-and-password.dto.ts +6 -1
- package/src/user/dto/query-user-mail-list.dto.ts +10 -0
- package/src/user/user-credential.util.ts +35 -0
- package/src/user/user.controller.ts +17 -2
- package/src/user/user.service.spec.ts +153 -0
- package/src/user/user.service.ts +255 -12
- package/src/validators/is-strong-password-with-settings.validator.ts +12 -0
- package/src/validators/service-locator.ts +15 -0
- package/src/whatsapp-sender/whatsapp-sender.module.ts +10 -0
- package/src/whatsapp-sender/whatsapp-sender.service.ts +313 -0
|
@@ -0,0 +1,1009 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { CopyButton } from '@/components/copy-button';
|
|
4
|
+
import { Alert, AlertDescription, AlertTitle } from '@/components/ui/alert';
|
|
5
|
+
import { Badge } from '@/components/ui/badge';
|
|
6
|
+
import { Button } from '@/components/ui/button';
|
|
7
|
+
import { Card, CardContent } from '@/components/ui/card';
|
|
8
|
+
import { Input } from '@/components/ui/input';
|
|
9
|
+
import { Label } from '@/components/ui/label';
|
|
10
|
+
import { ResizableSheetContent } from '@/components/ui/resizable-sheet-content';
|
|
11
|
+
import { ScrollArea } from '@/components/ui/scroll-area';
|
|
12
|
+
import {
|
|
13
|
+
Select,
|
|
14
|
+
SelectContent,
|
|
15
|
+
SelectItem,
|
|
16
|
+
SelectTrigger,
|
|
17
|
+
SelectValue,
|
|
18
|
+
} from '@/components/ui/select';
|
|
19
|
+
import {
|
|
20
|
+
Sheet,
|
|
21
|
+
SheetDescription,
|
|
22
|
+
SheetHeader,
|
|
23
|
+
SheetTitle,
|
|
24
|
+
} from '@/components/ui/sheet';
|
|
25
|
+
import { Switch } from '@/components/ui/switch';
|
|
26
|
+
import { toKebabCase, toTitleCase } from '@/lib/scaffold/naming';
|
|
27
|
+
import {
|
|
28
|
+
SCAFFOLD_COLUMN_TYPES,
|
|
29
|
+
type ScaffoldColumn,
|
|
30
|
+
type ScaffoldColumnType,
|
|
31
|
+
type ScaffoldContext,
|
|
32
|
+
type ScaffoldFile,
|
|
33
|
+
type ScaffoldPlan,
|
|
34
|
+
type ScaffoldTemplate,
|
|
35
|
+
} from '@/lib/scaffold/types';
|
|
36
|
+
import { cn } from '@/lib/utils';
|
|
37
|
+
import { useApp, useQuery } from '@hed-hog/next-app-provider';
|
|
38
|
+
import { Check, Loader2, Plus, Trash2 } from 'lucide-react';
|
|
39
|
+
import { useTranslations } from 'next-intl';
|
|
40
|
+
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
41
|
+
import { toast } from 'sonner';
|
|
42
|
+
import type { MenuNode, PaginatedResponse, RoleSummary } from './system-page-types';
|
|
43
|
+
import { getMenuLabel, getRoleLabel } from './use-system-pages';
|
|
44
|
+
|
|
45
|
+
const STEP_KEYS = [
|
|
46
|
+
'target',
|
|
47
|
+
'template',
|
|
48
|
+
'columns',
|
|
49
|
+
'backend',
|
|
50
|
+
'menu',
|
|
51
|
+
'review',
|
|
52
|
+
] as const;
|
|
53
|
+
|
|
54
|
+
const TEMPLATES: ScaffoldTemplate[] = [
|
|
55
|
+
'list-kpi',
|
|
56
|
+
'list-simple',
|
|
57
|
+
'detail-form',
|
|
58
|
+
'dashboard',
|
|
59
|
+
];
|
|
60
|
+
|
|
61
|
+
type PreviewResponse = {
|
|
62
|
+
files: ScaffoldFile[];
|
|
63
|
+
conflicts: string[];
|
|
64
|
+
steps: string[];
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
type ValidationIssue = { field: string; message: string };
|
|
68
|
+
|
|
69
|
+
function emptyColumn(): ScaffoldColumn {
|
|
70
|
+
return {
|
|
71
|
+
name: '',
|
|
72
|
+
type: 'varchar',
|
|
73
|
+
nullable: false,
|
|
74
|
+
labelEn: '',
|
|
75
|
+
labelPt: '',
|
|
76
|
+
inList: true,
|
|
77
|
+
inFilters: false,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function createEmptyPlan(): ScaffoldPlan {
|
|
82
|
+
return {
|
|
83
|
+
library: '',
|
|
84
|
+
entity: '',
|
|
85
|
+
route: '',
|
|
86
|
+
labelEn: '',
|
|
87
|
+
labelPt: '',
|
|
88
|
+
descriptionEn: '',
|
|
89
|
+
descriptionPt: '',
|
|
90
|
+
template: 'list-kpi',
|
|
91
|
+
columns: [
|
|
92
|
+
{
|
|
93
|
+
name: 'name',
|
|
94
|
+
type: 'varchar',
|
|
95
|
+
nullable: false,
|
|
96
|
+
length: 255,
|
|
97
|
+
labelEn: 'Name',
|
|
98
|
+
labelPt: 'Nome',
|
|
99
|
+
inList: true,
|
|
100
|
+
inFilters: false,
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
name: 'status',
|
|
104
|
+
type: 'enum',
|
|
105
|
+
nullable: false,
|
|
106
|
+
defaultValue: 'active',
|
|
107
|
+
enumValues: ['active', 'inactive'],
|
|
108
|
+
labelEn: 'Status',
|
|
109
|
+
labelPt: 'Situação',
|
|
110
|
+
inList: true,
|
|
111
|
+
inFilters: true,
|
|
112
|
+
},
|
|
113
|
+
],
|
|
114
|
+
apiBasePath: '',
|
|
115
|
+
endpoints: {
|
|
116
|
+
list: true,
|
|
117
|
+
stats: true,
|
|
118
|
+
get: true,
|
|
119
|
+
create: true,
|
|
120
|
+
update: true,
|
|
121
|
+
remove: true,
|
|
122
|
+
},
|
|
123
|
+
generateBackend: true,
|
|
124
|
+
menu: { parentSlug: null, icon: 'file-text', order: 0 },
|
|
125
|
+
roles: ['admin'],
|
|
126
|
+
newRole: null,
|
|
127
|
+
overwrite: false,
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
type PageWizardSheetProps = {
|
|
132
|
+
open: boolean;
|
|
133
|
+
onOpenChange: (open: boolean) => void;
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
export function PageWizardSheet({ open, onOpenChange }: PageWizardSheetProps) {
|
|
137
|
+
const t = useTranslations('core.PageWizard');
|
|
138
|
+
const { request, currentLocaleCode } = useApp();
|
|
139
|
+
|
|
140
|
+
const [step, setStep] = useState(0);
|
|
141
|
+
const [plan, setPlan] = useState<ScaffoldPlan>(createEmptyPlan);
|
|
142
|
+
const [preview, setPreview] = useState<PreviewResponse | null>(null);
|
|
143
|
+
const [issues, setIssues] = useState<ValidationIssue[]>([]);
|
|
144
|
+
const [isWorking, setIsWorking] = useState(false);
|
|
145
|
+
const [applied, setApplied] = useState<{ written: string[]; steps: string[] } | null>(
|
|
146
|
+
null
|
|
147
|
+
);
|
|
148
|
+
const [expandedFile, setExpandedFile] = useState<string | null>(null);
|
|
149
|
+
|
|
150
|
+
const { data: context } = useQuery<ScaffoldContext | null>({
|
|
151
|
+
queryKey: ['scaffold-context'],
|
|
152
|
+
queryFn: async () => {
|
|
153
|
+
const response = await fetch('/api/dev/scaffold/context');
|
|
154
|
+
|
|
155
|
+
if (!response.ok) {
|
|
156
|
+
return null;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
return (await response.json()) as ScaffoldContext;
|
|
160
|
+
},
|
|
161
|
+
enabled: open,
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
const { data: menus = [] } = useQuery<MenuNode[]>({
|
|
165
|
+
queryKey: ['scaffold-menus', currentLocaleCode],
|
|
166
|
+
queryFn: async () => {
|
|
167
|
+
const response = await request<MenuNode[]>({
|
|
168
|
+
url: '/menu/all',
|
|
169
|
+
method: 'GET',
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
return Array.isArray(response.data) ? response.data : [];
|
|
173
|
+
},
|
|
174
|
+
enabled: open,
|
|
175
|
+
placeholderData: (previous) => previous ?? [],
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
const { data: roles = [] } = useQuery<RoleSummary[]>({
|
|
179
|
+
queryKey: ['scaffold-roles', currentLocaleCode],
|
|
180
|
+
queryFn: async () => {
|
|
181
|
+
const response = await request<PaginatedResponse<RoleSummary>>({
|
|
182
|
+
url: '/role?pageSize=10000',
|
|
183
|
+
method: 'GET',
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
return response.data?.data ?? [];
|
|
187
|
+
},
|
|
188
|
+
enabled: open,
|
|
189
|
+
placeholderData: (previous) => previous ?? [],
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
useEffect(() => {
|
|
193
|
+
if (!open) {
|
|
194
|
+
setStep(0);
|
|
195
|
+
setPreview(null);
|
|
196
|
+
setIssues([]);
|
|
197
|
+
setApplied(null);
|
|
198
|
+
setPlan(createEmptyPlan());
|
|
199
|
+
}
|
|
200
|
+
}, [open]);
|
|
201
|
+
|
|
202
|
+
const updatePlan = useCallback((patch: Partial<ScaffoldPlan>) => {
|
|
203
|
+
setPlan((previous) => ({ ...previous, ...patch }));
|
|
204
|
+
setPreview(null);
|
|
205
|
+
setIssues([]);
|
|
206
|
+
}, []);
|
|
207
|
+
|
|
208
|
+
const updateColumn = useCallback(
|
|
209
|
+
(index: number, patch: Partial<ScaffoldColumn>) => {
|
|
210
|
+
setPlan((previous) => ({
|
|
211
|
+
...previous,
|
|
212
|
+
columns: previous.columns.map((column, columnIndex) =>
|
|
213
|
+
columnIndex === index ? { ...column, ...patch } : column
|
|
214
|
+
),
|
|
215
|
+
}));
|
|
216
|
+
setPreview(null);
|
|
217
|
+
},
|
|
218
|
+
[]
|
|
219
|
+
);
|
|
220
|
+
|
|
221
|
+
/** Entity e rota derivam um do outro até o usuário editar a rota manualmente. */
|
|
222
|
+
const handleEntityChange = (value: string) => {
|
|
223
|
+
const entity = value.trim().toLowerCase().replace(/[^a-z0-9_]/g, '');
|
|
224
|
+
const kebab = toKebabCase(entity);
|
|
225
|
+
|
|
226
|
+
setPlan((previous) => ({
|
|
227
|
+
...previous,
|
|
228
|
+
entity,
|
|
229
|
+
route: previous.library && kebab ? `/${previous.library}/${kebab}` : previous.route,
|
|
230
|
+
apiBasePath: kebab ? `/${kebab}` : previous.apiBasePath,
|
|
231
|
+
labelEn: previous.labelEn || toTitleCase(entity),
|
|
232
|
+
labelPt: previous.labelPt || toTitleCase(entity),
|
|
233
|
+
}));
|
|
234
|
+
setPreview(null);
|
|
235
|
+
setIssues([]);
|
|
236
|
+
};
|
|
237
|
+
|
|
238
|
+
const parentMenus = useMemo(
|
|
239
|
+
() =>
|
|
240
|
+
menus
|
|
241
|
+
.filter((menu) => menu.slug)
|
|
242
|
+
.sort((left, right) => getMenuLabel(left).localeCompare(getMenuLabel(right))),
|
|
243
|
+
[menus]
|
|
244
|
+
);
|
|
245
|
+
|
|
246
|
+
const canAdvance = useMemo(() => {
|
|
247
|
+
if (step === 0) {
|
|
248
|
+
return Boolean(plan.library && plan.entity && plan.route && plan.labelPt);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
if (step === 2 && plan.generateBackend) {
|
|
252
|
+
return plan.columns.length > 0 && plan.columns.every((column) => column.name);
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
return true;
|
|
256
|
+
}, [plan, step]);
|
|
257
|
+
|
|
258
|
+
const runPreview = async () => {
|
|
259
|
+
setIsWorking(true);
|
|
260
|
+
setIssues([]);
|
|
261
|
+
|
|
262
|
+
try {
|
|
263
|
+
const response = await fetch('/api/dev/scaffold', {
|
|
264
|
+
method: 'POST',
|
|
265
|
+
headers: { 'Content-Type': 'application/json' },
|
|
266
|
+
body: JSON.stringify({ mode: 'preview', plan }),
|
|
267
|
+
});
|
|
268
|
+
|
|
269
|
+
if (response.status === 422) {
|
|
270
|
+
const data = (await response.json()) as { issues: ValidationIssue[] };
|
|
271
|
+
setIssues(data.issues);
|
|
272
|
+
setPreview(null);
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
if (!response.ok) {
|
|
277
|
+
toast.error(t('previewError'));
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
setPreview((await response.json()) as PreviewResponse);
|
|
282
|
+
} catch {
|
|
283
|
+
toast.error(t('previewError'));
|
|
284
|
+
} finally {
|
|
285
|
+
setIsWorking(false);
|
|
286
|
+
}
|
|
287
|
+
};
|
|
288
|
+
|
|
289
|
+
const runApply = async () => {
|
|
290
|
+
setIsWorking(true);
|
|
291
|
+
|
|
292
|
+
try {
|
|
293
|
+
const response = await fetch('/api/dev/scaffold', {
|
|
294
|
+
method: 'POST',
|
|
295
|
+
headers: { 'Content-Type': 'application/json' },
|
|
296
|
+
body: JSON.stringify({ mode: 'apply', plan }),
|
|
297
|
+
});
|
|
298
|
+
|
|
299
|
+
if (!response.ok) {
|
|
300
|
+
const data = (await response.json().catch(() => null)) as {
|
|
301
|
+
message?: string;
|
|
302
|
+
} | null;
|
|
303
|
+
|
|
304
|
+
toast.error(data?.message ?? t('applyError'));
|
|
305
|
+
return;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
const data = (await response.json()) as {
|
|
309
|
+
written: string[];
|
|
310
|
+
manual: ScaffoldFile[];
|
|
311
|
+
steps: string[];
|
|
312
|
+
};
|
|
313
|
+
|
|
314
|
+
setApplied({ written: data.written, steps: data.steps });
|
|
315
|
+
setStep(STEP_KEYS.length);
|
|
316
|
+
toast.success(t('applySuccess', { count: data.written.length }));
|
|
317
|
+
} catch {
|
|
318
|
+
toast.error(t('applyError'));
|
|
319
|
+
} finally {
|
|
320
|
+
setIsWorking(false);
|
|
321
|
+
}
|
|
322
|
+
};
|
|
323
|
+
|
|
324
|
+
const goNext = async () => {
|
|
325
|
+
if (step === STEP_KEYS.length - 2) {
|
|
326
|
+
setStep(STEP_KEYS.length - 1);
|
|
327
|
+
await runPreview();
|
|
328
|
+
return;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
setStep((current) => Math.min(STEP_KEYS.length - 1, current + 1));
|
|
332
|
+
};
|
|
333
|
+
|
|
334
|
+
const isDone = step === STEP_KEYS.length;
|
|
335
|
+
|
|
336
|
+
return (
|
|
337
|
+
<Sheet open={open} onOpenChange={onOpenChange}>
|
|
338
|
+
<ResizableSheetContent
|
|
339
|
+
sheetId="core-page-wizard"
|
|
340
|
+
defaultWidth={860}
|
|
341
|
+
className="flex flex-col gap-0 p-0"
|
|
342
|
+
>
|
|
343
|
+
<SheetHeader className="border-b">
|
|
344
|
+
<SheetTitle>{t('title')}</SheetTitle>
|
|
345
|
+
<SheetDescription>{t('description')}</SheetDescription>
|
|
346
|
+
</SheetHeader>
|
|
347
|
+
|
|
348
|
+
{!isDone ? (
|
|
349
|
+
<div className="flex flex-wrap items-center gap-2 border-b px-4 py-3">
|
|
350
|
+
{STEP_KEYS.map((key, index) => (
|
|
351
|
+
<div key={key} className="flex items-center gap-1.5">
|
|
352
|
+
<span
|
|
353
|
+
className={cn(
|
|
354
|
+
'flex h-6 w-6 items-center justify-center rounded-full border text-[11px]',
|
|
355
|
+
index < step
|
|
356
|
+
? 'border-primary bg-primary text-primary-foreground'
|
|
357
|
+
: index === step
|
|
358
|
+
? 'border-primary text-primary'
|
|
359
|
+
: 'border-border text-muted-foreground'
|
|
360
|
+
)}
|
|
361
|
+
>
|
|
362
|
+
{index < step ? <Check className="size-3.5" /> : index + 1}
|
|
363
|
+
</span>
|
|
364
|
+
<span
|
|
365
|
+
className={cn(
|
|
366
|
+
'text-xs',
|
|
367
|
+
index === step
|
|
368
|
+
? 'font-medium text-foreground'
|
|
369
|
+
: 'text-muted-foreground'
|
|
370
|
+
)}
|
|
371
|
+
>
|
|
372
|
+
{t(`steps.${key}` as never)}
|
|
373
|
+
</span>
|
|
374
|
+
</div>
|
|
375
|
+
))}
|
|
376
|
+
</div>
|
|
377
|
+
) : null}
|
|
378
|
+
|
|
379
|
+
<ScrollArea className="min-h-0 flex-1">
|
|
380
|
+
<div className="space-y-4 p-4">
|
|
381
|
+
{isDone && applied ? (
|
|
382
|
+
<div className="space-y-4">
|
|
383
|
+
<Alert>
|
|
384
|
+
<AlertTitle>{t('doneTitle')}</AlertTitle>
|
|
385
|
+
<AlertDescription>
|
|
386
|
+
{t('doneDescription', { count: applied.written.length })}
|
|
387
|
+
</AlertDescription>
|
|
388
|
+
</Alert>
|
|
389
|
+
|
|
390
|
+
<div>
|
|
391
|
+
<h4 className="text-sm font-semibold">{t('doneFiles')}</h4>
|
|
392
|
+
<div className="mt-2 space-y-1">
|
|
393
|
+
{applied.written.map((file) => (
|
|
394
|
+
<div
|
|
395
|
+
key={file}
|
|
396
|
+
className="rounded-lg border bg-background/80 p-2 font-mono text-xs"
|
|
397
|
+
>
|
|
398
|
+
{file}
|
|
399
|
+
</div>
|
|
400
|
+
))}
|
|
401
|
+
</div>
|
|
402
|
+
</div>
|
|
403
|
+
|
|
404
|
+
<div>
|
|
405
|
+
<h4 className="text-sm font-semibold">{t('doneSteps')}</h4>
|
|
406
|
+
<p className="mt-0.5 text-xs text-muted-foreground">
|
|
407
|
+
{t('doneStepsHint')}
|
|
408
|
+
</p>
|
|
409
|
+
<div className="mt-2 space-y-1">
|
|
410
|
+
{applied.steps.map((command) => (
|
|
411
|
+
<div
|
|
412
|
+
key={command}
|
|
413
|
+
className="flex items-center gap-2 rounded-lg border bg-muted/30 p-2"
|
|
414
|
+
>
|
|
415
|
+
<code className="min-w-0 flex-1 truncate text-xs">
|
|
416
|
+
{command}
|
|
417
|
+
</code>
|
|
418
|
+
<CopyButton value={command} />
|
|
419
|
+
</div>
|
|
420
|
+
))}
|
|
421
|
+
</div>
|
|
422
|
+
</div>
|
|
423
|
+
</div>
|
|
424
|
+
) : null}
|
|
425
|
+
|
|
426
|
+
{!isDone && step === 0 ? (
|
|
427
|
+
<div className="grid gap-3 sm:grid-cols-2">
|
|
428
|
+
<div className="space-y-1.5">
|
|
429
|
+
<Label>{t('fieldLibrary')}</Label>
|
|
430
|
+
<Select
|
|
431
|
+
value={plan.library || undefined}
|
|
432
|
+
onValueChange={(value) =>
|
|
433
|
+
updatePlan({
|
|
434
|
+
library: value,
|
|
435
|
+
route: plan.entity
|
|
436
|
+
? `/${value}/${toKebabCase(plan.entity)}`
|
|
437
|
+
: `/${value}`,
|
|
438
|
+
})
|
|
439
|
+
}
|
|
440
|
+
>
|
|
441
|
+
<SelectTrigger className="w-full">
|
|
442
|
+
<SelectValue placeholder={t('fieldLibraryPlaceholder')} />
|
|
443
|
+
</SelectTrigger>
|
|
444
|
+
<SelectContent>
|
|
445
|
+
{(context?.libraries ?? []).map((library) => (
|
|
446
|
+
<SelectItem key={library} value={library}>
|
|
447
|
+
{library}
|
|
448
|
+
</SelectItem>
|
|
449
|
+
))}
|
|
450
|
+
</SelectContent>
|
|
451
|
+
</Select>
|
|
452
|
+
</div>
|
|
453
|
+
|
|
454
|
+
<div className="space-y-1.5">
|
|
455
|
+
<Label>{t('fieldEntity')}</Label>
|
|
456
|
+
<Input
|
|
457
|
+
value={plan.entity}
|
|
458
|
+
onChange={(event) => handleEntityChange(event.target.value)}
|
|
459
|
+
placeholder="service_order"
|
|
460
|
+
/>
|
|
461
|
+
<p className="text-xs text-muted-foreground">
|
|
462
|
+
{t('fieldEntityHint')}
|
|
463
|
+
</p>
|
|
464
|
+
</div>
|
|
465
|
+
|
|
466
|
+
<div className="space-y-1.5">
|
|
467
|
+
<Label>{t('fieldRoute')}</Label>
|
|
468
|
+
<Input
|
|
469
|
+
value={plan.route}
|
|
470
|
+
onChange={(event) => updatePlan({ route: event.target.value })}
|
|
471
|
+
placeholder="/crm/contracts"
|
|
472
|
+
/>
|
|
473
|
+
</div>
|
|
474
|
+
|
|
475
|
+
<div className="space-y-1.5">
|
|
476
|
+
<Label>{t('fieldApiBasePath')}</Label>
|
|
477
|
+
<Input
|
|
478
|
+
value={plan.apiBasePath}
|
|
479
|
+
onChange={(event) =>
|
|
480
|
+
updatePlan({ apiBasePath: event.target.value })
|
|
481
|
+
}
|
|
482
|
+
placeholder="/contract"
|
|
483
|
+
/>
|
|
484
|
+
</div>
|
|
485
|
+
|
|
486
|
+
<div className="space-y-1.5">
|
|
487
|
+
<Label>{t('fieldLabelPt')}</Label>
|
|
488
|
+
<Input
|
|
489
|
+
value={plan.labelPt}
|
|
490
|
+
onChange={(event) => updatePlan({ labelPt: event.target.value })}
|
|
491
|
+
/>
|
|
492
|
+
</div>
|
|
493
|
+
|
|
494
|
+
<div className="space-y-1.5">
|
|
495
|
+
<Label>{t('fieldLabelEn')}</Label>
|
|
496
|
+
<Input
|
|
497
|
+
value={plan.labelEn}
|
|
498
|
+
onChange={(event) => updatePlan({ labelEn: event.target.value })}
|
|
499
|
+
/>
|
|
500
|
+
</div>
|
|
501
|
+
|
|
502
|
+
<div className="space-y-1.5">
|
|
503
|
+
<Label>{t('fieldDescriptionPt')}</Label>
|
|
504
|
+
<Input
|
|
505
|
+
value={plan.descriptionPt}
|
|
506
|
+
onChange={(event) =>
|
|
507
|
+
updatePlan({ descriptionPt: event.target.value })
|
|
508
|
+
}
|
|
509
|
+
/>
|
|
510
|
+
</div>
|
|
511
|
+
|
|
512
|
+
<div className="space-y-1.5">
|
|
513
|
+
<Label>{t('fieldDescriptionEn')}</Label>
|
|
514
|
+
<Input
|
|
515
|
+
value={plan.descriptionEn}
|
|
516
|
+
onChange={(event) =>
|
|
517
|
+
updatePlan({ descriptionEn: event.target.value })
|
|
518
|
+
}
|
|
519
|
+
/>
|
|
520
|
+
</div>
|
|
521
|
+
</div>
|
|
522
|
+
) : null}
|
|
523
|
+
|
|
524
|
+
{!isDone && step === 1 ? (
|
|
525
|
+
<div className="grid gap-3 sm:grid-cols-2">
|
|
526
|
+
{TEMPLATES.map((template) => (
|
|
527
|
+
<Card
|
|
528
|
+
key={template}
|
|
529
|
+
className={cn(
|
|
530
|
+
'cursor-pointer border-border/70 py-0 transition-colors',
|
|
531
|
+
plan.template === template
|
|
532
|
+
? 'border-primary ring-1 ring-primary/20'
|
|
533
|
+
: 'hover:border-border'
|
|
534
|
+
)}
|
|
535
|
+
onClick={() => updatePlan({ template })}
|
|
536
|
+
>
|
|
537
|
+
<CardContent className="space-y-1 p-4">
|
|
538
|
+
<h4 className="text-sm font-semibold">
|
|
539
|
+
{t(`template_${template}` as never)}
|
|
540
|
+
</h4>
|
|
541
|
+
<p className="text-xs text-muted-foreground">
|
|
542
|
+
{t(`templateHint_${template}` as never)}
|
|
543
|
+
</p>
|
|
544
|
+
</CardContent>
|
|
545
|
+
</Card>
|
|
546
|
+
))}
|
|
547
|
+
</div>
|
|
548
|
+
) : null}
|
|
549
|
+
|
|
550
|
+
{!isDone && step === 2 ? (
|
|
551
|
+
<div className="space-y-3">
|
|
552
|
+
<p className="text-xs text-muted-foreground">
|
|
553
|
+
{t('columnsHint')}
|
|
554
|
+
</p>
|
|
555
|
+
|
|
556
|
+
{plan.columns.map((column, index) => (
|
|
557
|
+
<Card key={index} className="border-border/70 py-0">
|
|
558
|
+
<CardContent className="space-y-3 p-3">
|
|
559
|
+
<div className="grid gap-2 sm:grid-cols-4">
|
|
560
|
+
<Input
|
|
561
|
+
value={column.name}
|
|
562
|
+
onChange={(event) =>
|
|
563
|
+
updateColumn(index, {
|
|
564
|
+
name: event.target.value
|
|
565
|
+
.toLowerCase()
|
|
566
|
+
.replace(/[^a-z0-9_]/g, ''),
|
|
567
|
+
})
|
|
568
|
+
}
|
|
569
|
+
placeholder={t('columnName')}
|
|
570
|
+
/>
|
|
571
|
+
|
|
572
|
+
<Select
|
|
573
|
+
value={column.type}
|
|
574
|
+
onValueChange={(value) =>
|
|
575
|
+
updateColumn(index, {
|
|
576
|
+
type: value as ScaffoldColumnType,
|
|
577
|
+
})
|
|
578
|
+
}
|
|
579
|
+
>
|
|
580
|
+
<SelectTrigger className="w-full">
|
|
581
|
+
<SelectValue />
|
|
582
|
+
</SelectTrigger>
|
|
583
|
+
<SelectContent>
|
|
584
|
+
{SCAFFOLD_COLUMN_TYPES.map((type) => (
|
|
585
|
+
<SelectItem key={type} value={type}>
|
|
586
|
+
{type}
|
|
587
|
+
</SelectItem>
|
|
588
|
+
))}
|
|
589
|
+
</SelectContent>
|
|
590
|
+
</Select>
|
|
591
|
+
|
|
592
|
+
<Input
|
|
593
|
+
value={column.labelPt}
|
|
594
|
+
onChange={(event) =>
|
|
595
|
+
updateColumn(index, { labelPt: event.target.value })
|
|
596
|
+
}
|
|
597
|
+
placeholder={t('columnLabelPt')}
|
|
598
|
+
/>
|
|
599
|
+
|
|
600
|
+
<Input
|
|
601
|
+
value={column.labelEn}
|
|
602
|
+
onChange={(event) =>
|
|
603
|
+
updateColumn(index, { labelEn: event.target.value })
|
|
604
|
+
}
|
|
605
|
+
placeholder={t('columnLabelEn')}
|
|
606
|
+
/>
|
|
607
|
+
</div>
|
|
608
|
+
|
|
609
|
+
{column.type === 'enum' ? (
|
|
610
|
+
<Input
|
|
611
|
+
value={(column.enumValues ?? []).join(', ')}
|
|
612
|
+
onChange={(event) =>
|
|
613
|
+
updateColumn(index, {
|
|
614
|
+
enumValues: event.target.value
|
|
615
|
+
.split(',')
|
|
616
|
+
.map((value) => value.trim())
|
|
617
|
+
.filter(Boolean),
|
|
618
|
+
})
|
|
619
|
+
}
|
|
620
|
+
placeholder={t('columnEnumValues')}
|
|
621
|
+
/>
|
|
622
|
+
) : null}
|
|
623
|
+
|
|
624
|
+
{column.type === 'fk' ? (
|
|
625
|
+
<Select
|
|
626
|
+
value={column.referencesTable}
|
|
627
|
+
onValueChange={(value) =>
|
|
628
|
+
updateColumn(index, { referencesTable: value })
|
|
629
|
+
}
|
|
630
|
+
>
|
|
631
|
+
<SelectTrigger className="w-full">
|
|
632
|
+
<SelectValue placeholder={t('columnReferences')} />
|
|
633
|
+
</SelectTrigger>
|
|
634
|
+
<SelectContent>
|
|
635
|
+
{(context?.entitiesByLibrary[plan.library] ?? []).map(
|
|
636
|
+
(table) => (
|
|
637
|
+
<SelectItem key={table} value={table}>
|
|
638
|
+
{table}
|
|
639
|
+
</SelectItem>
|
|
640
|
+
)
|
|
641
|
+
)}
|
|
642
|
+
</SelectContent>
|
|
643
|
+
</Select>
|
|
644
|
+
) : null}
|
|
645
|
+
|
|
646
|
+
<div className="flex flex-wrap items-center gap-4">
|
|
647
|
+
<label className="flex items-center gap-2 text-xs">
|
|
648
|
+
<Switch
|
|
649
|
+
checked={column.nullable}
|
|
650
|
+
onCheckedChange={(checked) =>
|
|
651
|
+
updateColumn(index, { nullable: checked })
|
|
652
|
+
}
|
|
653
|
+
/>
|
|
654
|
+
{t('columnNullable')}
|
|
655
|
+
</label>
|
|
656
|
+
|
|
657
|
+
<label className="flex items-center gap-2 text-xs">
|
|
658
|
+
<Switch
|
|
659
|
+
checked={column.inList}
|
|
660
|
+
onCheckedChange={(checked) =>
|
|
661
|
+
updateColumn(index, { inList: checked })
|
|
662
|
+
}
|
|
663
|
+
/>
|
|
664
|
+
{t('columnInList')}
|
|
665
|
+
</label>
|
|
666
|
+
|
|
667
|
+
<label className="flex items-center gap-2 text-xs">
|
|
668
|
+
<Switch
|
|
669
|
+
checked={column.inFilters}
|
|
670
|
+
onCheckedChange={(checked) =>
|
|
671
|
+
updateColumn(index, { inFilters: checked })
|
|
672
|
+
}
|
|
673
|
+
/>
|
|
674
|
+
{t('columnInFilters')}
|
|
675
|
+
</label>
|
|
676
|
+
|
|
677
|
+
<Button
|
|
678
|
+
type="button"
|
|
679
|
+
variant="ghost"
|
|
680
|
+
size="icon"
|
|
681
|
+
className="ml-auto h-8 w-8 text-red-600"
|
|
682
|
+
onClick={() =>
|
|
683
|
+
setPlan((previous) => ({
|
|
684
|
+
...previous,
|
|
685
|
+
columns: previous.columns.filter(
|
|
686
|
+
(_, columnIndex) => columnIndex !== index
|
|
687
|
+
),
|
|
688
|
+
}))
|
|
689
|
+
}
|
|
690
|
+
>
|
|
691
|
+
<Trash2 className="h-4 w-4" />
|
|
692
|
+
</Button>
|
|
693
|
+
</div>
|
|
694
|
+
</CardContent>
|
|
695
|
+
</Card>
|
|
696
|
+
))}
|
|
697
|
+
|
|
698
|
+
<Button
|
|
699
|
+
type="button"
|
|
700
|
+
variant="outline"
|
|
701
|
+
size="sm"
|
|
702
|
+
onClick={() =>
|
|
703
|
+
setPlan((previous) => ({
|
|
704
|
+
...previous,
|
|
705
|
+
columns: [...previous.columns, emptyColumn()],
|
|
706
|
+
}))
|
|
707
|
+
}
|
|
708
|
+
>
|
|
709
|
+
<Plus className="h-4 w-4" />
|
|
710
|
+
{t('addColumn')}
|
|
711
|
+
</Button>
|
|
712
|
+
</div>
|
|
713
|
+
) : null}
|
|
714
|
+
|
|
715
|
+
{!isDone && step === 3 ? (
|
|
716
|
+
<div className="space-y-4">
|
|
717
|
+
<label className="flex items-center justify-between rounded-lg border p-3">
|
|
718
|
+
<div>
|
|
719
|
+
<div className="text-sm font-medium">{t('generateBackend')}</div>
|
|
720
|
+
<p className="text-xs text-muted-foreground">
|
|
721
|
+
{t('generateBackendHint')}
|
|
722
|
+
</p>
|
|
723
|
+
</div>
|
|
724
|
+
<Switch
|
|
725
|
+
checked={plan.generateBackend}
|
|
726
|
+
onCheckedChange={(checked) =>
|
|
727
|
+
updatePlan({ generateBackend: checked })
|
|
728
|
+
}
|
|
729
|
+
/>
|
|
730
|
+
</label>
|
|
731
|
+
|
|
732
|
+
<div className="grid gap-2 sm:grid-cols-2">
|
|
733
|
+
{(
|
|
734
|
+
[
|
|
735
|
+
['list', 'GET ' + plan.apiBasePath],
|
|
736
|
+
['stats', 'GET ' + plan.apiBasePath + '/stats'],
|
|
737
|
+
['get', 'GET ' + plan.apiBasePath + '/:id'],
|
|
738
|
+
['create', 'POST ' + plan.apiBasePath],
|
|
739
|
+
['update', 'PATCH ' + plan.apiBasePath + '/:id'],
|
|
740
|
+
['remove', 'DELETE ' + plan.apiBasePath + '/:id'],
|
|
741
|
+
] as const
|
|
742
|
+
).map(([key, label]) => (
|
|
743
|
+
<label
|
|
744
|
+
key={key}
|
|
745
|
+
className="flex items-center justify-between rounded-lg border p-2.5"
|
|
746
|
+
>
|
|
747
|
+
<code className="text-xs">{label}</code>
|
|
748
|
+
<Switch
|
|
749
|
+
checked={plan.endpoints[key]}
|
|
750
|
+
disabled={!plan.generateBackend}
|
|
751
|
+
onCheckedChange={(checked) =>
|
|
752
|
+
updatePlan({
|
|
753
|
+
endpoints: { ...plan.endpoints, [key]: checked },
|
|
754
|
+
})
|
|
755
|
+
}
|
|
756
|
+
/>
|
|
757
|
+
</label>
|
|
758
|
+
))}
|
|
759
|
+
</div>
|
|
760
|
+
</div>
|
|
761
|
+
) : null}
|
|
762
|
+
|
|
763
|
+
{!isDone && step === 4 ? (
|
|
764
|
+
<div className="space-y-4">
|
|
765
|
+
<div className="grid gap-3 sm:grid-cols-3">
|
|
766
|
+
<div className="space-y-1.5">
|
|
767
|
+
<Label>{t('menuParent')}</Label>
|
|
768
|
+
<Select
|
|
769
|
+
value={plan.menu.parentSlug ?? '__root__'}
|
|
770
|
+
onValueChange={(value) =>
|
|
771
|
+
updatePlan({
|
|
772
|
+
menu: {
|
|
773
|
+
...plan.menu,
|
|
774
|
+
parentSlug: value === '__root__' ? null : value,
|
|
775
|
+
},
|
|
776
|
+
})
|
|
777
|
+
}
|
|
778
|
+
>
|
|
779
|
+
<SelectTrigger className="w-full">
|
|
780
|
+
<SelectValue />
|
|
781
|
+
</SelectTrigger>
|
|
782
|
+
<SelectContent>
|
|
783
|
+
<SelectItem value="__root__">{t('menuRoot')}</SelectItem>
|
|
784
|
+
{parentMenus.map((menu) => (
|
|
785
|
+
<SelectItem key={menu.id} value={menu.slug}>
|
|
786
|
+
{getMenuLabel(menu)}
|
|
787
|
+
</SelectItem>
|
|
788
|
+
))}
|
|
789
|
+
</SelectContent>
|
|
790
|
+
</Select>
|
|
791
|
+
</div>
|
|
792
|
+
|
|
793
|
+
<div className="space-y-1.5">
|
|
794
|
+
<Label>{t('menuIcon')}</Label>
|
|
795
|
+
<Input
|
|
796
|
+
value={plan.menu.icon}
|
|
797
|
+
onChange={(event) =>
|
|
798
|
+
updatePlan({
|
|
799
|
+
menu: { ...plan.menu, icon: event.target.value },
|
|
800
|
+
})
|
|
801
|
+
}
|
|
802
|
+
placeholder="file-text"
|
|
803
|
+
/>
|
|
804
|
+
</div>
|
|
805
|
+
|
|
806
|
+
<div className="space-y-1.5">
|
|
807
|
+
<Label>{t('menuOrder')}</Label>
|
|
808
|
+
<Input
|
|
809
|
+
type="number"
|
|
810
|
+
value={plan.menu.order}
|
|
811
|
+
onChange={(event) =>
|
|
812
|
+
updatePlan({
|
|
813
|
+
menu: {
|
|
814
|
+
...plan.menu,
|
|
815
|
+
order: Number(event.target.value) || 0,
|
|
816
|
+
},
|
|
817
|
+
})
|
|
818
|
+
}
|
|
819
|
+
/>
|
|
820
|
+
</div>
|
|
821
|
+
</div>
|
|
822
|
+
|
|
823
|
+
<div>
|
|
824
|
+
<Label>{t('rolesTitle')}</Label>
|
|
825
|
+
<p className="mt-0.5 text-xs text-muted-foreground">
|
|
826
|
+
{t('rolesHint')}
|
|
827
|
+
</p>
|
|
828
|
+
|
|
829
|
+
<div className="mt-2 flex flex-wrap gap-1.5">
|
|
830
|
+
{roles.map((role) => {
|
|
831
|
+
const slug = role.slug ?? '';
|
|
832
|
+
const selected = plan.roles.includes(slug);
|
|
833
|
+
|
|
834
|
+
return (
|
|
835
|
+
<Badge
|
|
836
|
+
key={role.id}
|
|
837
|
+
variant="outline"
|
|
838
|
+
className={cn(
|
|
839
|
+
'cursor-pointer rounded-full px-2.5 py-1',
|
|
840
|
+
selected
|
|
841
|
+
? 'border-primary/40 bg-primary/10 text-primary'
|
|
842
|
+
: 'text-muted-foreground'
|
|
843
|
+
)}
|
|
844
|
+
onClick={() => {
|
|
845
|
+
if (slug === 'admin') {
|
|
846
|
+
return;
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
updatePlan({
|
|
850
|
+
roles: selected
|
|
851
|
+
? plan.roles.filter((item) => item !== slug)
|
|
852
|
+
: [...plan.roles, slug],
|
|
853
|
+
});
|
|
854
|
+
}}
|
|
855
|
+
>
|
|
856
|
+
{getRoleLabel(role)}
|
|
857
|
+
</Badge>
|
|
858
|
+
);
|
|
859
|
+
})}
|
|
860
|
+
</div>
|
|
861
|
+
</div>
|
|
862
|
+
</div>
|
|
863
|
+
) : null}
|
|
864
|
+
|
|
865
|
+
{!isDone && step === 5 ? (
|
|
866
|
+
<div className="space-y-3">
|
|
867
|
+
{issues.length > 0 ? (
|
|
868
|
+
<Alert variant="destructive">
|
|
869
|
+
<AlertTitle>{t('issuesTitle')}</AlertTitle>
|
|
870
|
+
<AlertDescription>
|
|
871
|
+
<ul className="list-disc pl-4">
|
|
872
|
+
{issues.map((issue) => (
|
|
873
|
+
<li key={`${issue.field}-${issue.message}`}>
|
|
874
|
+
{issue.message}
|
|
875
|
+
</li>
|
|
876
|
+
))}
|
|
877
|
+
</ul>
|
|
878
|
+
</AlertDescription>
|
|
879
|
+
</Alert>
|
|
880
|
+
) : null}
|
|
881
|
+
|
|
882
|
+
{preview?.conflicts.length ? (
|
|
883
|
+
<Alert>
|
|
884
|
+
<AlertTitle>{t('conflictsTitle')}</AlertTitle>
|
|
885
|
+
<AlertDescription>
|
|
886
|
+
<ul className="list-disc pl-4">
|
|
887
|
+
{preview.conflicts.map((file) => (
|
|
888
|
+
<li key={file} className="font-mono text-xs">
|
|
889
|
+
{file}
|
|
890
|
+
</li>
|
|
891
|
+
))}
|
|
892
|
+
</ul>
|
|
893
|
+
<label className="mt-2 flex items-center gap-2 text-xs">
|
|
894
|
+
<Switch
|
|
895
|
+
checked={plan.overwrite}
|
|
896
|
+
onCheckedChange={(checked) =>
|
|
897
|
+
setPlan((previous) => ({
|
|
898
|
+
...previous,
|
|
899
|
+
overwrite: checked,
|
|
900
|
+
}))
|
|
901
|
+
}
|
|
902
|
+
/>
|
|
903
|
+
{t('overwrite')}
|
|
904
|
+
</label>
|
|
905
|
+
</AlertDescription>
|
|
906
|
+
</Alert>
|
|
907
|
+
) : null}
|
|
908
|
+
|
|
909
|
+
{isWorking && !preview ? (
|
|
910
|
+
<div className="flex items-center gap-2 text-sm text-muted-foreground">
|
|
911
|
+
<Loader2 className="h-4 w-4 animate-spin" />
|
|
912
|
+
{t('previewLoading')}
|
|
913
|
+
</div>
|
|
914
|
+
) : null}
|
|
915
|
+
|
|
916
|
+
{preview?.files.map((file) => (
|
|
917
|
+
<Card key={file.path} className="border-border/70 py-0">
|
|
918
|
+
<CardContent className="p-3">
|
|
919
|
+
<button
|
|
920
|
+
type="button"
|
|
921
|
+
className="flex w-full cursor-pointer items-center gap-2 text-left"
|
|
922
|
+
onClick={() =>
|
|
923
|
+
setExpandedFile((current) =>
|
|
924
|
+
current === file.path ? null : file.path
|
|
925
|
+
)
|
|
926
|
+
}
|
|
927
|
+
>
|
|
928
|
+
<Badge
|
|
929
|
+
variant="outline"
|
|
930
|
+
className={cn(
|
|
931
|
+
'rounded-full px-2 py-0 text-[10px]',
|
|
932
|
+
file.action === 'create'
|
|
933
|
+
? 'border-emerald-500/30 bg-emerald-500/10 text-emerald-600'
|
|
934
|
+
: file.action === 'manual'
|
|
935
|
+
? 'border-amber-500/30 bg-amber-500/10 text-amber-600'
|
|
936
|
+
: 'border-blue-500/30 bg-blue-500/10 text-blue-600'
|
|
937
|
+
)}
|
|
938
|
+
>
|
|
939
|
+
{t(`action_${file.action}` as never)}
|
|
940
|
+
</Badge>
|
|
941
|
+
<span className="min-w-0 flex-1 truncate font-mono text-xs">
|
|
942
|
+
{file.path}
|
|
943
|
+
</span>
|
|
944
|
+
</button>
|
|
945
|
+
|
|
946
|
+
{file.instruction ? (
|
|
947
|
+
<p className="mt-2 text-xs text-amber-600">
|
|
948
|
+
{file.instruction}
|
|
949
|
+
</p>
|
|
950
|
+
) : null}
|
|
951
|
+
|
|
952
|
+
{expandedFile === file.path && file.preview ? (
|
|
953
|
+
<pre className="mt-2 max-h-80 overflow-auto rounded-lg bg-muted/40 p-2 text-[11px] leading-4">
|
|
954
|
+
{file.preview}
|
|
955
|
+
</pre>
|
|
956
|
+
) : null}
|
|
957
|
+
</CardContent>
|
|
958
|
+
</Card>
|
|
959
|
+
))}
|
|
960
|
+
</div>
|
|
961
|
+
) : null}
|
|
962
|
+
</div>
|
|
963
|
+
</ScrollArea>
|
|
964
|
+
|
|
965
|
+
<div className="flex items-center justify-between gap-2 border-t p-4">
|
|
966
|
+
<Button
|
|
967
|
+
type="button"
|
|
968
|
+
variant="outline"
|
|
969
|
+
disabled={step === 0 || isWorking || isDone}
|
|
970
|
+
onClick={() => setStep((current) => Math.max(0, current - 1))}
|
|
971
|
+
>
|
|
972
|
+
{t('back')}
|
|
973
|
+
</Button>
|
|
974
|
+
|
|
975
|
+
{isDone ? (
|
|
976
|
+
<Button type="button" onClick={() => onOpenChange(false)}>
|
|
977
|
+
{t('close')}
|
|
978
|
+
</Button>
|
|
979
|
+
) : step < STEP_KEYS.length - 1 ? (
|
|
980
|
+
<Button type="button" disabled={!canAdvance} onClick={goNext}>
|
|
981
|
+
{t('next')}
|
|
982
|
+
</Button>
|
|
983
|
+
) : (
|
|
984
|
+
<div className="flex gap-2">
|
|
985
|
+
<Button
|
|
986
|
+
type="button"
|
|
987
|
+
variant="outline"
|
|
988
|
+
disabled={isWorking}
|
|
989
|
+
onClick={runPreview}
|
|
990
|
+
>
|
|
991
|
+
{t('refreshPreview')}
|
|
992
|
+
</Button>
|
|
993
|
+
<Button
|
|
994
|
+
type="button"
|
|
995
|
+
disabled={isWorking || !preview || issues.length > 0}
|
|
996
|
+
onClick={runApply}
|
|
997
|
+
>
|
|
998
|
+
{isWorking ? (
|
|
999
|
+
<Loader2 className="h-4 w-4 animate-spin" />
|
|
1000
|
+
) : null}
|
|
1001
|
+
{t('generate')}
|
|
1002
|
+
</Button>
|
|
1003
|
+
</div>
|
|
1004
|
+
)}
|
|
1005
|
+
</div>
|
|
1006
|
+
</ResizableSheetContent>
|
|
1007
|
+
</Sheet>
|
|
1008
|
+
);
|
|
1009
|
+
}
|