@futdevpro/nts-dynamo 1.15.142 → 1.15.145
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/.c8rc.json +26 -26
- package/.copilot/patterns.json +7 -7
- package/.cursor/rules/__assistant_guide.mdc +30 -30
- package/.cursor/rules/_ag_backend-structure.mdc +85 -85
- package/.cursor/rules/_ag_backend.mdc +16 -16
- package/.cursor/rules/_ag_frontend-structure.mdc +86 -86
- package/.cursor/rules/_ag_frontend.mdc +39 -39
- package/.cursor/rules/_ag_import-rules.mdc +44 -44
- package/.cursor/rules/_ag_naming.mdc +115 -115
- package/.cursor/rules/_ag_should-be.mdc +6 -6
- package/.cursor/rules/ai_development_guide.md +60 -60
- package/.cursor/rules/cursor-rules.md +160 -160
- package/.cursor/rules/default-command.mdc +464 -464
- package/.cursor/rules/error_code_pattern.md +39 -39
- package/.cursor/rules/saved rule mcp server use.md +15 -15
- package/.dynamo/logs/cicd-pipeline/output.log +3034 -0
- package/.dynamo/logs/cicd-pipeline/status.json +74 -0
- package/.vscode/settings.json +10 -10
- package/HOWTO.md +15 -15
- package/LICENSE +21 -21
- package/__documentations/2026-08-18-artifact-compiler.md +46 -0
- package/__documentations/nts-integration-tests-2026-03-17.md +26 -26
- package/__documentations/plans/BEDROCK-HYPERPLAN.md +95 -95
- package/_specifications/BACKLOG.md +92 -92
- package/_specifications/TODO.md +15 -15
- package/_specifications/agent.md +138 -138
- package/build/_modules/artifact-compiler/_enums/artifact-compile-outcome.type-enum.d.ts +6 -0
- package/build/_modules/artifact-compiler/_enums/artifact-compile-outcome.type-enum.d.ts.map +1 -0
- package/build/_modules/artifact-compiler/_enums/artifact-compile-outcome.type-enum.js +10 -0
- package/build/_modules/artifact-compiler/_enums/artifact-compile-outcome.type-enum.js.map +1 -0
- package/build/_modules/artifact-compiler/_enums/artifact-compile-stage.type-enum.d.ts +9 -0
- package/build/_modules/artifact-compiler/_enums/artifact-compile-stage.type-enum.d.ts.map +1 -0
- package/build/_modules/artifact-compiler/_enums/artifact-compile-stage.type-enum.js +13 -0
- package/build/_modules/artifact-compiler/_enums/artifact-compile-stage.type-enum.js.map +1 -0
- package/build/_modules/artifact-compiler/_enums/artifact-retry-class.type-enum.d.ts +7 -0
- package/build/_modules/artifact-compiler/_enums/artifact-retry-class.type-enum.d.ts.map +1 -0
- package/build/_modules/artifact-compiler/_enums/artifact-retry-class.type-enum.js +11 -0
- package/build/_modules/artifact-compiler/_enums/artifact-retry-class.type-enum.js.map +1 -0
- package/build/_modules/artifact-compiler/_models/artifact-compile.interface.d.ts +33 -0
- package/build/_modules/artifact-compiler/_models/artifact-compile.interface.d.ts.map +1 -0
- package/build/_modules/artifact-compiler/_models/artifact-compile.interface.js +3 -0
- package/build/_modules/artifact-compiler/_models/artifact-compile.interface.js.map +1 -0
- package/build/_modules/artifact-compiler/artifact-compiler.control-service.d.ts +37 -0
- package/build/_modules/artifact-compiler/artifact-compiler.control-service.d.ts.map +1 -0
- package/build/_modules/artifact-compiler/artifact-compiler.control-service.js +274 -0
- package/build/_modules/artifact-compiler/artifact-compiler.control-service.js.map +1 -0
- package/build/_modules/artifact-compiler/index.d.ts +6 -0
- package/build/_modules/artifact-compiler/index.d.ts.map +1 -0
- package/build/_modules/artifact-compiler/index.js +12 -0
- package/build/_modules/artifact-compiler/index.js.map +1 -0
- package/build/_services/core/collection-growth-monitor.service.d.ts +1 -1
- package/build/_services/core/collection-growth-monitor.service.d.ts.map +1 -1
- package/build/_services/core/collection-growth-monitor.service.js +24 -5
- package/build/_services/core/collection-growth-monitor.service.js.map +1 -1
- package/eslint.config.js +3 -3
- package/nodemon.json +24 -24
- package/package.json +15 -2
- package/pnpm-workspace.yaml +6 -5
- package/scripts/run-coverage-tests.js +28 -28
- package/spec/support/helpers/spec-reporter-loader.js +359 -359
- package/spec/support/helpers/ts-node-helper.js +93 -93
- package/spec/support/jasmine.coverage.json +24 -24
- package/spec/support/jasmine.json +24 -24
- package/src/_collections/archive.util.spec.ts +57 -57
- package/src/_collections/archive.util.ts +18 -18
- package/src/_collections/atlas-default-db-options.const.ts +9 -9
- package/src/_collections/default-fallback-cache-max-age.const.spec.ts +11 -11
- package/src/_collections/default-fallback-cache-max-age.const.ts +2 -2
- package/src/_collections/default-not-found-page.const.spec.ts +19 -19
- package/src/_collections/default-not-found-page.const.ts +22 -22
- package/src/_collections/default-socket-path.const.spec.ts +12 -12
- package/src/_collections/default-socket-path.const.ts +2 -2
- package/src/_collections/get-environment-settings.util.spec.ts +210 -210
- package/src/_collections/get-environment-settings.util.ts +48 -48
- package/src/_collections/global-settings.const.ts +126 -126
- package/src/_collections/sample.env +21 -21
- package/src/_collections/signed-url.util.spec.ts +198 -198
- package/src/_collections/signed-url.util.ts +170 -170
- package/src/_collections/star.controller.spec.ts +224 -224
- package/src/_collections/star.controller.ts +129 -129
- package/src/_enums/data-model-type.enum.ts +14 -14
- package/src/_enums/data-service-function.enum.ts +24 -24
- package/src/_enums/predefined-data-types.enum.ts +16 -16
- package/src/_enums/route-security.enum.ts +12 -12
- package/src/_models/control-models/api-call-params.control-model.spec.ts +152 -152
- package/src/_models/control-models/api-call-params.control-model.ts +142 -142
- package/src/_models/control-models/app-ext-system-controls.control-model.spec.ts +52 -52
- package/src/_models/control-models/app-ext-system-controls.control-model.ts +9 -9
- package/src/_models/control-models/app-params.control-model.spec.ts +225 -225
- package/src/_models/control-models/app-params.control-model.ts +136 -136
- package/src/_models/control-models/app-system-controls.control-model.spec.ts +31 -31
- package/src/_models/control-models/app-system-controls.control-model.ts +9 -9
- package/src/_models/control-models/endpoint-params.control-model.spec.ts +669 -669
- package/src/_models/control-models/endpoint-params.control-model.ts +664 -664
- package/src/_models/control-models/http-settings.control-model.spec.ts +77 -77
- package/src/_models/control-models/http-settings.control-model.ts +37 -37
- package/src/_models/control-models/system-control.control-model.spec.ts +27 -27
- package/src/_models/control-models/system-control.control-model.ts +12 -12
- package/src/_models/interfaces/certification-settings.interface.ts +7 -7
- package/src/_models/interfaces/environment-settings.interface.ts +59 -59
- package/src/_models/interfaces/global-log-settings.interface.ts +171 -171
- package/src/_models/interfaces/global-service-settings.interface.ts +47 -47
- package/src/_models/interfaces/global-settings.interface.ts +294 -294
- package/src/_models/interfaces/routing-module-settings.interface.ts +21 -21
- package/src/_models/interfaces/static-client-settings.interface.spec.ts +29 -29
- package/src/_models/interfaces/static-client-settings.interface.ts +36 -36
- package/src/_models/types/db-update.type.ts +100 -100
- package/src/_modules/ai/_models/ai-input-interfaces.ts +117 -117
- package/src/_modules/ai/_models/ai-test-generation-result.interface.ts +16 -16
- package/src/_modules/ai/_modules/ai-mock/_services/ai-embedding-mock.service.spec.ts +115 -115
- package/src/_modules/ai/_modules/ai-mock/_services/ai-embedding-mock.service.ts +233 -233
- package/src/_modules/ai/_modules/anthropic/_services/aai-user-key.control-service.ts +138 -138
- package/src/_modules/ai/_modules/anthropic/index.ts +5 -5
- package/src/_modules/ai/_modules/document-ai/_collections/dai-chunking.util.spec.ts +242 -242
- package/src/_modules/ai/_modules/document-ai/_collections/dai-chunking.util.ts +639 -639
- package/src/_modules/ai/_modules/document-ai/_collections/dai-code-chunking.util.spec.ts +295 -295
- package/src/_modules/ai/_modules/document-ai/_collections/dai-code-chunking.util.ts +518 -518
- package/src/_modules/ai/_modules/document-ai/_collections/dai-document.util.spec.ts +209 -209
- package/src/_modules/ai/_modules/document-ai/_collections/dai-document.util.ts +85 -85
- package/src/_modules/ai/_modules/document-ai/_enums/dai-compare-result-type.enum.ts +7 -7
- package/src/_modules/ai/_modules/document-ai/_models/data-models/dai-doc-chunk.data-model.ts +146 -146
- package/src/_modules/ai/_modules/document-ai/_models/data-models/dai-doc-page.data-model.ts +162 -162
- package/src/_modules/ai/_modules/document-ai/_models/data-models/dai-document.data-model.ts +99 -99
- package/src/_modules/ai/_modules/document-ai/_models/interfaces/dai-code-chunk.interface.ts +68 -68
- package/src/_modules/ai/_modules/document-ai/_models/interfaces/dai-doc-chunk-compare-result.interface.ts +18 -18
- package/src/_modules/ai/_modules/document-ai/_models/interfaces/dai-doc-page-compare-result.interface.ts +19 -19
- package/src/_modules/ai/_modules/document-ai/_models/interfaces/dai-document-compare-result.interface.ts +25 -25
- package/src/_modules/ai/_modules/document-ai/index.ts +30 -30
- package/src/_modules/ai/_modules/fdp-ai/_services/fdpai-user-key.control-service.ts +189 -189
- package/src/_modules/ai/_modules/fdp-ai/index.ts +5 -5
- package/src/_modules/ai/_modules/open-ai/_collections/oai-global-settings.const.ts +9 -9
- package/src/_modules/ai/_modules/open-ai/_collections/oai-llm-predefined-requests-hu.conts.ts +82 -82
- package/src/_modules/ai/_modules/open-ai/_collections/oai-llm-predefined-requests.conts.ts +75 -75
- package/src/_modules/ai/_modules/open-ai/_enums/oai-gpt-message-role.enum.ts +45 -45
- package/src/_modules/ai/_modules/open-ai/_models/interfaces/oai-global-settings.interface.ts +7 -7
- package/src/_modules/ai/_modules/open-ai/_models/interfaces/oai-gpt-message.interface.ts +7 -7
- package/src/_modules/ai/_modules/open-ai/_models/interfaces/oai-llm-predefined-requests.interface.ts +57 -57
- package/src/_modules/ai/_modules/open-ai/_services/data-services/oai-doc-chunk-data.service.ts +292 -292
- package/src/_modules/ai/_modules/open-ai/_services/data-services/oai-document.data-service.spec.ts +342 -342
- package/src/_modules/ai/_modules/open-ai/_services/data-services/oai-vector-data.service.spec.ts +550 -550
- package/src/_modules/ai/_modules/open-ai/_services/data-services/oai-vector-data.service.ts +630 -630
- package/src/_modules/ai/_modules/open-ai/_services/oai-embedding.control-service.spec.ts +332 -332
- package/src/_modules/ai/_modules/open-ai/_services/oai-llm-chat.service-base.spec.ts +462 -462
- package/src/_modules/ai/_modules/open-ai/_services/oai-llm-chat.service-base.ts +634 -634
- package/src/_modules/ai/_modules/open-ai/_services/oai-llm.service-base.spec.ts +489 -489
- package/src/_modules/ai/_modules/open-ai/_services/oai-llm.service-base.tools.spec.ts +173 -173
- package/src/_modules/ai/_modules/open-ai/_services/oai-llm.service-base.ts +1085 -1085
- package/src/_modules/ai/_modules/open-ai/_services/oai-user-key.control-service.ts +157 -157
- package/src/_modules/ai/_services/ai-embedding-provider.registry.spec.ts +110 -110
- package/src/_modules/ai/_services/ai-embedding-provider.registry.ts +114 -114
- package/src/_modules/ai/_services/ai-embedding.service-base.spec.ts +98 -98
- package/src/_modules/ai/_services/ai-embedding.service-base.ts +48 -48
- package/src/_modules/ai/_services/ai-llm-chat.service-base.spec.ts +229 -229
- package/src/_modules/ai/_services/ai-llm-chat.service-base.ts +68 -68
- package/src/_modules/ai/_services/ai-llm.service-base.spec.ts +250 -250
- package/src/_modules/ai/_services/ai-llm.service-base.ts +599 -599
- package/src/_modules/ai/_services/ai-provider.service-base.spec.ts +158 -158
- package/src/_modules/ai/_services/ai-user-key.service-base.ts +59 -59
- package/src/_modules/ai/_services/lmstudio-embedding.control-service.spec.ts +197 -197
- package/src/_modules/ai/_services/lmstudio-embedding.control-service.ts +371 -371
- package/src/_modules/ai/index.ts +33 -33
- package/src/_modules/artifact-compiler/_enums/artifact-compile-outcome.type-enum.ts +5 -0
- package/src/_modules/artifact-compiler/_enums/artifact-compile-stage.type-enum.ts +8 -0
- package/src/_modules/artifact-compiler/_enums/artifact-retry-class.type-enum.ts +6 -0
- package/src/_modules/artifact-compiler/_models/artifact-compile.interface.ts +35 -0
- package/src/_modules/artifact-compiler/artifact-compiler.control-service.spec.ts +151 -0
- package/src/_modules/artifact-compiler/artifact-compiler.control-service.ts +356 -0
- package/src/_modules/artifact-compiler/index.ts +9 -0
- package/src/_modules/assistant/_collections/ass-global-settings.const.ts +13 -13
- package/src/_modules/assistant/_collections/ass.util.spec.ts +176 -176
- package/src/_modules/assistant/_collections/ass.util.ts +50 -50
- package/src/_modules/assistant/_models/ass-global-settings.interface.ts +15 -15
- package/src/_modules/assistant/_services/ass-io.control-service.spec.ts +140 -140
- package/src/_modules/assistant/_services/ass-main.control-service.spec.ts +192 -192
- package/src/_modules/assistant/_services/ass-main.control-service.ts +107 -107
- package/src/_modules/bot/_collections/bot-default-commands.const.ts +12 -12
- package/src/_modules/bot/_collections/bot-global-settings.const.ts +39 -39
- package/src/_modules/bot/_models/bot-channel-wrapper.interface.ts +62 -62
- package/src/_modules/bot/_models/bot-command.interface.ts +8 -8
- package/src/_modules/bot/_models/bot-global-settings.interface.ts +96 -96
- package/src/_modules/bot/_models/bot-last-mention-date.interface.ts +6 -6
- package/src/_modules/bot/_models/bot-last-message-date.interface.ts +5 -5
- package/src/_modules/bot/_models/bot-user-wrapper.interface.ts +41 -41
- package/src/_modules/bot/_modules/discord-bot/_models/dib-platform.types.ts +9 -9
- package/src/_modules/bot/_modules/discord-bot/_services/dib-messaging-provider.control-service.spec.ts +431 -431
- package/src/_modules/bot/_modules/dynamo-bot/_collections/dyb-operations.util.spec.ts +160 -160
- package/src/_modules/bot/_modules/dynamo-bot/_collections/dyb-operations.util.ts +55 -55
- package/src/_modules/bot/_modules/dynamo-bot/_models/dyb-platform.types.ts +15 -15
- package/src/_modules/bot/_modules/dynamo-bot/_services/dyb-messaging-provider.control-service.spec.ts +374 -374
- package/src/_modules/bot/_modules/dynamo-bot/_services/dyb-messaging-provider.control-service.ts +447 -447
- package/src/_modules/bot/_modules/dynamo-bot/index.ts +15 -15
- package/src/_modules/bot/_modules/slack-bot/_models/slb-platform.types.ts +9 -9
- package/src/_modules/bot/_modules/slack-bot/_services/slb-messaging-provider.control-service.spec.ts +344 -344
- package/src/_modules/bot/_modules/slack-bot/_services/slb-messaging-provider.control-service.ts +197 -197
- package/src/_modules/bot/_modules/teams-bot/_models/teb-platform.types.ts +9 -9
- package/src/_modules/bot/_modules/teams-bot/_services/teb-messaging-provider.control-service.spec.ts +345 -345
- package/src/_modules/bot/_modules/teams-bot/_services/teb-messaging-provider.control-service.ts +197 -197
- package/src/_modules/bot/_services/bot-commands.control-service.spec.ts +116 -116
- package/src/_modules/bot/_services/bot-io.control-service.spec.ts +285 -285
- package/src/_modules/bot/_services/bot-main.control-service.spec.ts +208 -208
- package/src/_modules/bot/_services/bot-messaging-provider.service-base.spec.ts +349 -349
- package/src/_modules/bot/_services/bot-routines.control-service.spec.ts +111 -111
- package/src/_modules/custom-data/custom-data.controller.spec.ts +49 -49
- package/src/_modules/custom-data/custom-data.controller.ts +67 -67
- package/src/_modules/custom-data/custom-data.data-service.spec.ts +54 -54
- package/src/_modules/custom-data/custom-data.data-service.ts +21 -21
- package/src/_modules/custom-data/get-custom-data-routing-module.util.spec.ts +28 -28
- package/src/_modules/custom-data/get-custom-data-routing-module.util.ts +24 -24
- package/src/_modules/custom-data/index.ts +9 -9
- package/src/_modules/data-readers/_collections/dynts-sqlite-reader.util.spec.ts +161 -161
- package/src/_modules/data-readers/_collections/dynts-sqlite-reader.util.ts +203 -203
- package/src/_modules/data-readers/_models/interfaces/dynts-sqlite-reader.interface.ts +33 -33
- package/src/_modules/data-readers/index.ts +11 -11
- package/src/_modules/defaults/_collections/default-endpoints.util.ts +487 -487
- package/src/_modules/defaults/_models/default-user.data-model.ts +72 -72
- package/src/_modules/defaults/_services/default-auth.service.spec.ts +269 -269
- package/src/_modules/defaults/_services/default-auth.service.ts +177 -177
- package/src/_modules/defaults/_services/default-socket-events.service.spec.ts +42 -42
- package/src/_modules/defaults/_services/default-socket-events.service.ts +61 -61
- package/src/_modules/defaults/_services/default-user.data-service.spec.ts +187 -187
- package/src/_modules/defaults/_services/default-user.data-service.ts +98 -98
- package/src/_modules/defaults/index.ts +17 -17
- package/src/_modules/discord-assistant/_collections/dias-global-settings.const.ts +19 -19
- package/src/_modules/discord-assistant/_collections/dias.util.spec.ts +366 -366
- package/src/_modules/discord-assistant/_collections/dias.util.ts +132 -132
- package/src/_modules/discord-assistant/_models/dias-global-settings.interface.ts +19 -19
- package/src/_modules/discord-assistant/_models/dias-knowledge.data-model.ts +52 -52
- package/src/_modules/discord-assistant/_services/dias-chunk.data-service.ts +177 -177
- package/src/_modules/discord-assistant/_services/dias-io.control-service.spec.ts +108 -108
- package/src/_modules/discord-assistant/_services/dias-io.control-service.ts +69 -69
- package/src/_modules/discord-assistant/_services/dias-main.control-service.spec.ts +22 -22
- package/src/_modules/discord-assistant/_services/dias-main.control-service.ts +27 -27
- package/src/_modules/discord-assistant/_services/dias.service-base.spec.ts +195 -195
- package/src/_modules/discord-assistant/_services/dias.service-base.ts +76 -76
- package/src/_modules/discord-assistant/index.ts +38 -38
- package/src/_modules/discord-assistant-voiced/_services/dias-discord-bot.control-service.spec.ts +34 -34
- package/src/_modules/discord-assistant-voiced/_services/dias-discord-bot.control-service.ts +11 -11
- package/src/_modules/discord-assistant-voiced/index.ts +36 -36
- package/src/_modules/discord-bot/_collections/dibo-default-commands.const.ts +16 -16
- package/src/_modules/discord-bot/_collections/dibo-global-settings.conts.ts +55 -55
- package/src/_modules/discord-bot/_collections/dibo-operations.util.spec.ts +214 -214
- package/src/_modules/discord-bot/_collections/dibo-operations.util.ts +387 -387
- package/src/_modules/discord-bot/_models/dibo-command.interface.ts +12 -12
- package/src/_modules/discord-bot/_models/dibo-global-settings.interface.ts +98 -98
- package/src/_modules/discord-bot/_models/dibo-last-mention-date.inteface.ts +7 -7
- package/src/_modules/discord-bot/_models/dibo-last-message-date.interface.ts +6 -6
- package/src/_modules/discord-bot/_services/dibo-commands.control-service.spec.ts +154 -154
- package/src/_modules/discord-bot/_services/dibo-commands.control-service.ts +153 -153
- package/src/_modules/discord-bot/_services/dibo-io.control-service.spec.ts +264 -264
- package/src/_modules/discord-bot/_services/dibo-io.control-service.ts +306 -306
- package/src/_modules/discord-bot/_services/dibo-main.control-service.spec.ts +408 -408
- package/src/_modules/discord-bot/_services/dibo-main.control-service.ts +487 -487
- package/src/_modules/discord-bot/_services/dibo-routines.control-service.spec.ts +105 -105
- package/src/_modules/discord-bot/index.ts +36 -36
- package/src/_modules/local-vector-search/_enums/lvs-search-mode.enum.ts +35 -35
- package/src/_modules/local-vector-search/_models/data-models/lvs-vector-persist.data-model.ts +59 -59
- package/src/_modules/local-vector-search/_models/lvs-search-result.interface.ts +17 -17
- package/src/_modules/local-vector-search/_services/lvs-doc-chunk-data.service.spec.ts +418 -418
- package/src/_modules/local-vector-search/_services/lvs-doc-chunk-data.service.ts +276 -276
- package/src/_modules/local-vector-search/_services/lvs-local-vector-search.data-service.spec.ts +480 -480
- package/src/_modules/local-vector-search/_services/lvs-local-vector-search.data-service.ts +416 -416
- package/src/_modules/local-vector-search/_services/lvs-persistent-vector-pool.control-service.spec.ts +214 -214
- package/src/_modules/local-vector-search/_services/lvs-persistent-vector-pool.control-service.ts +186 -186
- package/src/_modules/local-vector-search/_services/lvs-vector-persist.data-service.spec.ts +167 -167
- package/src/_modules/local-vector-search/_services/lvs-vector-persist.data-service.ts +130 -130
- package/src/_modules/local-vector-search/_services/lvs-vector-pool.control-service.spec.ts +509 -509
- package/src/_modules/local-vector-search/_services/lvs-vector-pool.control-service.ts +323 -323
- package/src/_modules/local-vector-search/index.ts +16 -16
- package/src/_modules/logs/index.ts +11 -11
- package/src/_modules/mcp/_models/interfaces/dynts-mcp.interface.ts +111 -111
- package/src/_modules/mcp/_services/dynts-mcp-server.service-base.spec.ts +142 -142
- package/src/_modules/mcp/_services/dynts-mcp-server.service-base.ts +120 -120
- package/src/_modules/mcp/_services/dynts-mcp.adapter.ts +168 -168
- package/src/_modules/mcp/index.ts +13 -13
- package/src/_modules/messaging/README.md +354 -354
- package/src/_modules/messaging/_collections/get-messaging-routing-module.util.ts +26 -26
- package/src/_modules/messaging/_collections/msg-global-settings.const.ts +22 -22
- package/src/_modules/messaging/_collections/msg.util.spec.ts +226 -226
- package/src/_modules/messaging/_models/msg-global-settings.interface.ts +37 -37
- package/src/_modules/messaging/_services/msg-conversation.data-service.ts +146 -146
- package/src/_modules/messaging/_services/msg-events.service.spec.ts +219 -219
- package/src/_modules/messaging/_services/msg-events.service.ts +267 -267
- package/src/_modules/messaging/_services/msg-integration.control-service.ts +179 -179
- package/src/_modules/messaging/_services/msg-main.control-service.spec.ts +147 -147
- package/src/_modules/messaging/_services/msg-main.control-service.ts +571 -571
- package/src/_modules/messaging/_services/msg-message.data-service.ts +129 -129
- package/src/_modules/messaging/_services/msg.controller.spec.ts +201 -201
- package/src/_modules/messaging/index.ts +30 -30
- package/src/_modules/mock/app-extended-server.mock.ts +201 -201
- package/src/_modules/mock/app-integration-test.mock.ts +51 -51
- package/src/_modules/mock/app-params.mock.spec.ts +21 -21
- package/src/_modules/mock/app-params.mock.ts +9 -9
- package/src/_modules/mock/app-server.mock.ts +188 -188
- package/src/_modules/mock/auth-service.mock.spec.ts +47 -47
- package/src/_modules/mock/auth-service.mock.ts +28 -28
- package/src/_modules/mock/controller.mock.spec.ts +26 -26
- package/src/_modules/mock/controller.mock.ts +16 -16
- package/src/_modules/mock/data-model.mock.spec.ts +111 -111
- package/src/_modules/mock/data-model.mock.ts +82 -82
- package/src/_modules/mock/email-service-collection.mock.spec.ts +24 -24
- package/src/_modules/mock/email-service-collection.mock.ts +15 -15
- package/src/_modules/mock/email-service.mock.spec.ts +17 -17
- package/src/_modules/mock/email-service.mock.ts +20 -20
- package/src/_modules/mock/email-template.mock.html +14 -14
- package/src/_modules/mock/endpoint.mock.ts +91 -91
- package/src/_modules/mock/socket-client.mock.spec.ts +40 -40
- package/src/_modules/mock/socket-client.mock.ts +45 -45
- package/src/_modules/mock/socket-server.mock.spec.ts +44 -44
- package/src/_modules/mock/socket-server.mock.ts +46 -46
- package/src/_modules/oauth2/_routes/oauth2.controller.spec.ts +107 -107
- package/src/_modules/oauth2/_routes/oauth2.controller.ts +98 -98
- package/src/_modules/oauth2/_services/oauth2.auth-service.spec.ts +254 -254
- package/src/_modules/oauth2/_services/oauth2.auth-service.ts +232 -232
- package/src/_modules/oauth2/_services/oauth2.control-service.spec.ts +585 -585
- package/src/_modules/oauth2/_services/oauth2.control-service.ts +653 -653
- package/src/_modules/oauth2/index.ts +17 -17
- package/src/_modules/scheduler/_models/scheduler-job.interface.ts +35 -35
- package/src/_modules/scheduler/get-scheduler-routing-module.util.ts +33 -33
- package/src/_modules/scheduler/index.ts +8 -8
- package/src/_modules/scheduler/scheduler.controller.spec.ts +42 -42
- package/src/_modules/scheduler/scheduler.controller.ts +69 -69
- package/src/_modules/scheduler/scheduler.service.spec.ts +141 -141
- package/src/_modules/scheduler/scheduler.service.ts +176 -176
- package/src/_modules/scoped-config/_enums/dynts-scoped-config-level.enum.ts +22 -22
- package/src/_modules/scoped-config/_models/data-models/dynts-scoped-config.data-model.ts +81 -81
- package/src/_modules/scoped-config/_models/interfaces/dynts-scoped-config.interface.ts +107 -107
- package/src/_modules/scoped-config/_services/dynts-scoped-config.control-service.spec.ts +306 -306
- package/src/_modules/scoped-config/_services/dynts-scoped-config.control-service.ts +295 -295
- package/src/_modules/scoped-config/_services/dynts-scoped-config.data-service.spec.ts +118 -118
- package/src/_modules/scoped-config/_services/dynts-scoped-config.data-service.ts +105 -105
- package/src/_modules/scoped-config/index.ts +17 -17
- package/src/_modules/server/errors/errors.control-service.spec.ts +238 -238
- package/src/_modules/server/errors/errors.control-service.ts +100 -100
- package/src/_modules/server/errors/errors.controller.ts +559 -559
- package/src/_modules/server/errors/errors.data-service.spec.ts +480 -480
- package/src/_modules/server/index.ts +30 -30
- package/src/_modules/server/server-status/server-status-snapshot.control-service.spec.ts +70 -70
- package/src/_modules/server/server-status/server-status-snapshot.control-service.ts +17 -17
- package/src/_modules/server/server-status/server-status-snapshot.data-service.spec.ts +77 -77
- package/src/_modules/server/server-status/server-status-snapshot.data-service.ts +37 -37
- package/src/_modules/server/server-status/server-status.control-service.spec.ts +672 -672
- package/src/_modules/server/server-status/server-status.control-service.ts +490 -490
- package/src/_modules/server/server-status/server-status.controller.spec.ts +276 -276
- package/src/_modules/server/server-status/server-status.controller.ts +336 -336
- package/src/_modules/socket/_enums/socket-security.enum.ts +11 -11
- package/src/_modules/socket/_models/socket-client-service-params.control-model.spec.ts +32 -32
- package/src/_modules/socket/_models/socket-client-service-params.control-model.ts +22 -22
- package/src/_modules/socket/_models/socket-presence.control-model.spec.ts +158 -158
- package/src/_modules/socket/_models/socket-presence.control-model.ts +209 -209
- package/src/_modules/socket/_models/socket-server-service-params.control-model.spec.ts +69 -69
- package/src/_modules/socket/_services/socket-client.service.spec.ts +15 -15
- package/src/_modules/socket/_services/socket-client.service.ts +260 -260
- package/src/_modules/socket/app-extended.integration.spec.ts +85 -85
- package/src/_modules/socket/app-extended.server.ts +648 -648
- package/src/_modules/socket/index.ts +42 -42
- package/src/_modules/test/get-test-routing-module.util.spec.ts +28 -28
- package/src/_modules/test/get-test-routing-module.util.ts +23 -23
- package/src/_modules/test/index.ts +11 -11
- package/src/_modules/test/test.controller.spec.ts +72 -72
- package/src/_modules/test/test.controller.ts +115 -115
- package/src/_modules/usage/get-usage-routing-module.util.ts +22 -22
- package/src/_modules/usage/index.ts +15 -15
- package/src/_modules/usage/usage.controller.spec.ts +106 -106
- package/src/_modules/usage/usage.controller.ts +140 -140
- package/src/_modules/usage/usage.data-service.spec.ts +332 -332
- package/src/_modules/usage/usage.data-service.ts +185 -185
- package/src/_services/base/api.service-base.spec.ts +125 -125
- package/src/_services/base/api.service-base.ts +74 -74
- package/src/_services/base/archive-data.service.spec.ts +209 -209
- package/src/_services/base/archive-data.service.ts +223 -223
- package/src/_services/base/data.service.spec.ts +784 -784
- package/src/_services/base/data.service.ts +2792 -2792
- package/src/_services/base/db.service.spec.ts +160 -160
- package/src/_services/base/db.service.ts +1698 -1698
- package/src/_services/base/singleton.service-base.spec.ts +28 -28
- package/src/_services/base/singleton.service-base.ts +24 -24
- package/src/_services/base/singleton.service.spec.ts +114 -114
- package/src/_services/base/singleton.service.ts +38 -38
- package/src/_services/core/api.service.spec.ts +140 -140
- package/src/_services/core/auth.service.spec.ts +159 -159
- package/src/_services/core/auth.service.ts +174 -174
- package/src/_services/core/collection-growth-monitor.service.spec.ts +53 -1
- package/src/_services/core/collection-growth-monitor.service.ts +29 -6
- package/src/_services/core/email.service.spec.ts +85 -85
- package/src/_services/core/email.service.ts +757 -757
- package/src/_services/core/global.service.spec.ts +292 -292
- package/src/_services/core/global.service.ts +487 -487
- package/src/_services/core/memory-guard.service.spec.ts +245 -245
- package/src/_services/core/memory-guard.service.ts +481 -481
- package/src/_services/core/service-collection.service.spec.ts +46 -46
- package/src/_services/core/service-collection.service.ts +6 -6
- package/src/_services/route/controller.service.spec.ts +53 -53
- package/src/_services/route/controller.service.ts +148 -148
- package/src/_services/route/routing-module.service.spec.ts +98 -98
- package/src/_services/route/routing-module.service.ts +330 -330
- package/src/_services/server/app.server.ts +2012 -2012
- package/src/_services/shared.static-service.spec.ts +99 -99
- package/src/_services/shared.static-service.ts +78 -78
- package/tsconfig.app.json +12 -12
- package/tsconfig.json +42 -42
|
@@ -1,174 +1,174 @@
|
|
|
1
|
-
|
|
2
|
-
import { Request, Response } from 'express';
|
|
3
|
-
|
|
4
|
-
import { DyFM_Error } from '@futdevpro/fsm-dynamo';
|
|
5
|
-
|
|
6
|
-
import { DyNTS_SingletonService } from '../base/singleton.service';
|
|
7
|
-
import { DyNTS_global_settings } from '../../_collections/global-settings.const';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Extend this class as an Auth Service implementation
|
|
11
|
-
*
|
|
12
|
-
* You should use singleton instance getting function by implementing a
|
|
13
|
-
* static getInstance() function
|
|
14
|
-
* @example
|
|
15
|
-
* export class AuthService extends DyNTS_AuthService {
|
|
16
|
-
*
|
|
17
|
-
* static getInstance(): AuthService {
|
|
18
|
-
* return AuthService.getSingletonInstance();
|
|
19
|
-
* }
|
|
20
|
-
* ...
|
|
21
|
-
*/
|
|
22
|
-
export abstract class DyNTS_AuthService extends DyNTS_SingletonService {
|
|
23
|
-
|
|
24
|
-
readonly serviceName: string = 'AuthService';
|
|
25
|
-
|
|
26
|
-
override readonly defaultErrorUserMsg =
|
|
27
|
-
`We encountered an unhandled Auth Error, ` +
|
|
28
|
-
`\nplease contact the responsible development team.`;
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* this function returns the 'authorization' header from the Request,
|
|
32
|
-
* or throws error, if its missing
|
|
33
|
-
*
|
|
34
|
-
* @param req
|
|
35
|
-
* @returns
|
|
36
|
-
*/
|
|
37
|
-
getTokenFromRequest(req: Request): string {
|
|
38
|
-
const authHeader = req?.headers?.['authorization'];
|
|
39
|
-
|
|
40
|
-
if (!authHeader) {
|
|
41
|
-
throw new DyFM_Error({
|
|
42
|
-
status: 401,
|
|
43
|
-
errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-AS0-GT0`,
|
|
44
|
-
addECToUserMsg: true,
|
|
45
|
-
message: 'AuthHeader missing!',
|
|
46
|
-
userMessage: this.defaultErrorUserMsg,
|
|
47
|
-
issuerService: this.serviceName,
|
|
48
|
-
confidentialContent: { headers: req?.headers },
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
const token = authHeader.split(' ')[1];
|
|
53
|
-
|
|
54
|
-
if (!token) {
|
|
55
|
-
throw new DyFM_Error({
|
|
56
|
-
status: 401,
|
|
57
|
-
errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-AS0-GT1`,
|
|
58
|
-
addECToUserMsg: true,
|
|
59
|
-
message: 'Token missing!',
|
|
60
|
-
userMessage: this.defaultErrorUserMsg,
|
|
61
|
-
issuerService: this.serviceName,
|
|
62
|
-
confidentialContent: { headers: req?.headers },
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
return token;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* You need to implement a token validation logic,
|
|
71
|
-
* when if the token is invalid, or the authentication fails, it sends or throws an error
|
|
72
|
-
*
|
|
73
|
-
* @example
|
|
74
|
-
*
|
|
75
|
-
* async authenticateToken(req: Request, res: Response, next: NextFunction) {
|
|
76
|
-
* try {
|
|
77
|
-
* let token = AuthService.getTokenFromRequest(req);
|
|
78
|
-
* token = await AuthService.verifyToken(token);
|
|
79
|
-
*
|
|
80
|
-
* DyFM_Log.success('token authenticated');
|
|
81
|
-
* res.setHeader('authorization', `Bearer ${token}`);
|
|
82
|
-
* next();
|
|
83
|
-
* } catch (error) {
|
|
84
|
-
* error = new DyFM_Error({
|
|
85
|
-
* status: 401,
|
|
86
|
-
* message: `authenticateToken (WB-ERROR)`,
|
|
87
|
-
* addECToUserMsg: true,
|
|
88
|
-
* userMessage: `Authorization failed.`,
|
|
89
|
-
* error
|
|
90
|
-
* });
|
|
91
|
-
* DyFM_Log.error(error?.message, error);
|
|
92
|
-
*
|
|
93
|
-
* res.status(error.status);
|
|
94
|
-
* res.send(error);
|
|
95
|
-
* }
|
|
96
|
-
* }
|
|
97
|
-
* */
|
|
98
|
-
abstract authenticate_token: (req: Request, res: Response) => Promise<void>;
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* You need to implement a token validation logic,
|
|
102
|
-
* when if the token is invalid, or the authentication fails, it sends or throws an error
|
|
103
|
-
*
|
|
104
|
-
* @param req
|
|
105
|
-
* @param res
|
|
106
|
-
* @param next
|
|
107
|
-
*
|
|
108
|
-
* @example
|
|
109
|
-
*
|
|
110
|
-
* async authenticate_tokenSelf(req: Request, res: Response, next: NextFunction): Promise<void> {
|
|
111
|
-
* try {
|
|
112
|
-
* let token = AuthService.getTokenFromRequest(req);
|
|
113
|
-
* token = await AuthService.verifyTokenSelf(token, req?.params?.userId);
|
|
114
|
-
* DyFM_Log.success('selftoken authenticated');
|
|
115
|
-
*
|
|
116
|
-
* res.setHeader('authorization', `Bearer ${token}`);
|
|
117
|
-
* next();
|
|
118
|
-
* } catch (error) {
|
|
119
|
-
* error = new DyFM_Error({
|
|
120
|
-
* status: 401,
|
|
121
|
-
* message: `authenticate_tokenSelf (WB-ERROR)`,
|
|
122
|
-
* addECToUserMsg: true,
|
|
123
|
-
* userMessage: `Authorization failed.`,
|
|
124
|
-
* error
|
|
125
|
-
* });
|
|
126
|
-
* DyFM_Log.error(error?.message, error);
|
|
127
|
-
*
|
|
128
|
-
* res.status(error.status);
|
|
129
|
-
* res.send(error);
|
|
130
|
-
* }
|
|
131
|
-
* }
|
|
132
|
-
*
|
|
133
|
-
*/
|
|
134
|
-
abstract authenticate_tokenSelf: (req: Request, res: Response) => Promise<void>;
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* Authenticate Token for Permission to Access UsageData
|
|
138
|
-
* @param req
|
|
139
|
-
* @param res
|
|
140
|
-
* @param next
|
|
141
|
-
*
|
|
142
|
-
* @example
|
|
143
|
-
* You need to implement a token validation logic,
|
|
144
|
-
* when if the token is invalid, or the authentication fails, it sends or throws an error
|
|
145
|
-
*
|
|
146
|
-
* async authTokenPermAccUsageData(req: Request, res: Response, next: NextFunction): Promise<void> {
|
|
147
|
-
* AuthService.authTokenAndPerm(req, res, next, Permission.accessUsageData);
|
|
148
|
-
* }
|
|
149
|
-
*/
|
|
150
|
-
abstract authenticate_tokenPerm_accUsageData: (req: Request, res: Response) => Promise<void>;
|
|
151
|
-
|
|
152
|
-
/**
|
|
153
|
-
* The DynamoNTS System is using this to get issuer, that will be set on DBServices
|
|
154
|
-
* Don't throw error in this function, since it will be used in every request
|
|
155
|
-
* @param req
|
|
156
|
-
*
|
|
157
|
-
* @example
|
|
158
|
-
* getAccountIdFromRequest(req: Request): string {
|
|
159
|
-
* try {
|
|
160
|
-
* const authHeader = req.headers['authorization'];
|
|
161
|
-
* const token = authHeader.split(' ')[1];
|
|
162
|
-
* return this.getAccountIdFromToken(token);
|
|
163
|
-
* } catch {
|
|
164
|
-
* return undefined;
|
|
165
|
-
* }
|
|
166
|
-
* }
|
|
167
|
-
*/
|
|
168
|
-
abstract getIssuerFromRequest(req: Request): string;
|
|
169
|
-
/**
|
|
170
|
-
* Basic Module: UsageModule uses this function
|
|
171
|
-
* @param req
|
|
172
|
-
*/
|
|
173
|
-
abstract getUsernameFromRequest(req: Request): string;
|
|
174
|
-
}
|
|
1
|
+
|
|
2
|
+
import { Request, Response } from 'express';
|
|
3
|
+
|
|
4
|
+
import { DyFM_Error } from '@futdevpro/fsm-dynamo';
|
|
5
|
+
|
|
6
|
+
import { DyNTS_SingletonService } from '../base/singleton.service';
|
|
7
|
+
import { DyNTS_global_settings } from '../../_collections/global-settings.const';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Extend this class as an Auth Service implementation
|
|
11
|
+
*
|
|
12
|
+
* You should use singleton instance getting function by implementing a
|
|
13
|
+
* static getInstance() function
|
|
14
|
+
* @example
|
|
15
|
+
* export class AuthService extends DyNTS_AuthService {
|
|
16
|
+
*
|
|
17
|
+
* static getInstance(): AuthService {
|
|
18
|
+
* return AuthService.getSingletonInstance();
|
|
19
|
+
* }
|
|
20
|
+
* ...
|
|
21
|
+
*/
|
|
22
|
+
export abstract class DyNTS_AuthService extends DyNTS_SingletonService {
|
|
23
|
+
|
|
24
|
+
readonly serviceName: string = 'AuthService';
|
|
25
|
+
|
|
26
|
+
override readonly defaultErrorUserMsg =
|
|
27
|
+
`We encountered an unhandled Auth Error, ` +
|
|
28
|
+
`\nplease contact the responsible development team.`;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* this function returns the 'authorization' header from the Request,
|
|
32
|
+
* or throws error, if its missing
|
|
33
|
+
*
|
|
34
|
+
* @param req
|
|
35
|
+
* @returns
|
|
36
|
+
*/
|
|
37
|
+
getTokenFromRequest(req: Request): string {
|
|
38
|
+
const authHeader = req?.headers?.['authorization'];
|
|
39
|
+
|
|
40
|
+
if (!authHeader) {
|
|
41
|
+
throw new DyFM_Error({
|
|
42
|
+
status: 401,
|
|
43
|
+
errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-AS0-GT0`,
|
|
44
|
+
addECToUserMsg: true,
|
|
45
|
+
message: 'AuthHeader missing!',
|
|
46
|
+
userMessage: this.defaultErrorUserMsg,
|
|
47
|
+
issuerService: this.serviceName,
|
|
48
|
+
confidentialContent: { headers: req?.headers },
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const token = authHeader.split(' ')[1];
|
|
53
|
+
|
|
54
|
+
if (!token) {
|
|
55
|
+
throw new DyFM_Error({
|
|
56
|
+
status: 401,
|
|
57
|
+
errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-AS0-GT1`,
|
|
58
|
+
addECToUserMsg: true,
|
|
59
|
+
message: 'Token missing!',
|
|
60
|
+
userMessage: this.defaultErrorUserMsg,
|
|
61
|
+
issuerService: this.serviceName,
|
|
62
|
+
confidentialContent: { headers: req?.headers },
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return token;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* You need to implement a token validation logic,
|
|
71
|
+
* when if the token is invalid, or the authentication fails, it sends or throws an error
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
*
|
|
75
|
+
* async authenticateToken(req: Request, res: Response, next: NextFunction) {
|
|
76
|
+
* try {
|
|
77
|
+
* let token = AuthService.getTokenFromRequest(req);
|
|
78
|
+
* token = await AuthService.verifyToken(token);
|
|
79
|
+
*
|
|
80
|
+
* DyFM_Log.success('token authenticated');
|
|
81
|
+
* res.setHeader('authorization', `Bearer ${token}`);
|
|
82
|
+
* next();
|
|
83
|
+
* } catch (error) {
|
|
84
|
+
* error = new DyFM_Error({
|
|
85
|
+
* status: 401,
|
|
86
|
+
* message: `authenticateToken (WB-ERROR)`,
|
|
87
|
+
* addECToUserMsg: true,
|
|
88
|
+
* userMessage: `Authorization failed.`,
|
|
89
|
+
* error
|
|
90
|
+
* });
|
|
91
|
+
* DyFM_Log.error(error?.message, error);
|
|
92
|
+
*
|
|
93
|
+
* res.status(error.status);
|
|
94
|
+
* res.send(error);
|
|
95
|
+
* }
|
|
96
|
+
* }
|
|
97
|
+
* */
|
|
98
|
+
abstract authenticate_token: (req: Request, res: Response) => Promise<void>;
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* You need to implement a token validation logic,
|
|
102
|
+
* when if the token is invalid, or the authentication fails, it sends or throws an error
|
|
103
|
+
*
|
|
104
|
+
* @param req
|
|
105
|
+
* @param res
|
|
106
|
+
* @param next
|
|
107
|
+
*
|
|
108
|
+
* @example
|
|
109
|
+
*
|
|
110
|
+
* async authenticate_tokenSelf(req: Request, res: Response, next: NextFunction): Promise<void> {
|
|
111
|
+
* try {
|
|
112
|
+
* let token = AuthService.getTokenFromRequest(req);
|
|
113
|
+
* token = await AuthService.verifyTokenSelf(token, req?.params?.userId);
|
|
114
|
+
* DyFM_Log.success('selftoken authenticated');
|
|
115
|
+
*
|
|
116
|
+
* res.setHeader('authorization', `Bearer ${token}`);
|
|
117
|
+
* next();
|
|
118
|
+
* } catch (error) {
|
|
119
|
+
* error = new DyFM_Error({
|
|
120
|
+
* status: 401,
|
|
121
|
+
* message: `authenticate_tokenSelf (WB-ERROR)`,
|
|
122
|
+
* addECToUserMsg: true,
|
|
123
|
+
* userMessage: `Authorization failed.`,
|
|
124
|
+
* error
|
|
125
|
+
* });
|
|
126
|
+
* DyFM_Log.error(error?.message, error);
|
|
127
|
+
*
|
|
128
|
+
* res.status(error.status);
|
|
129
|
+
* res.send(error);
|
|
130
|
+
* }
|
|
131
|
+
* }
|
|
132
|
+
*
|
|
133
|
+
*/
|
|
134
|
+
abstract authenticate_tokenSelf: (req: Request, res: Response) => Promise<void>;
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Authenticate Token for Permission to Access UsageData
|
|
138
|
+
* @param req
|
|
139
|
+
* @param res
|
|
140
|
+
* @param next
|
|
141
|
+
*
|
|
142
|
+
* @example
|
|
143
|
+
* You need to implement a token validation logic,
|
|
144
|
+
* when if the token is invalid, or the authentication fails, it sends or throws an error
|
|
145
|
+
*
|
|
146
|
+
* async authTokenPermAccUsageData(req: Request, res: Response, next: NextFunction): Promise<void> {
|
|
147
|
+
* AuthService.authTokenAndPerm(req, res, next, Permission.accessUsageData);
|
|
148
|
+
* }
|
|
149
|
+
*/
|
|
150
|
+
abstract authenticate_tokenPerm_accUsageData: (req: Request, res: Response) => Promise<void>;
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* The DynamoNTS System is using this to get issuer, that will be set on DBServices
|
|
154
|
+
* Don't throw error in this function, since it will be used in every request
|
|
155
|
+
* @param req
|
|
156
|
+
*
|
|
157
|
+
* @example
|
|
158
|
+
* getAccountIdFromRequest(req: Request): string {
|
|
159
|
+
* try {
|
|
160
|
+
* const authHeader = req.headers['authorization'];
|
|
161
|
+
* const token = authHeader.split(' ')[1];
|
|
162
|
+
* return this.getAccountIdFromToken(token);
|
|
163
|
+
* } catch {
|
|
164
|
+
* return undefined;
|
|
165
|
+
* }
|
|
166
|
+
* }
|
|
167
|
+
*/
|
|
168
|
+
abstract getIssuerFromRequest(req: Request): string;
|
|
169
|
+
/**
|
|
170
|
+
* Basic Module: UsageModule uses this function
|
|
171
|
+
* @param req
|
|
172
|
+
*/
|
|
173
|
+
abstract getUsernameFromRequest(req: Request): string;
|
|
174
|
+
}
|
|
@@ -25,7 +25,7 @@ describe('| DyNTS_CollectionGrowthMonitor.evaluateGrowth (FR-258 / SR-4)', () =>
|
|
|
25
25
|
DyNTS_CollectionGrowthMonitor.evaluateGrowth('cdp_report_details_archiveds', 300000, undefined, SIZE_THRESHOLD, GROWTH_PCT);
|
|
26
26
|
expect(kinds(alerts)).toEqual(['size']);
|
|
27
27
|
expect(alerts[0].dataName).toBe('cdp_report_details_archiveds');
|
|
28
|
-
expect(alerts[0].detail).toEqual({ collection: 'cdp_report_details_archiveds', docCount: 300000, threshold: SIZE_THRESHOLD });
|
|
28
|
+
expect(alerts[0].detail).toEqual({ collection: 'cdp_report_details_archiveds', docCount: 300000, threshold: SIZE_THRESHOLD, retentionDays: null });
|
|
29
29
|
});
|
|
30
30
|
|
|
31
31
|
it('| exactly AT the threshold → no size alert (strictly greater)', () => {
|
|
@@ -65,3 +65,55 @@ describe('| DyNTS_CollectionGrowthMonitor.evaluateGrowth (FR-258 / SR-4)', () =>
|
|
|
65
65
|
expect(alerts).toEqual([]);
|
|
66
66
|
});
|
|
67
67
|
});
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* FR-311 spec — a size-riasztas RETENTION-TUDATOS tanacsa.
|
|
71
|
+
*
|
|
72
|
+
* MIERT SZAMIT (elesbol jott, 2026-08-19): az overseer `ov_secret_audit` kollekcioja 253 617
|
|
73
|
+
* dokumentumnal jart, es a monitor azt tanacsolta, hogy "Consider declaring `retention` on this
|
|
74
|
+
* model" — HOLOTT a modell MAR deklaral `retention: { retentionDays: 365 }`-ot. Az operator tehat
|
|
75
|
+
* orankent kapott egy olyan feladatot, ami mar KESZ volt, ráadásul az error-tarba is elmentve.
|
|
76
|
+
*
|
|
77
|
+
* A ket helyzet KULONBOZO teendot kiván:
|
|
78
|
+
* - nincs retention -> deklaralj egyet,
|
|
79
|
+
* - VAN retention -> az ablak tul hosszu, vagy a novekedes gyorsabb a TTL-nel.
|
|
80
|
+
*/
|
|
81
|
+
describe('| FR-311 — retention-tudatos size-riasztas', () => {
|
|
82
|
+
const SIZE_T: number = 250000;
|
|
83
|
+
const GROWTH_P: number = 50;
|
|
84
|
+
|
|
85
|
+
it('| retention NELKUL a deklaralasra szolit fel (valtozatlan viselkedes)', () => {
|
|
86
|
+
const alerts = DyNTS_CollectionGrowthMonitor.evaluateGrowth('logs', 300000, undefined, SIZE_T, GROWTH_P);
|
|
87
|
+
expect(alerts.length).toBe(1);
|
|
88
|
+
expect(alerts[0].message).toContain('Consider declaring');
|
|
89
|
+
expect(alerts[0].detail.retentionDays).toBeNull();
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
/** A VALODI eset: 365 napos retention mellett is 253 617 dokumentum. */
|
|
93
|
+
it('| deklaralt retention mellett NEM a deklaralast ajanlja, hanem az ablak szukiteset', () => {
|
|
94
|
+
const alerts = DyNTS_CollectionGrowthMonitor.evaluateGrowth(
|
|
95
|
+
'ov_secret_audit', 253617, undefined, SIZE_T, GROWTH_P, 365 * 86400,
|
|
96
|
+
);
|
|
97
|
+
expect(alerts.length).toBe(1);
|
|
98
|
+
expect(alerts[0].message).not.toContain('Consider declaring');
|
|
99
|
+
expect(alerts[0].message).toContain('DESPITE');
|
|
100
|
+
expect(alerts[0].message).toContain('365 day(s)');
|
|
101
|
+
expect(alerts[0].detail.retentionDays).toBe(365);
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
it('| a napra kerekites ttlSeconds-bol is helyes', () => {
|
|
105
|
+
const alerts = DyNTS_CollectionGrowthMonitor.evaluateGrowth('x', 300000, undefined, SIZE_T, GROWTH_P, 14 * 86400);
|
|
106
|
+
expect(alerts[0].message).toContain('14 day(s)');
|
|
107
|
+
expect(alerts[0].detail.retentionDays).toBe(14);
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
/** A retention a GROWTH-riasztast nem erinti — az fuggetlen jelzes marad. */
|
|
111
|
+
it('| a growth-riasztas szoveget a retention NEM valtoztatja', () => {
|
|
112
|
+
const alerts = DyNTS_CollectionGrowthMonitor.evaluateGrowth(
|
|
113
|
+
'y', 400000, { docCount: 100000, atMs: 0 }, SIZE_T, GROWTH_P, 30 * 86400,
|
|
114
|
+
);
|
|
115
|
+
const growth = alerts.find((a) => a.kind === 'growth');
|
|
116
|
+
expect(growth).toBeDefined();
|
|
117
|
+
expect(growth!.message).toContain('fast unbounded growth');
|
|
118
|
+
});
|
|
119
|
+
});
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
DyFM_Error, DyFM_ErrorLevel, DyFM_Log, DyFM_RetentionSettings, DyFM_resolveRetentionTtlSeconds,
|
|
3
|
+
} from '@futdevpro/fsm-dynamo';
|
|
2
4
|
|
|
3
5
|
import { DyNTS_global_settings } from '../../_collections/global-settings.const';
|
|
4
6
|
import { DyNTS_SingletonServiceBase } from '../base/singleton.service-base';
|
|
@@ -113,17 +115,32 @@ export class DyNTS_CollectionGrowthMonitor extends DyNTS_SingletonServiceBase {
|
|
|
113
115
|
last: CollectionSnapshot | undefined,
|
|
114
116
|
sizeThreshold: number,
|
|
115
117
|
growthRatePct: number,
|
|
118
|
+
retentionTtlSec?: number,
|
|
116
119
|
): DyNTS_CollectionGrowthAlert[] {
|
|
117
120
|
const alerts: DyNTS_CollectionGrowthAlert[] = [];
|
|
118
121
|
|
|
119
122
|
if (count > sizeThreshold) {
|
|
123
|
+
// FR-311 — RETENTION-TUDATOS tanacs. A korabbi uzenet FELTETEL NELKUL azt ajanlotta, hogy
|
|
124
|
+
// "declare `retention`" — akkor is, ha a modell MAR deklaralt egyet. Elesben (2026-08-19,
|
|
125
|
+
// overseer `ov_secret_audit`, 253 617 dokumentum) ez oda vezetett, hogy az operator olyat
|
|
126
|
+
// kapott feladatul, ami mar KESZ volt, orankent ujra, az error-tarba is elmentve. A ket eset
|
|
127
|
+
// KULONBOZO teendot kiván, ezert kulon is kell mondani oket.
|
|
128
|
+
const retentionDays: number | null = retentionTtlSec === undefined
|
|
129
|
+
? null
|
|
130
|
+
: Math.round(retentionTtlSec / 86400);
|
|
120
131
|
alerts.push({
|
|
121
132
|
kind: 'size',
|
|
122
133
|
dataName: dataName,
|
|
123
|
-
message:
|
|
124
|
-
`Collection "${dataName}" has ${count} documents (> ${sizeThreshold} threshold) — ` +
|
|
125
|
-
|
|
126
|
-
|
|
134
|
+
message: retentionDays === null
|
|
135
|
+
? `Collection "${dataName}" has ${count} documents (> ${sizeThreshold} threshold) — ` +
|
|
136
|
+
`unbounded-growth risk. Consider declaring \`retention\` on this model (FR-258 / SR-1).`
|
|
137
|
+
: `Collection "${dataName}" has ${count} documents (> ${sizeThreshold} threshold) DESPITE a ` +
|
|
138
|
+
`declared retention of ~${retentionDays} day(s) — the window is too long, or growth outpaces ` +
|
|
139
|
+
`the TTL. Shorten \`retention\` or reduce the write-rate (FR-258 / SR-1).`,
|
|
140
|
+
detail: {
|
|
141
|
+
collection: dataName, docCount: count, threshold: sizeThreshold,
|
|
142
|
+
retentionDays: retentionDays,
|
|
143
|
+
},
|
|
127
144
|
});
|
|
128
145
|
}
|
|
129
146
|
|
|
@@ -163,8 +180,14 @@ export class DyNTS_CollectionGrowthMonitor extends DyNTS_SingletonServiceBase {
|
|
|
163
180
|
const count: number = await model.estimatedDocumentCount();
|
|
164
181
|
const last: CollectionSnapshot | undefined = this.lastSnapshotByCollection.get(dataName);
|
|
165
182
|
|
|
183
|
+
// FR-311 — a modell SAJAT retention-deklaraciojat visszük be a dontesbe. A feloldas az
|
|
184
|
+
// fsm-dynamo SSOT-resolvereval megy (`ttlSeconds` > `retentionDays`, ervenytelen ertek
|
|
185
|
+
// elutasitva) — NEM ujraimplementalva, kulonben ketfele igazsag lenne rola.
|
|
186
|
+
const retentionTtlSec: number | undefined = DyFM_resolveRetentionTtlSeconds(
|
|
187
|
+
service?.dataParams?.retention as DyFM_RetentionSettings | undefined,
|
|
188
|
+
);
|
|
166
189
|
const alerts: DyNTS_CollectionGrowthAlert[] = DyNTS_CollectionGrowthMonitor.evaluateGrowth(
|
|
167
|
-
dataName, count, last, this.sizeThresholdDocCount, this.growthRateThresholdPct,
|
|
190
|
+
dataName, count, last, this.sizeThresholdDocCount, this.growthRateThresholdPct, retentionTtlSec,
|
|
168
191
|
);
|
|
169
192
|
for (const alert of alerts) {
|
|
170
193
|
this.emitAlert(alert, nowMs);
|
|
@@ -1,85 +1,85 @@
|
|
|
1
|
-
|
|
2
|
-
import { DyFM_Error, DyFM_EnvironmentFlag } from '@futdevpro/fsm-dynamo';
|
|
3
|
-
import { DyNTS_EmailService, DyNTS_EmailService_Settings, DyNTS_EmailTemplateComponent, DyNTS_SendEmail_Settings } from './email.service';
|
|
4
|
-
import { DyNTS_global_settings } from '../../_collections/global-settings.const';
|
|
5
|
-
|
|
6
|
-
describe('| DyNTS_EmailService', () => {
|
|
7
|
-
let emailService: DyNTS_EmailService;
|
|
8
|
-
const settings: DyNTS_EmailService_Settings = {
|
|
9
|
-
host: 'smtp.example.com',
|
|
10
|
-
port: 587,
|
|
11
|
-
email: 'test@example.com',
|
|
12
|
-
pass: 'password',
|
|
13
|
-
senderName: 'Test Sender',
|
|
14
|
-
rootPath: '/path/to/templates',
|
|
15
|
-
templateComponents: [
|
|
16
|
-
new DyNTS_EmailTemplateComponent({
|
|
17
|
-
name: 'testComponent',
|
|
18
|
-
selector: 'test-selector',
|
|
19
|
-
template: '<div>{{property}}</div>',
|
|
20
|
-
properties: [ 'property' ],
|
|
21
|
-
}),
|
|
22
|
-
],
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
beforeAll(() => {
|
|
26
|
-
if (!DyNTS_global_settings.systemShortCodeName) (DyNTS_global_settings as { systemShortCodeName?: string }).systemShortCodeName = 'TEST';
|
|
27
|
-
if (!DyNTS_global_settings.env_settings) (DyNTS_global_settings as { env_settings?: unknown }).env_settings = { environment: DyFM_EnvironmentFlag.local };
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
beforeEach(() => {
|
|
31
|
-
(DyNTS_global_settings as { env_settings: unknown }).env_settings = {
|
|
32
|
-
environment: DyFM_EnvironmentFlag.local,
|
|
33
|
-
mongoUri: 'mongodb://localhost:27017/test',
|
|
34
|
-
discord: undefined,
|
|
35
|
-
openAi: undefined,
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
emailService = new DyNTS_EmailService(settings);
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
it('| should initialize with correct settings', () => {
|
|
42
|
-
expect(emailService.serviceName).toBe('DyNTS_EmailService');
|
|
43
|
-
expect(emailService['senderName']).toBe(settings.senderName);
|
|
44
|
-
expect(emailService['senderNEmail']).toBe(`${settings.senderName} <${settings.email}>`);
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
it('| should load email template components', async () => {
|
|
48
|
-
await emailService.asyncPostConstruct();
|
|
49
|
-
expect(emailService['componentsByName']['testComponent']).toBeDefined();
|
|
50
|
-
expect(emailService['componentsBySelector']['test-selector']).toBeDefined();
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
it('| should throw error if no template component name is provided', async () => {
|
|
54
|
-
const sendEmailSettings: DyNTS_SendEmail_Settings = {
|
|
55
|
-
to: 'recipient@example.com',
|
|
56
|
-
subject: 'Test Subject',
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
await expectAsync(emailService.sendEmail(sendEmailSettings, 'testIssuer'))
|
|
60
|
-
.toBeRejectedWith(jasmine.any(DyFM_Error));
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
it('| should throw error if template component is not found', async () => {
|
|
64
|
-
const sendEmailSettings: DyNTS_SendEmail_Settings = {
|
|
65
|
-
to: 'recipient@example.com',
|
|
66
|
-
subject: 'Test Subject',
|
|
67
|
-
templateComponentName: 'nonExistentComponent',
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
await expectAsync(emailService.sendEmail(sendEmailSettings, 'testIssuer'))
|
|
71
|
-
.toBeRejectedWith(jasmine.any(DyFM_Error));
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
it('| should throw error if template property is missing', async () => {
|
|
75
|
-
const component = new DyNTS_EmailTemplateComponent({
|
|
76
|
-
name: 'testComponent',
|
|
77
|
-
selector: 'test-selector',
|
|
78
|
-
template: '<div>{{missingProperty}}</div>',
|
|
79
|
-
properties: [ 'missingProperty' ],
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
await expectAsync(emailService['compileComponentProperties'](component, {}, '', 'testIssuer'))
|
|
83
|
-
.toBeRejectedWith(jasmine.any(DyFM_Error));
|
|
84
|
-
});
|
|
85
|
-
});
|
|
1
|
+
|
|
2
|
+
import { DyFM_Error, DyFM_EnvironmentFlag } from '@futdevpro/fsm-dynamo';
|
|
3
|
+
import { DyNTS_EmailService, DyNTS_EmailService_Settings, DyNTS_EmailTemplateComponent, DyNTS_SendEmail_Settings } from './email.service';
|
|
4
|
+
import { DyNTS_global_settings } from '../../_collections/global-settings.const';
|
|
5
|
+
|
|
6
|
+
describe('| DyNTS_EmailService', () => {
|
|
7
|
+
let emailService: DyNTS_EmailService;
|
|
8
|
+
const settings: DyNTS_EmailService_Settings = {
|
|
9
|
+
host: 'smtp.example.com',
|
|
10
|
+
port: 587,
|
|
11
|
+
email: 'test@example.com',
|
|
12
|
+
pass: 'password',
|
|
13
|
+
senderName: 'Test Sender',
|
|
14
|
+
rootPath: '/path/to/templates',
|
|
15
|
+
templateComponents: [
|
|
16
|
+
new DyNTS_EmailTemplateComponent({
|
|
17
|
+
name: 'testComponent',
|
|
18
|
+
selector: 'test-selector',
|
|
19
|
+
template: '<div>{{property}}</div>',
|
|
20
|
+
properties: [ 'property' ],
|
|
21
|
+
}),
|
|
22
|
+
],
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
beforeAll(() => {
|
|
26
|
+
if (!DyNTS_global_settings.systemShortCodeName) (DyNTS_global_settings as { systemShortCodeName?: string }).systemShortCodeName = 'TEST';
|
|
27
|
+
if (!DyNTS_global_settings.env_settings) (DyNTS_global_settings as { env_settings?: unknown }).env_settings = { environment: DyFM_EnvironmentFlag.local };
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
beforeEach(() => {
|
|
31
|
+
(DyNTS_global_settings as { env_settings: unknown }).env_settings = {
|
|
32
|
+
environment: DyFM_EnvironmentFlag.local,
|
|
33
|
+
mongoUri: 'mongodb://localhost:27017/test',
|
|
34
|
+
discord: undefined,
|
|
35
|
+
openAi: undefined,
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
emailService = new DyNTS_EmailService(settings);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it('| should initialize with correct settings', () => {
|
|
42
|
+
expect(emailService.serviceName).toBe('DyNTS_EmailService');
|
|
43
|
+
expect(emailService['senderName']).toBe(settings.senderName);
|
|
44
|
+
expect(emailService['senderNEmail']).toBe(`${settings.senderName} <${settings.email}>`);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it('| should load email template components', async () => {
|
|
48
|
+
await emailService.asyncPostConstruct();
|
|
49
|
+
expect(emailService['componentsByName']['testComponent']).toBeDefined();
|
|
50
|
+
expect(emailService['componentsBySelector']['test-selector']).toBeDefined();
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
it('| should throw error if no template component name is provided', async () => {
|
|
54
|
+
const sendEmailSettings: DyNTS_SendEmail_Settings = {
|
|
55
|
+
to: 'recipient@example.com',
|
|
56
|
+
subject: 'Test Subject',
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
await expectAsync(emailService.sendEmail(sendEmailSettings, 'testIssuer'))
|
|
60
|
+
.toBeRejectedWith(jasmine.any(DyFM_Error));
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it('| should throw error if template component is not found', async () => {
|
|
64
|
+
const sendEmailSettings: DyNTS_SendEmail_Settings = {
|
|
65
|
+
to: 'recipient@example.com',
|
|
66
|
+
subject: 'Test Subject',
|
|
67
|
+
templateComponentName: 'nonExistentComponent',
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
await expectAsync(emailService.sendEmail(sendEmailSettings, 'testIssuer'))
|
|
71
|
+
.toBeRejectedWith(jasmine.any(DyFM_Error));
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
it('| should throw error if template property is missing', async () => {
|
|
75
|
+
const component = new DyNTS_EmailTemplateComponent({
|
|
76
|
+
name: 'testComponent',
|
|
77
|
+
selector: 'test-selector',
|
|
78
|
+
template: '<div>{{missingProperty}}</div>',
|
|
79
|
+
properties: [ 'missingProperty' ],
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
await expectAsync(emailService['compileComponentProperties'](component, {}, '', 'testIssuer'))
|
|
83
|
+
.toBeRejectedWith(jasmine.any(DyFM_Error));
|
|
84
|
+
});
|
|
85
|
+
});
|