openloops 0.1.8 → 0.1.10
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/dist/chunk-XRJFNASX.mjs +14 -0
- package/dist/common/clients/index.js +26 -0
- package/dist/common/clients/index.mjs +3 -0
- package/dist/common/clients/llm-client.js +159 -0
- package/dist/common/clients/llm-client.mjs +126 -0
- package/dist/common/clients/sentry-client.js +87 -0
- package/dist/common/clients/sentry-client.mjs +53 -0
- package/dist/common/clients/serper-client.js +74 -0
- package/dist/common/clients/serper-client.mjs +41 -0
- package/dist/common/core/base.app.js +57 -0
- package/dist/common/core/base.app.mjs +34 -0
- package/dist/common/core/base.entity.js +208 -0
- package/dist/common/core/base.entity.mjs +179 -0
- package/dist/common/core/base.use-case.js +30 -0
- package/dist/common/core/base.use-case.mjs +7 -0
- package/dist/common/core/index.js +1 -0
- package/dist/common/core/index.mjs +0 -0
- package/dist/common/core/utils/delete-empty-fields.js +66 -0
- package/dist/common/core/utils/delete-empty-fields.mjs +43 -0
- package/dist/common/core/utils/flatten-object.js +45 -0
- package/dist/common/core/utils/flatten-object.mjs +22 -0
- package/dist/common/core/utils/index.js +26 -0
- package/dist/common/core/utils/index.mjs +3 -0
- package/dist/common/core/utils/is-plain-object.js +32 -0
- package/dist/common/core/utils/is-plain-object.mjs +9 -0
- package/dist/common/decorators/admin-only/admin-only.js +52 -0
- package/dist/common/decorators/admin-only/admin-only.mjs +28 -0
- package/dist/common/decorators/admin-only/index.js +22 -0
- package/dist/common/decorators/admin-only/index.mjs +1 -0
- package/dist/common/decorators/index.js +26 -0
- package/dist/common/decorators/index.mjs +3 -0
- package/dist/common/decorators/mask-in-logs/index.js +22 -0
- package/dist/common/decorators/mask-in-logs/index.mjs +1 -0
- package/dist/common/decorators/mask-in-logs/mask-in-logs.js +53 -0
- package/dist/common/decorators/mask-in-logs/mask-in-logs.mjs +29 -0
- package/dist/common/decorators/owner-only/index.js +22 -0
- package/dist/common/decorators/owner-only/index.mjs +1 -0
- package/dist/common/decorators/owner-only/owner-only.js +52 -0
- package/dist/common/decorators/owner-only/owner-only.mjs +28 -0
- package/dist/common/error/http-error.js +37 -0
- package/dist/common/error/http-error.mjs +14 -0
- package/dist/common/error/index.js +24 -0
- package/dist/common/error/index.mjs +2 -0
- package/dist/common/error/reportError.js +51 -0
- package/dist/common/error/reportError.mjs +28 -0
- package/dist/common/helpers/extract-json-from-text.js +63 -0
- package/dist/common/helpers/extract-json-from-text.mjs +40 -0
- package/dist/common/helpers/index.js +24 -0
- package/dist/common/helpers/index.mjs +2 -0
- package/dist/common/helpers/sanitize-string.js +45 -0
- package/dist/common/helpers/sanitize-string.mjs +12 -0
- package/dist/common/logger/index.js +22 -0
- package/dist/common/logger/index.mjs +1 -0
- package/dist/common/logger/pino.js +70 -0
- package/dist/common/logger/pino.mjs +36 -0
- package/dist/common/repositories/index.js +24 -0
- package/dist/common/repositories/index.mjs +2 -0
- package/dist/common/repositories/mongo-db.client.js +79 -0
- package/dist/common/repositories/mongo-db.client.mjs +57 -0
- package/dist/common/repositories/mongo-db.repository.js +219 -0
- package/dist/common/repositories/mongo-db.repository.mjs +196 -0
- package/dist/common/utils/secret-manager.js +105 -0
- package/dist/common/utils/secret-manager.mjs +71 -0
- package/dist/index.js +22 -7
- package/dist/index.mjs +1 -7
- package/dist/services/agent/core/agent-loop.js +29 -0
- package/dist/services/agent/core/agent-loop.mjs +6 -0
- package/dist/services/agent/core/agent-state.js +102 -0
- package/dist/services/agent/core/agent-state.mjs +78 -0
- package/dist/services/agent/core/agent.js +351 -0
- package/dist/services/agent/core/agent.mjs +327 -0
- package/dist/services/agent/core/index.js +26 -0
- package/dist/services/agent/core/index.mjs +3 -0
- package/dist/services/agent/loops/index.js +24 -0
- package/dist/services/agent/loops/index.mjs +2 -0
- package/dist/services/agent/loops/plan-execute/index.js +22 -0
- package/dist/services/agent/loops/plan-execute/index.mjs +1 -0
- package/dist/services/agent/loops/plan-execute/plan-execute-loop.js +242 -0
- package/dist/services/agent/loops/plan-execute/plan-execute-loop.mjs +226 -0
- package/dist/services/agent/loops/shared/index.js +22 -0
- package/dist/services/agent/loops/shared/index.mjs +1 -0
- package/dist/services/agent/loops/shared/skills/action-planner.js +68 -0
- package/dist/services/agent/loops/shared/skills/action-planner.mjs +45 -0
- package/dist/services/agent/loops/shared/skills/confirmation-gate.js +53 -0
- package/dist/services/agent/loops/shared/skills/confirmation-gate.mjs +30 -0
- package/dist/services/agent/loops/shared/skills/fast-responder.js +70 -0
- package/dist/services/agent/loops/shared/skills/fast-responder.mjs +47 -0
- package/dist/services/agent/loops/shared/skills/final-responder.js +57 -0
- package/dist/services/agent/loops/shared/skills/final-responder.mjs +34 -0
- package/dist/services/agent/loops/shared/skills/index.js +32 -0
- package/dist/services/agent/loops/shared/skills/index.mjs +6 -0
- package/dist/services/agent/loops/shared/skills/state-observer.js +57 -0
- package/dist/services/agent/loops/shared/skills/state-observer.mjs +34 -0
- package/dist/services/agent/loops/shared/skills/strategy-engine.js +60 -0
- package/dist/services/agent/loops/shared/skills/strategy-engine.mjs +37 -0
- package/dist/services/agent/modules/chats/entities/agent-action.entity.js +151 -0
- package/dist/services/agent/modules/chats/entities/agent-action.entity.mjs +128 -0
- package/dist/services/agent/modules/chats/entities/agent-task.entity.js +231 -0
- package/dist/services/agent/modules/chats/entities/agent-task.entity.mjs +207 -0
- package/dist/services/agent/modules/chats/entities/chat-context.entity.js +70 -0
- package/dist/services/agent/modules/chats/entities/chat-context.entity.mjs +47 -0
- package/dist/services/agent/modules/chats/entities/chat-message.entity.js +58 -0
- package/dist/services/agent/modules/chats/entities/chat-message.entity.mjs +35 -0
- package/dist/services/agent/modules/chats/entities/chat-settings.entity.js +63 -0
- package/dist/services/agent/modules/chats/entities/chat-settings.entity.mjs +40 -0
- package/dist/services/agent/modules/chats/entities/chat.entity.js +163 -0
- package/dist/services/agent/modules/chats/entities/chat.entity.mjs +140 -0
- package/dist/services/agent/modules/chats/entities/index.js +22 -0
- package/dist/services/agent/modules/chats/entities/index.mjs +1 -0
- package/dist/services/agent/modules/chats/lambdas/create-chat/create-chat.use-case.js +56 -0
- package/dist/services/agent/modules/chats/lambdas/create-chat/create-chat.use-case.mjs +27 -0
- package/dist/services/agent/modules/chats/lambdas/create-chat/index.js +22 -0
- package/dist/services/agent/modules/chats/lambdas/create-chat/index.mjs +1 -0
- package/dist/services/agent/modules/chats/lambdas/delete-chat/delete-chat.use-case.js +61 -0
- package/dist/services/agent/modules/chats/lambdas/delete-chat/delete-chat.use-case.mjs +32 -0
- package/dist/services/agent/modules/chats/lambdas/delete-chat/index.js +22 -0
- package/dist/services/agent/modules/chats/lambdas/delete-chat/index.mjs +1 -0
- package/dist/services/agent/modules/chats/lambdas/get-chat-by-id/get-chat-by-id.use-case.js +52 -0
- package/dist/services/agent/modules/chats/lambdas/get-chat-by-id/get-chat-by-id.use-case.mjs +23 -0
- package/dist/services/agent/modules/chats/lambdas/get-chat-by-id/index.js +22 -0
- package/dist/services/agent/modules/chats/lambdas/get-chat-by-id/index.mjs +1 -0
- package/dist/services/agent/modules/chats/lambdas/interrupt-execution/index.js +22 -0
- package/dist/services/agent/modules/chats/lambdas/interrupt-execution/index.mjs +1 -0
- package/dist/services/agent/modules/chats/lambdas/interrupt-execution/interrupt-execution.use-case.js +64 -0
- package/dist/services/agent/modules/chats/lambdas/interrupt-execution/interrupt-execution.use-case.mjs +35 -0
- package/dist/services/agent/modules/chats/lambdas/list-chats-by-props/index.js +22 -0
- package/dist/services/agent/modules/chats/lambdas/list-chats-by-props/index.mjs +1 -0
- package/dist/services/agent/modules/chats/lambdas/list-chats-by-props/list-chats-by-props.use-case.js +52 -0
- package/dist/services/agent/modules/chats/lambdas/list-chats-by-props/list-chats-by-props.use-case.mjs +23 -0
- package/dist/services/agent/modules/chats/lambdas/list-chats-by-user/index.js +22 -0
- package/dist/services/agent/modules/chats/lambdas/list-chats-by-user/index.mjs +1 -0
- package/dist/services/agent/modules/chats/lambdas/list-chats-by-user/list-chats-by-user.use-case.js +59 -0
- package/dist/services/agent/modules/chats/lambdas/list-chats-by-user/list-chats-by-user.use-case.mjs +30 -0
- package/dist/services/agent/modules/chats/lambdas/update-chat/index.js +22 -0
- package/dist/services/agent/modules/chats/lambdas/update-chat/index.mjs +1 -0
- package/dist/services/agent/modules/chats/lambdas/update-chat/update-chat.use-case.js +64 -0
- package/dist/services/agent/modules/chats/lambdas/update-chat/update-chat.use-case.mjs +35 -0
- package/dist/services/agent/modules/chats/repositories/chat.repository.js +67 -0
- package/dist/services/agent/modules/chats/repositories/chat.repository.mjs +38 -0
- package/dist/services/agent/modules/chats/repositories/index.js +22 -0
- package/dist/services/agent/modules/chats/repositories/index.mjs +1 -0
- package/dist/services/agent/modules/llmcalls/entities/index.js +22 -0
- package/dist/services/agent/modules/llmcalls/entities/index.mjs +1 -0
- package/dist/services/agent/modules/llmcalls/entities/llmcall.entity.js +71 -0
- package/dist/services/agent/modules/llmcalls/entities/llmcall.entity.mjs +48 -0
- package/dist/services/agent/modules/llmcalls/lambdas/create-llmcall/create-llmcall.use-case.js +56 -0
- package/dist/services/agent/modules/llmcalls/lambdas/create-llmcall/create-llmcall.use-case.mjs +27 -0
- package/dist/services/agent/modules/llmcalls/lambdas/create-llmcall/index.js +22 -0
- package/dist/services/agent/modules/llmcalls/lambdas/create-llmcall/index.mjs +1 -0
- package/dist/services/agent/modules/llmcalls/lambdas/delete-llmcall/delete-llmcall.use-case.js +61 -0
- package/dist/services/agent/modules/llmcalls/lambdas/delete-llmcall/delete-llmcall.use-case.mjs +32 -0
- package/dist/services/agent/modules/llmcalls/lambdas/delete-llmcall/index.js +22 -0
- package/dist/services/agent/modules/llmcalls/lambdas/delete-llmcall/index.mjs +1 -0
- package/dist/services/agent/modules/llmcalls/lambdas/get-llm-usage/get-llm-usage.use-case.js +123 -0
- package/dist/services/agent/modules/llmcalls/lambdas/get-llm-usage/get-llm-usage.use-case.mjs +94 -0
- package/dist/services/agent/modules/llmcalls/lambdas/get-llm-usage/index.js +22 -0
- package/dist/services/agent/modules/llmcalls/lambdas/get-llm-usage/index.mjs +1 -0
- package/dist/services/agent/modules/llmcalls/lambdas/get-llmcall-by-id/get-llmcall-by-id.use-case.js +52 -0
- package/dist/services/agent/modules/llmcalls/lambdas/get-llmcall-by-id/get-llmcall-by-id.use-case.mjs +23 -0
- package/dist/services/agent/modules/llmcalls/lambdas/get-llmcall-by-id/index.js +22 -0
- package/dist/services/agent/modules/llmcalls/lambdas/get-llmcall-by-id/index.mjs +1 -0
- package/dist/services/agent/modules/llmcalls/lambdas/list-llmcalls-by-props/index.js +22 -0
- package/dist/services/agent/modules/llmcalls/lambdas/list-llmcalls-by-props/index.mjs +1 -0
- package/dist/services/agent/modules/llmcalls/lambdas/list-llmcalls-by-props/list-llmcalls-by-props.use-case.js +52 -0
- package/dist/services/agent/modules/llmcalls/lambdas/list-llmcalls-by-props/list-llmcalls-by-props.use-case.mjs +23 -0
- package/dist/services/agent/modules/llmcalls/lambdas/update-llmcall/index.js +22 -0
- package/dist/services/agent/modules/llmcalls/lambdas/update-llmcall/index.mjs +1 -0
- package/dist/services/agent/modules/llmcalls/lambdas/update-llmcall/update-llmcall.use-case.js +62 -0
- package/dist/services/agent/modules/llmcalls/lambdas/update-llmcall/update-llmcall.use-case.mjs +33 -0
- package/dist/services/agent/modules/llmcalls/repositories/index.js +22 -0
- package/dist/services/agent/modules/llmcalls/repositories/index.mjs +1 -0
- package/dist/services/agent/modules/llmcalls/repositories/llmcall.repository.js +67 -0
- package/dist/services/agent/modules/llmcalls/repositories/llmcall.repository.mjs +38 -0
- package/dist/services/agent/modules/mcp-servers/entities/index.js +22 -0
- package/dist/services/agent/modules/mcp-servers/entities/index.mjs +1 -0
- package/dist/services/agent/modules/mcp-servers/entities/mcpserver.entity.js +79 -0
- package/dist/services/agent/modules/mcp-servers/entities/mcpserver.entity.mjs +56 -0
- package/dist/services/agent/modules/mcp-servers/lambdas/create-mcpserver/create-mcpserver.use-case.js +56 -0
- package/dist/services/agent/modules/mcp-servers/lambdas/create-mcpserver/create-mcpserver.use-case.mjs +27 -0
- package/dist/services/agent/modules/mcp-servers/lambdas/create-mcpserver/index.js +22 -0
- package/dist/services/agent/modules/mcp-servers/lambdas/create-mcpserver/index.mjs +1 -0
- package/dist/services/agent/modules/mcp-servers/lambdas/delete-mcpserver/delete-mcpserver.use-case.js +61 -0
- package/dist/services/agent/modules/mcp-servers/lambdas/delete-mcpserver/delete-mcpserver.use-case.mjs +32 -0
- package/dist/services/agent/modules/mcp-servers/lambdas/delete-mcpserver/index.js +22 -0
- package/dist/services/agent/modules/mcp-servers/lambdas/delete-mcpserver/index.mjs +1 -0
- package/dist/services/agent/modules/mcp-servers/lambdas/get-mcpserver-by-id/get-mcpserver-by-id.use-case.js +52 -0
- package/dist/services/agent/modules/mcp-servers/lambdas/get-mcpserver-by-id/get-mcpserver-by-id.use-case.mjs +23 -0
- package/dist/services/agent/modules/mcp-servers/lambdas/get-mcpserver-by-id/index.js +22 -0
- package/dist/services/agent/modules/mcp-servers/lambdas/get-mcpserver-by-id/index.mjs +1 -0
- package/dist/services/agent/modules/mcp-servers/lambdas/list-mcpservers-by-user/index.js +22 -0
- package/dist/services/agent/modules/mcp-servers/lambdas/list-mcpservers-by-user/index.mjs +1 -0
- package/dist/services/agent/modules/mcp-servers/lambdas/list-mcpservers-by-user/list-mcpservers-by-user.use-case.js +59 -0
- package/dist/services/agent/modules/mcp-servers/lambdas/list-mcpservers-by-user/list-mcpservers-by-user.use-case.mjs +30 -0
- package/dist/services/agent/modules/mcp-servers/lambdas/update-mcpserver/index.js +22 -0
- package/dist/services/agent/modules/mcp-servers/lambdas/update-mcpserver/index.mjs +1 -0
- package/dist/services/agent/modules/mcp-servers/lambdas/update-mcpserver/update-mcpserver.use-case.js +61 -0
- package/dist/services/agent/modules/mcp-servers/lambdas/update-mcpserver/update-mcpserver.use-case.mjs +32 -0
- package/dist/services/agent/modules/mcp-servers/repositories/index.js +22 -0
- package/dist/services/agent/modules/mcp-servers/repositories/index.mjs +1 -0
- package/dist/services/agent/modules/mcp-servers/repositories/mcpserver.repository.js +67 -0
- package/dist/services/agent/modules/mcp-servers/repositories/mcpserver.repository.mjs +38 -0
- package/dist/services/agent/skills/index.js +24 -0
- package/dist/services/agent/skills/index.mjs +2 -0
- package/dist/services/agent/skills/shared/index.js +22 -0
- package/dist/services/agent/skills/shared/index.mjs +1 -0
- package/dist/services/agent/skills/shared/shared-rules.js +37 -0
- package/dist/services/agent/skills/shared/shared-rules.mjs +11 -0
- package/dist/services/agent/skills/skill-runner.js +121 -0
- package/dist/services/agent/skills/skill-runner.mjs +92 -0
- package/dist/services/agent/skills/skill.js +128 -0
- package/dist/services/agent/skills/skill.mjs +105 -0
- package/dist/services/agent/tools/core/call-ai/call-ai.skill.js +54 -0
- package/dist/services/agent/tools/core/call-ai/call-ai.skill.mjs +31 -0
- package/dist/services/agent/tools/core/call-ai/call-ai.tool.js +68 -0
- package/dist/services/agent/tools/core/call-ai/call-ai.tool.mjs +45 -0
- package/dist/services/agent/tools/core/call-ai/index.js +22 -0
- package/dist/services/agent/tools/core/call-ai/index.mjs +1 -0
- package/dist/services/agent/tools/core/index.js +24 -0
- package/dist/services/agent/tools/core/index.mjs +2 -0
- package/dist/services/agent/tools/core/web-search/index.js +22 -0
- package/dist/services/agent/tools/core/web-search/index.mjs +1 -0
- package/dist/services/agent/tools/core/web-search/web-search.tool.js +51 -0
- package/dist/services/agent/tools/core/web-search/web-search.tool.mjs +30 -0
- package/dist/services/agent/tools/index.js +24 -0
- package/dist/services/agent/tools/index.mjs +2 -0
- package/dist/services/agent/tools/tool.js +57 -0
- package/dist/services/agent/tools/tool.mjs +34 -0
- package/dist/services/agent/utils/rank-tools-by-keywords.js +65 -0
- package/dist/services/agent/utils/rank-tools-by-keywords.mjs +42 -0
- package/dist/services/app/core/app.js +60 -0
- package/dist/services/app/core/app.mjs +47 -0
- package/dist/services/app/core/current-session.js +124 -0
- package/dist/services/app/core/current-session.mjs +104 -0
- package/dist/services/app/core/current-user.js +84 -0
- package/dist/services/app/core/current-user.mjs +61 -0
- package/dist/services/app/core/index.js +26 -0
- package/dist/services/app/core/index.mjs +3 -0
- package/dist/services/app/modules/authentication/lambdas/login/index.js +22 -0
- package/dist/services/app/modules/authentication/lambdas/login/index.mjs +1 -0
- package/dist/services/app/modules/authentication/lambdas/login/login.use-case.js +89 -0
- package/dist/services/app/modules/authentication/lambdas/login/login.use-case.mjs +50 -0
- package/dist/services/app/modules/users/entities/index.js +22 -0
- package/dist/services/app/modules/users/entities/index.mjs +1 -0
- package/dist/services/app/modules/users/entities/user-acquisition.js +55 -0
- package/dist/services/app/modules/users/entities/user-acquisition.mjs +26 -0
- package/dist/services/app/modules/users/entities/user-country.js +44 -0
- package/dist/services/app/modules/users/entities/user-country.mjs +21 -0
- package/dist/services/app/modules/users/entities/user-currency.js +44 -0
- package/dist/services/app/modules/users/entities/user-currency.mjs +21 -0
- package/dist/services/app/modules/users/entities/user-email.value-object.js +43 -0
- package/dist/services/app/modules/users/entities/user-email.value-object.mjs +20 -0
- package/dist/services/app/modules/users/entities/user-language.js +44 -0
- package/dist/services/app/modules/users/entities/user-language.mjs +21 -0
- package/dist/services/app/modules/users/entities/user-marketing.js +53 -0
- package/dist/services/app/modules/users/entities/user-marketing.mjs +24 -0
- package/dist/services/app/modules/users/entities/user-notification-preferences.js +41 -0
- package/dist/services/app/modules/users/entities/user-notification-preferences.mjs +18 -0
- package/dist/services/app/modules/users/entities/user-password.value-object.js +69 -0
- package/dist/services/app/modules/users/entities/user-password.value-object.mjs +36 -0
- package/dist/services/app/modules/users/entities/user-permissions.js +59 -0
- package/dist/services/app/modules/users/entities/user-permissions.mjs +36 -0
- package/dist/services/app/modules/users/entities/user-preferences.js +69 -0
- package/dist/services/app/modules/users/entities/user-preferences.mjs +46 -0
- package/dist/services/app/modules/users/entities/user-report-preferences.js +56 -0
- package/dist/services/app/modules/users/entities/user-report-preferences.mjs +33 -0
- package/dist/services/app/modules/users/entities/user-report-schedule.js +41 -0
- package/dist/services/app/modules/users/entities/user-report-schedule.mjs +18 -0
- package/dist/services/app/modules/users/entities/user-timezone.js +44 -0
- package/dist/services/app/modules/users/entities/user-timezone.mjs +21 -0
- package/dist/services/app/modules/users/entities/user.entity.js +133 -0
- package/dist/services/app/modules/users/entities/user.entity.mjs +103 -0
- package/dist/services/app/modules/users/lambdas/create-user/create-user.use-case.js +58 -0
- package/dist/services/app/modules/users/lambdas/create-user/create-user.use-case.mjs +29 -0
- package/dist/services/app/modules/users/lambdas/create-user/index.js +22 -0
- package/dist/services/app/modules/users/lambdas/create-user/index.mjs +1 -0
- package/dist/services/app/modules/users/lambdas/delete-user/delete-user.use-case.js +61 -0
- package/dist/services/app/modules/users/lambdas/delete-user/delete-user.use-case.mjs +32 -0
- package/dist/services/app/modules/users/lambdas/delete-user/index.js +22 -0
- package/dist/services/app/modules/users/lambdas/delete-user/index.mjs +1 -0
- package/dist/services/app/modules/users/lambdas/get-user-by-id/get-user-by-id.use-case.js +52 -0
- package/dist/services/app/modules/users/lambdas/get-user-by-id/get-user-by-id.use-case.mjs +23 -0
- package/dist/services/app/modules/users/lambdas/get-user-by-id/index.js +22 -0
- package/dist/services/app/modules/users/lambdas/get-user-by-id/index.mjs +1 -0
- package/dist/services/app/modules/users/lambdas/list-users-by-props/index.js +22 -0
- package/dist/services/app/modules/users/lambdas/list-users-by-props/index.mjs +1 -0
- package/dist/services/app/modules/users/lambdas/list-users-by-props/list-users-by-props.use-case.js +52 -0
- package/dist/services/app/modules/users/lambdas/list-users-by-props/list-users-by-props.use-case.mjs +23 -0
- package/dist/services/app/modules/users/lambdas/update-user/index.js +22 -0
- package/dist/services/app/modules/users/lambdas/update-user/index.mjs +1 -0
- package/dist/services/app/modules/users/lambdas/update-user/update-user.use-case.js +62 -0
- package/dist/services/app/modules/users/lambdas/update-user/update-user.use-case.mjs +33 -0
- package/dist/services/app/modules/users/repositories/index.js +22 -0
- package/dist/services/app/modules/users/repositories/index.mjs +1 -0
- package/dist/services/app/modules/users/repositories/user.repository.js +83 -0
- package/dist/services/app/modules/users/repositories/user.repository.mjs +54 -0
- package/package.json +2 -2
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
20
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
21
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
22
|
+
if (decorator = decorators[i])
|
|
23
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
24
|
+
if (kind && result) __defProp(target, key, result);
|
|
25
|
+
return result;
|
|
26
|
+
};
|
|
27
|
+
var base_entity_exports = {};
|
|
28
|
+
__export(base_entity_exports, {
|
|
29
|
+
BaseEntity: () => BaseEntity
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(base_entity_exports);
|
|
32
|
+
var import_reflect_metadata = require("reflect-metadata");
|
|
33
|
+
var import_bson = require("bson");
|
|
34
|
+
var import_decorators = require("@common/decorators");
|
|
35
|
+
var import_helpers = require("@common/helpers");
|
|
36
|
+
var import_utils = require("./utils");
|
|
37
|
+
const _BaseEntity = class _BaseEntity {
|
|
38
|
+
_id;
|
|
39
|
+
__v;
|
|
40
|
+
ownerId;
|
|
41
|
+
createdAt;
|
|
42
|
+
createdBy;
|
|
43
|
+
updatedAt;
|
|
44
|
+
updatedBy;
|
|
45
|
+
deletedAt;
|
|
46
|
+
deletedBy;
|
|
47
|
+
deletedReason;
|
|
48
|
+
archivedAt;
|
|
49
|
+
archivedBy;
|
|
50
|
+
sharedWith;
|
|
51
|
+
toUnset;
|
|
52
|
+
static toObjectId(id) {
|
|
53
|
+
if (!id) return void 0;
|
|
54
|
+
if (id instanceof import_bson.ObjectId) return id;
|
|
55
|
+
if (!import_bson.ObjectId.isValid(id)) throw new Error(`Invalid ObjectId: ${id}`);
|
|
56
|
+
return new import_bson.ObjectId(id);
|
|
57
|
+
}
|
|
58
|
+
static toDate(value) {
|
|
59
|
+
if (!value) return void 0;
|
|
60
|
+
const date = new Date(value);
|
|
61
|
+
if (isNaN(date.getTime())) throw new Error("{{value_must_be_a_date}}");
|
|
62
|
+
return date;
|
|
63
|
+
}
|
|
64
|
+
static toNumber(value) {
|
|
65
|
+
if (value === void 0 || value === null) return void 0;
|
|
66
|
+
if (typeof value !== "number") throw new Error("{{value_must_be_a_number}}");
|
|
67
|
+
return value;
|
|
68
|
+
}
|
|
69
|
+
static clean(json) {
|
|
70
|
+
return (0, import_utils.deleteEmptyFields)(json);
|
|
71
|
+
}
|
|
72
|
+
constructor(props) {
|
|
73
|
+
this._id = _BaseEntity.toObjectId(props._id);
|
|
74
|
+
this.__v = _BaseEntity.toNumber(props.__v);
|
|
75
|
+
this.ownerId = _BaseEntity.toObjectId(props.ownerId);
|
|
76
|
+
this.createdAt = _BaseEntity.toDate(props.createdAt);
|
|
77
|
+
this.createdBy = _BaseEntity.toObjectId(props.createdBy);
|
|
78
|
+
this.updatedAt = _BaseEntity.toDate(props.updatedAt);
|
|
79
|
+
this.updatedBy = _BaseEntity.toObjectId(props.updatedBy);
|
|
80
|
+
this.deletedAt = _BaseEntity.toDate(props.deletedAt);
|
|
81
|
+
this.deletedBy = _BaseEntity.toObjectId(props.deletedBy);
|
|
82
|
+
this.deletedReason = (0, import_helpers.sanitizeString)(props.deletedReason);
|
|
83
|
+
this.archivedAt = _BaseEntity.toDate(props.archivedAt);
|
|
84
|
+
this.archivedBy = _BaseEntity.toObjectId(props.archivedBy);
|
|
85
|
+
this.sharedWith = props.sharedWith?.length ? props.sharedWith.map((id) => _BaseEntity.toObjectId(id)) : void 0;
|
|
86
|
+
}
|
|
87
|
+
toJSON() {
|
|
88
|
+
return {
|
|
89
|
+
_id: this._id,
|
|
90
|
+
__v: this.__v,
|
|
91
|
+
ownerId: this.ownerId,
|
|
92
|
+
createdAt: this.createdAt,
|
|
93
|
+
createdBy: this.createdBy,
|
|
94
|
+
updatedAt: this.updatedAt,
|
|
95
|
+
updatedBy: this.updatedBy,
|
|
96
|
+
deletedAt: this.deletedAt,
|
|
97
|
+
deletedBy: this.deletedBy,
|
|
98
|
+
deletedReason: this.deletedReason,
|
|
99
|
+
archivedAt: this.archivedAt,
|
|
100
|
+
archivedBy: this.archivedBy,
|
|
101
|
+
sharedWith: this.sharedWith?.length ? this.sharedWith.map((id) => id.toHexString()) : void 0,
|
|
102
|
+
toUnset: this.toUnset
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
setDefaults() {
|
|
106
|
+
}
|
|
107
|
+
setId(id) {
|
|
108
|
+
this._id = _BaseEntity.toObjectId(id);
|
|
109
|
+
}
|
|
110
|
+
setOwner(currentUser) {
|
|
111
|
+
if (!currentUser) return;
|
|
112
|
+
this.ownerId = _BaseEntity.toObjectId(currentUser.userId);
|
|
113
|
+
}
|
|
114
|
+
setCreatedBy(currentUser) {
|
|
115
|
+
if (!currentUser) return;
|
|
116
|
+
this.sanitize(currentUser);
|
|
117
|
+
this.createdAt = /* @__PURE__ */ new Date();
|
|
118
|
+
this.createdBy = _BaseEntity.toObjectId(currentUser.userId);
|
|
119
|
+
this.setDefaults();
|
|
120
|
+
}
|
|
121
|
+
setUpdatedBy(currentUser) {
|
|
122
|
+
if (!currentUser) return;
|
|
123
|
+
this.sanitize(currentUser);
|
|
124
|
+
this.updatedAt = /* @__PURE__ */ new Date();
|
|
125
|
+
this.updatedBy = _BaseEntity.toObjectId(currentUser.userId);
|
|
126
|
+
}
|
|
127
|
+
setDeletedBy(currentUser) {
|
|
128
|
+
if (!currentUser) return;
|
|
129
|
+
this.sanitize(currentUser);
|
|
130
|
+
this.deletedAt = /* @__PURE__ */ new Date();
|
|
131
|
+
this.deletedBy = _BaseEntity.toObjectId(currentUser.userId);
|
|
132
|
+
}
|
|
133
|
+
setArchivedBy(currentUser) {
|
|
134
|
+
if (!currentUser) return;
|
|
135
|
+
this.sanitize(currentUser);
|
|
136
|
+
this.archivedAt = /* @__PURE__ */ new Date();
|
|
137
|
+
this.archivedBy = _BaseEntity.toObjectId(currentUser.userId);
|
|
138
|
+
}
|
|
139
|
+
toDocument() {
|
|
140
|
+
return (0, import_utils.deleteEmptyFields)(this.toJSON());
|
|
141
|
+
}
|
|
142
|
+
toFlatDocument() {
|
|
143
|
+
const { toUnset, ...doc } = this.toDocument();
|
|
144
|
+
return { ...(0, import_utils.flattenObject)(doc), toUnset };
|
|
145
|
+
}
|
|
146
|
+
stringify() {
|
|
147
|
+
return JSON.stringify((0, import_decorators.handleMaskInLogs)(this), null, 2);
|
|
148
|
+
}
|
|
149
|
+
unset(fields) {
|
|
150
|
+
const toUnset = Array.from(new Set(fields.map((field) => String(field))));
|
|
151
|
+
if (!toUnset || !Array.isArray(toUnset)) return {};
|
|
152
|
+
this.toUnset = toUnset.reduce((acc, field) => {
|
|
153
|
+
acc[field] = "";
|
|
154
|
+
return acc;
|
|
155
|
+
}, {});
|
|
156
|
+
fields.forEach((field) => {
|
|
157
|
+
delete this[field];
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
sanitize(currentUser) {
|
|
161
|
+
if (!currentUser?.isAdmin()) {
|
|
162
|
+
for (const key in this) {
|
|
163
|
+
const isAdminOnly = Reflect.getMetadata("adminOnly", this.constructor.prototype, key);
|
|
164
|
+
if (isAdminOnly) {
|
|
165
|
+
delete this[key];
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
__decorateClass([
|
|
172
|
+
import_decorators.AdminOnly
|
|
173
|
+
], _BaseEntity.prototype, "__v", 2);
|
|
174
|
+
__decorateClass([
|
|
175
|
+
import_decorators.AdminOnly
|
|
176
|
+
], _BaseEntity.prototype, "ownerId", 2);
|
|
177
|
+
__decorateClass([
|
|
178
|
+
import_decorators.AdminOnly
|
|
179
|
+
], _BaseEntity.prototype, "createdAt", 2);
|
|
180
|
+
__decorateClass([
|
|
181
|
+
import_decorators.AdminOnly
|
|
182
|
+
], _BaseEntity.prototype, "createdBy", 2);
|
|
183
|
+
__decorateClass([
|
|
184
|
+
import_decorators.AdminOnly
|
|
185
|
+
], _BaseEntity.prototype, "updatedAt", 2);
|
|
186
|
+
__decorateClass([
|
|
187
|
+
import_decorators.AdminOnly
|
|
188
|
+
], _BaseEntity.prototype, "updatedBy", 2);
|
|
189
|
+
__decorateClass([
|
|
190
|
+
import_decorators.AdminOnly
|
|
191
|
+
], _BaseEntity.prototype, "deletedAt", 2);
|
|
192
|
+
__decorateClass([
|
|
193
|
+
import_decorators.AdminOnly
|
|
194
|
+
], _BaseEntity.prototype, "deletedBy", 2);
|
|
195
|
+
__decorateClass([
|
|
196
|
+
import_decorators.AdminOnly
|
|
197
|
+
], _BaseEntity.prototype, "archivedAt", 2);
|
|
198
|
+
__decorateClass([
|
|
199
|
+
import_decorators.AdminOnly
|
|
200
|
+
], _BaseEntity.prototype, "archivedBy", 2);
|
|
201
|
+
__decorateClass([
|
|
202
|
+
import_decorators.OwnerOnly
|
|
203
|
+
], _BaseEntity.prototype, "sharedWith", 2);
|
|
204
|
+
let BaseEntity = _BaseEntity;
|
|
205
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
206
|
+
0 && (module.exports = {
|
|
207
|
+
BaseEntity
|
|
208
|
+
});
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__decorateClass
|
|
3
|
+
} from "../../chunk-XRJFNASX.mjs";
|
|
4
|
+
import "reflect-metadata";
|
|
5
|
+
import { ObjectId } from "bson";
|
|
6
|
+
import { AdminOnly, OwnerOnly, handleMaskInLogs } from "@common/decorators";
|
|
7
|
+
import { sanitizeString } from "@common/helpers";
|
|
8
|
+
import { deleteEmptyFields, flattenObject } from "./utils";
|
|
9
|
+
const _BaseEntity = class _BaseEntity {
|
|
10
|
+
_id;
|
|
11
|
+
__v;
|
|
12
|
+
ownerId;
|
|
13
|
+
createdAt;
|
|
14
|
+
createdBy;
|
|
15
|
+
updatedAt;
|
|
16
|
+
updatedBy;
|
|
17
|
+
deletedAt;
|
|
18
|
+
deletedBy;
|
|
19
|
+
deletedReason;
|
|
20
|
+
archivedAt;
|
|
21
|
+
archivedBy;
|
|
22
|
+
sharedWith;
|
|
23
|
+
toUnset;
|
|
24
|
+
static toObjectId(id) {
|
|
25
|
+
if (!id) return void 0;
|
|
26
|
+
if (id instanceof ObjectId) return id;
|
|
27
|
+
if (!ObjectId.isValid(id)) throw new Error(`Invalid ObjectId: ${id}`);
|
|
28
|
+
return new ObjectId(id);
|
|
29
|
+
}
|
|
30
|
+
static toDate(value) {
|
|
31
|
+
if (!value) return void 0;
|
|
32
|
+
const date = new Date(value);
|
|
33
|
+
if (isNaN(date.getTime())) throw new Error("{{value_must_be_a_date}}");
|
|
34
|
+
return date;
|
|
35
|
+
}
|
|
36
|
+
static toNumber(value) {
|
|
37
|
+
if (value === void 0 || value === null) return void 0;
|
|
38
|
+
if (typeof value !== "number") throw new Error("{{value_must_be_a_number}}");
|
|
39
|
+
return value;
|
|
40
|
+
}
|
|
41
|
+
static clean(json) {
|
|
42
|
+
return deleteEmptyFields(json);
|
|
43
|
+
}
|
|
44
|
+
constructor(props) {
|
|
45
|
+
this._id = _BaseEntity.toObjectId(props._id);
|
|
46
|
+
this.__v = _BaseEntity.toNumber(props.__v);
|
|
47
|
+
this.ownerId = _BaseEntity.toObjectId(props.ownerId);
|
|
48
|
+
this.createdAt = _BaseEntity.toDate(props.createdAt);
|
|
49
|
+
this.createdBy = _BaseEntity.toObjectId(props.createdBy);
|
|
50
|
+
this.updatedAt = _BaseEntity.toDate(props.updatedAt);
|
|
51
|
+
this.updatedBy = _BaseEntity.toObjectId(props.updatedBy);
|
|
52
|
+
this.deletedAt = _BaseEntity.toDate(props.deletedAt);
|
|
53
|
+
this.deletedBy = _BaseEntity.toObjectId(props.deletedBy);
|
|
54
|
+
this.deletedReason = sanitizeString(props.deletedReason);
|
|
55
|
+
this.archivedAt = _BaseEntity.toDate(props.archivedAt);
|
|
56
|
+
this.archivedBy = _BaseEntity.toObjectId(props.archivedBy);
|
|
57
|
+
this.sharedWith = props.sharedWith?.length ? props.sharedWith.map((id) => _BaseEntity.toObjectId(id)) : void 0;
|
|
58
|
+
}
|
|
59
|
+
toJSON() {
|
|
60
|
+
return {
|
|
61
|
+
_id: this._id,
|
|
62
|
+
__v: this.__v,
|
|
63
|
+
ownerId: this.ownerId,
|
|
64
|
+
createdAt: this.createdAt,
|
|
65
|
+
createdBy: this.createdBy,
|
|
66
|
+
updatedAt: this.updatedAt,
|
|
67
|
+
updatedBy: this.updatedBy,
|
|
68
|
+
deletedAt: this.deletedAt,
|
|
69
|
+
deletedBy: this.deletedBy,
|
|
70
|
+
deletedReason: this.deletedReason,
|
|
71
|
+
archivedAt: this.archivedAt,
|
|
72
|
+
archivedBy: this.archivedBy,
|
|
73
|
+
sharedWith: this.sharedWith?.length ? this.sharedWith.map((id) => id.toHexString()) : void 0,
|
|
74
|
+
toUnset: this.toUnset
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
setDefaults() {
|
|
78
|
+
}
|
|
79
|
+
setId(id) {
|
|
80
|
+
this._id = _BaseEntity.toObjectId(id);
|
|
81
|
+
}
|
|
82
|
+
setOwner(currentUser) {
|
|
83
|
+
if (!currentUser) return;
|
|
84
|
+
this.ownerId = _BaseEntity.toObjectId(currentUser.userId);
|
|
85
|
+
}
|
|
86
|
+
setCreatedBy(currentUser) {
|
|
87
|
+
if (!currentUser) return;
|
|
88
|
+
this.sanitize(currentUser);
|
|
89
|
+
this.createdAt = /* @__PURE__ */ new Date();
|
|
90
|
+
this.createdBy = _BaseEntity.toObjectId(currentUser.userId);
|
|
91
|
+
this.setDefaults();
|
|
92
|
+
}
|
|
93
|
+
setUpdatedBy(currentUser) {
|
|
94
|
+
if (!currentUser) return;
|
|
95
|
+
this.sanitize(currentUser);
|
|
96
|
+
this.updatedAt = /* @__PURE__ */ new Date();
|
|
97
|
+
this.updatedBy = _BaseEntity.toObjectId(currentUser.userId);
|
|
98
|
+
}
|
|
99
|
+
setDeletedBy(currentUser) {
|
|
100
|
+
if (!currentUser) return;
|
|
101
|
+
this.sanitize(currentUser);
|
|
102
|
+
this.deletedAt = /* @__PURE__ */ new Date();
|
|
103
|
+
this.deletedBy = _BaseEntity.toObjectId(currentUser.userId);
|
|
104
|
+
}
|
|
105
|
+
setArchivedBy(currentUser) {
|
|
106
|
+
if (!currentUser) return;
|
|
107
|
+
this.sanitize(currentUser);
|
|
108
|
+
this.archivedAt = /* @__PURE__ */ new Date();
|
|
109
|
+
this.archivedBy = _BaseEntity.toObjectId(currentUser.userId);
|
|
110
|
+
}
|
|
111
|
+
toDocument() {
|
|
112
|
+
return deleteEmptyFields(this.toJSON());
|
|
113
|
+
}
|
|
114
|
+
toFlatDocument() {
|
|
115
|
+
const { toUnset, ...doc } = this.toDocument();
|
|
116
|
+
return { ...flattenObject(doc), toUnset };
|
|
117
|
+
}
|
|
118
|
+
stringify() {
|
|
119
|
+
return JSON.stringify(handleMaskInLogs(this), null, 2);
|
|
120
|
+
}
|
|
121
|
+
unset(fields) {
|
|
122
|
+
const toUnset = Array.from(new Set(fields.map((field) => String(field))));
|
|
123
|
+
if (!toUnset || !Array.isArray(toUnset)) return {};
|
|
124
|
+
this.toUnset = toUnset.reduce((acc, field) => {
|
|
125
|
+
acc[field] = "";
|
|
126
|
+
return acc;
|
|
127
|
+
}, {});
|
|
128
|
+
fields.forEach((field) => {
|
|
129
|
+
delete this[field];
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
sanitize(currentUser) {
|
|
133
|
+
if (!currentUser?.isAdmin()) {
|
|
134
|
+
for (const key in this) {
|
|
135
|
+
const isAdminOnly = Reflect.getMetadata("adminOnly", this.constructor.prototype, key);
|
|
136
|
+
if (isAdminOnly) {
|
|
137
|
+
delete this[key];
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
__decorateClass([
|
|
144
|
+
AdminOnly
|
|
145
|
+
], _BaseEntity.prototype, "__v", 2);
|
|
146
|
+
__decorateClass([
|
|
147
|
+
AdminOnly
|
|
148
|
+
], _BaseEntity.prototype, "ownerId", 2);
|
|
149
|
+
__decorateClass([
|
|
150
|
+
AdminOnly
|
|
151
|
+
], _BaseEntity.prototype, "createdAt", 2);
|
|
152
|
+
__decorateClass([
|
|
153
|
+
AdminOnly
|
|
154
|
+
], _BaseEntity.prototype, "createdBy", 2);
|
|
155
|
+
__decorateClass([
|
|
156
|
+
AdminOnly
|
|
157
|
+
], _BaseEntity.prototype, "updatedAt", 2);
|
|
158
|
+
__decorateClass([
|
|
159
|
+
AdminOnly
|
|
160
|
+
], _BaseEntity.prototype, "updatedBy", 2);
|
|
161
|
+
__decorateClass([
|
|
162
|
+
AdminOnly
|
|
163
|
+
], _BaseEntity.prototype, "deletedAt", 2);
|
|
164
|
+
__decorateClass([
|
|
165
|
+
AdminOnly
|
|
166
|
+
], _BaseEntity.prototype, "deletedBy", 2);
|
|
167
|
+
__decorateClass([
|
|
168
|
+
AdminOnly
|
|
169
|
+
], _BaseEntity.prototype, "archivedAt", 2);
|
|
170
|
+
__decorateClass([
|
|
171
|
+
AdminOnly
|
|
172
|
+
], _BaseEntity.prototype, "archivedBy", 2);
|
|
173
|
+
__decorateClass([
|
|
174
|
+
OwnerOnly
|
|
175
|
+
], _BaseEntity.prototype, "sharedWith", 2);
|
|
176
|
+
let BaseEntity = _BaseEntity;
|
|
177
|
+
export {
|
|
178
|
+
BaseEntity
|
|
179
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var base_use_case_exports = {};
|
|
20
|
+
__export(base_use_case_exports, {
|
|
21
|
+
BaseUseCase: () => BaseUseCase
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(base_use_case_exports);
|
|
24
|
+
var import_base = require("./base.app");
|
|
25
|
+
class BaseUseCase extends import_base.BaseApp {
|
|
26
|
+
}
|
|
27
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
28
|
+
0 && (module.exports = {
|
|
29
|
+
BaseUseCase
|
|
30
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
File without changes
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var delete_empty_fields_exports = {};
|
|
20
|
+
__export(delete_empty_fields_exports, {
|
|
21
|
+
deleteEmptyFields: () => deleteEmptyFields
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(delete_empty_fields_exports);
|
|
24
|
+
var import_is_plain_object = require("./is-plain-object");
|
|
25
|
+
function safeClone(value) {
|
|
26
|
+
if (Array.isArray(value)) {
|
|
27
|
+
return value.map(safeClone);
|
|
28
|
+
}
|
|
29
|
+
if ((0, import_is_plain_object.isPlainObject)(value)) {
|
|
30
|
+
const result = {};
|
|
31
|
+
for (const key of Object.keys(value)) {
|
|
32
|
+
result[key] = safeClone(value[key]);
|
|
33
|
+
}
|
|
34
|
+
return result;
|
|
35
|
+
}
|
|
36
|
+
return value;
|
|
37
|
+
}
|
|
38
|
+
function deleteEmptyFields(object) {
|
|
39
|
+
const cleanObject = (obj) => {
|
|
40
|
+
if (Array.isArray(obj)) {
|
|
41
|
+
obj.forEach(cleanObject);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
if (!(0, import_is_plain_object.isPlainObject)(obj)) return;
|
|
45
|
+
Object.keys(obj).forEach((key) => {
|
|
46
|
+
const value = obj[key];
|
|
47
|
+
if (Array.isArray(value)) {
|
|
48
|
+
cleanObject(value);
|
|
49
|
+
} else if ((0, import_is_plain_object.isPlainObject)(value)) {
|
|
50
|
+
cleanObject(value);
|
|
51
|
+
if (Object.keys(value).length === 0) {
|
|
52
|
+
delete obj[key];
|
|
53
|
+
}
|
|
54
|
+
} else if (value === void 0 || value === null) {
|
|
55
|
+
delete obj[key];
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
const clonedObject = safeClone(object);
|
|
60
|
+
cleanObject(clonedObject);
|
|
61
|
+
return clonedObject;
|
|
62
|
+
}
|
|
63
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
64
|
+
0 && (module.exports = {
|
|
65
|
+
deleteEmptyFields
|
|
66
|
+
});
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import "../../../chunk-XRJFNASX.mjs";
|
|
2
|
+
import { isPlainObject } from "./is-plain-object";
|
|
3
|
+
function safeClone(value) {
|
|
4
|
+
if (Array.isArray(value)) {
|
|
5
|
+
return value.map(safeClone);
|
|
6
|
+
}
|
|
7
|
+
if (isPlainObject(value)) {
|
|
8
|
+
const result = {};
|
|
9
|
+
for (const key of Object.keys(value)) {
|
|
10
|
+
result[key] = safeClone(value[key]);
|
|
11
|
+
}
|
|
12
|
+
return result;
|
|
13
|
+
}
|
|
14
|
+
return value;
|
|
15
|
+
}
|
|
16
|
+
function deleteEmptyFields(object) {
|
|
17
|
+
const cleanObject = (obj) => {
|
|
18
|
+
if (Array.isArray(obj)) {
|
|
19
|
+
obj.forEach(cleanObject);
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
if (!isPlainObject(obj)) return;
|
|
23
|
+
Object.keys(obj).forEach((key) => {
|
|
24
|
+
const value = obj[key];
|
|
25
|
+
if (Array.isArray(value)) {
|
|
26
|
+
cleanObject(value);
|
|
27
|
+
} else if (isPlainObject(value)) {
|
|
28
|
+
cleanObject(value);
|
|
29
|
+
if (Object.keys(value).length === 0) {
|
|
30
|
+
delete obj[key];
|
|
31
|
+
}
|
|
32
|
+
} else if (value === void 0 || value === null) {
|
|
33
|
+
delete obj[key];
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
const clonedObject = safeClone(object);
|
|
38
|
+
cleanObject(clonedObject);
|
|
39
|
+
return clonedObject;
|
|
40
|
+
}
|
|
41
|
+
export {
|
|
42
|
+
deleteEmptyFields
|
|
43
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var flatten_object_exports = {};
|
|
20
|
+
__export(flatten_object_exports, {
|
|
21
|
+
flattenObject: () => flattenObject
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(flatten_object_exports);
|
|
24
|
+
var import_is_plain_object = require("./is-plain-object");
|
|
25
|
+
function flattenObject(obj, parentKey = "", result = {}) {
|
|
26
|
+
if (!(0, import_is_plain_object.isPlainObject)(obj)) {
|
|
27
|
+
return {};
|
|
28
|
+
}
|
|
29
|
+
for (let key in obj) {
|
|
30
|
+
if (obj.hasOwnProperty(key)) {
|
|
31
|
+
const newKey = parentKey ? `${parentKey}.${key}` : key;
|
|
32
|
+
const value = obj[key];
|
|
33
|
+
if ((0, import_is_plain_object.isPlainObject)(value)) {
|
|
34
|
+
flattenObject(value, newKey, result);
|
|
35
|
+
} else {
|
|
36
|
+
result[newKey] = value;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return result;
|
|
41
|
+
}
|
|
42
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
43
|
+
0 && (module.exports = {
|
|
44
|
+
flattenObject
|
|
45
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import "../../../chunk-XRJFNASX.mjs";
|
|
2
|
+
import { isPlainObject } from "./is-plain-object";
|
|
3
|
+
function flattenObject(obj, parentKey = "", result = {}) {
|
|
4
|
+
if (!isPlainObject(obj)) {
|
|
5
|
+
return {};
|
|
6
|
+
}
|
|
7
|
+
for (let key in obj) {
|
|
8
|
+
if (obj.hasOwnProperty(key)) {
|
|
9
|
+
const newKey = parentKey ? `${parentKey}.${key}` : key;
|
|
10
|
+
const value = obj[key];
|
|
11
|
+
if (isPlainObject(value)) {
|
|
12
|
+
flattenObject(value, newKey, result);
|
|
13
|
+
} else {
|
|
14
|
+
result[newKey] = value;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return result;
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
flattenObject
|
|
22
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
|
+
var utils_exports = {};
|
|
17
|
+
module.exports = __toCommonJS(utils_exports);
|
|
18
|
+
__reExport(utils_exports, require("./delete-empty-fields"), module.exports);
|
|
19
|
+
__reExport(utils_exports, require("./is-plain-object"), module.exports);
|
|
20
|
+
__reExport(utils_exports, require("./flatten-object"), module.exports);
|
|
21
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
22
|
+
0 && (module.exports = {
|
|
23
|
+
...require("./delete-empty-fields"),
|
|
24
|
+
...require("./is-plain-object"),
|
|
25
|
+
...require("./flatten-object")
|
|
26
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var is_plain_object_exports = {};
|
|
20
|
+
__export(is_plain_object_exports, {
|
|
21
|
+
isPlainObject: () => isPlainObject
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(is_plain_object_exports);
|
|
24
|
+
function isPlainObject(value) {
|
|
25
|
+
if (typeof value !== "object" || value === null) return false;
|
|
26
|
+
const proto = Object.getPrototypeOf(value);
|
|
27
|
+
return proto === null || proto === Object.prototype;
|
|
28
|
+
}
|
|
29
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
30
|
+
0 && (module.exports = {
|
|
31
|
+
isPlainObject
|
|
32
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import "../../../chunk-XRJFNASX.mjs";
|
|
2
|
+
function isPlainObject(value) {
|
|
3
|
+
if (typeof value !== "object" || value === null) return false;
|
|
4
|
+
const proto = Object.getPrototypeOf(value);
|
|
5
|
+
return proto === null || proto === Object.prototype;
|
|
6
|
+
}
|
|
7
|
+
export {
|
|
8
|
+
isPlainObject
|
|
9
|
+
};
|