@futdevpro/nts-dynamo 1.15.154 → 1.15.156

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.
Files changed (775) hide show
  1. package/README.md +26 -22
  2. package/__documentations/2026-08-22-bfr-ctm-018-content-free-endpoint-errors.md +54 -0
  3. package/__documentations/2026-08-22-content-free-process-error-boundary.md +105 -85
  4. package/build/_collections/app-version-header.util.d.ts +41 -41
  5. package/build/_collections/app-version-header.util.js +66 -66
  6. package/build/_collections/archive-service-registry.const.d.ts +15 -15
  7. package/build/_collections/archive-service-registry.const.js +14 -14
  8. package/build/_collections/archive.util.d.ts +12 -12
  9. package/build/_collections/archive.util.js +18 -18
  10. package/build/_collections/atlas-default-db-options.const.d.ts +2 -2
  11. package/build/_collections/atlas-default-db-options.const.js +9 -9
  12. package/build/_collections/client-safe-error.util.d.ts +38 -38
  13. package/build/_collections/client-safe-error.util.js +96 -96
  14. package/build/_collections/default-fallback-cache-max-age.const.d.ts +2 -2
  15. package/build/_collections/default-fallback-cache-max-age.const.js +5 -5
  16. package/build/_collections/default-not-found-page.const.d.ts +5 -5
  17. package/build/_collections/default-not-found-page.const.js +24 -24
  18. package/build/_collections/default-socket-path.const.d.ts +2 -2
  19. package/build/_collections/default-socket-path.const.js +5 -5
  20. package/build/_collections/field-encryption.util.d.ts +85 -85
  21. package/build/_collections/field-encryption.util.js +192 -192
  22. package/build/_collections/get-environment-settings.util.d.ts +2 -2
  23. package/build/_collections/get-environment-settings.util.js +43 -43
  24. package/build/_collections/global-settings.const.d.ts +6 -6
  25. package/build/_collections/global-settings.const.js +104 -104
  26. package/build/_collections/load-shed.util.d.ts +15 -15
  27. package/build/_collections/load-shed.util.js +42 -42
  28. package/build/_collections/mongo-reconnect-guard.util.d.ts +73 -73
  29. package/build/_collections/mongo-reconnect-guard.util.js +110 -110
  30. package/build/_collections/npm-token-check.util.d.ts +138 -138
  31. package/build/_collections/npm-token-check.util.js +301 -301
  32. package/build/_collections/security-headers.util.d.ts +16 -16
  33. package/build/_collections/security-headers.util.js +77 -77
  34. package/build/_collections/signed-url.util.d.ts +84 -84
  35. package/build/_collections/signed-url.util.js +145 -145
  36. package/build/_collections/star.controller.d.ts +7 -7
  37. package/build/_collections/star.controller.js +97 -97
  38. package/build/_collections/static-cache-control.util.d.ts +17 -17
  39. package/build/_collections/static-cache-control.util.js +23 -23
  40. package/build/_enums/data-model-type.enum.d.ts +13 -13
  41. package/build/_enums/data-model-type.enum.js +17 -17
  42. package/build/_enums/data-service-function.enum.d.ts +18 -18
  43. package/build/_enums/data-service-function.enum.js +24 -24
  44. package/build/_enums/predefined-data-types.enum.d.ts +15 -15
  45. package/build/_enums/predefined-data-types.enum.js +19 -19
  46. package/build/_enums/route-security.enum.d.ts +11 -11
  47. package/build/_enums/route-security.enum.js +15 -15
  48. package/build/_models/control-models/api-call-params.control-model.d.ts +79 -79
  49. package/build/_models/control-models/api-call-params.control-model.js +101 -101
  50. package/build/_models/control-models/app-ext-system-controls.control-model.d.ts +6 -6
  51. package/build/_models/control-models/app-ext-system-controls.control-model.js +10 -10
  52. package/build/_models/control-models/app-params.control-model.d.ts +51 -51
  53. package/build/_models/control-models/app-params.control-model.js +118 -118
  54. package/build/_models/control-models/app-system-controls.control-model.d.ts +7 -7
  55. package/build/_models/control-models/app-system-controls.control-model.js +11 -11
  56. package/build/_models/control-models/endpoint-params.control-model.d.ts +125 -119
  57. package/build/_models/control-models/endpoint-params.control-model.d.ts.map +1 -1
  58. package/build/_models/control-models/endpoint-params.control-model.js +409 -484
  59. package/build/_models/control-models/endpoint-params.control-model.js.map +1 -1
  60. package/build/_models/control-models/http-settings.control-model.d.ts +17 -17
  61. package/build/_models/control-models/http-settings.control-model.js +34 -34
  62. package/build/_models/control-models/system-control.control-model.d.ts +5 -5
  63. package/build/_models/control-models/system-control.control-model.js +11 -11
  64. package/build/_models/data-models/schema-migration.data-model.d.ts +28 -28
  65. package/build/_models/data-models/schema-migration.data-model.js +46 -46
  66. package/build/_models/interfaces/app-version-header-settings.interface.d.ts +16 -16
  67. package/build/_models/interfaces/app-version-header-settings.interface.js +2 -2
  68. package/build/_models/interfaces/certification-settings.interface.d.ts +5 -5
  69. package/build/_models/interfaces/certification-settings.interface.js +2 -2
  70. package/build/_models/interfaces/compare-data-options.interface.d.ts +26 -26
  71. package/build/_models/interfaces/compare-data-options.interface.js +2 -2
  72. package/build/_models/interfaces/compare-data-result.interface.d.ts +12 -12
  73. package/build/_models/interfaces/compare-data-result.interface.js +2 -2
  74. package/build/_models/interfaces/cors-settings.interface.d.ts +51 -51
  75. package/build/_models/interfaces/cors-settings.interface.js +2 -2
  76. package/build/_models/interfaces/db-query-options.interface.d.ts +32 -32
  77. package/build/_models/interfaces/db-query-options.interface.js +2 -2
  78. package/build/_models/interfaces/environment-settings.interface.d.ts +34 -34
  79. package/build/_models/interfaces/environment-settings.interface.js +2 -2
  80. package/build/_models/interfaces/global-log-settings.interface.d.ts +145 -145
  81. package/build/_models/interfaces/global-log-settings.interface.js +2 -2
  82. package/build/_models/interfaces/global-service-settings.interface.d.ts +30 -30
  83. package/build/_models/interfaces/global-service-settings.interface.js +2 -2
  84. package/build/_models/interfaces/global-settings.interface.d.ts +265 -265
  85. package/build/_models/interfaces/global-settings.interface.js +2 -2
  86. package/build/_models/interfaces/migration-entry.interface.d.ts +19 -19
  87. package/build/_models/interfaces/migration-entry.interface.js +2 -2
  88. package/build/_models/interfaces/mongo-transaction-settings.interface.d.ts +8 -8
  89. package/build/_models/interfaces/mongo-transaction-settings.interface.js +2 -2
  90. package/build/_models/interfaces/routing-module-settings.interface.d.ts +19 -19
  91. package/build/_models/interfaces/routing-module-settings.interface.js +2 -2
  92. package/build/_models/interfaces/security-headers-settings.interface.d.ts +41 -41
  93. package/build/_models/interfaces/security-headers-settings.interface.js +2 -2
  94. package/build/_models/interfaces/signed-url-verify-result.interface.d.ts +13 -13
  95. package/build/_models/interfaces/signed-url-verify-result.interface.js +2 -2
  96. package/build/_models/interfaces/static-client-settings.interface.d.ts +36 -36
  97. package/build/_models/interfaces/static-client-settings.interface.js +2 -2
  98. package/build/_models/types/db-update.type.d.ts +129 -129
  99. package/build/_models/types/db-update.type.js +2 -2
  100. package/build/_modules/account-security/_enums/account-challenge-purpose.type-enum.d.ts +5 -5
  101. package/build/_modules/account-security/_enums/account-challenge-purpose.type-enum.js +9 -9
  102. package/build/_modules/account-security/_enums/account-refresh-token-state.type-enum.d.ts +6 -6
  103. package/build/_modules/account-security/_enums/account-refresh-token-state.type-enum.js +10 -10
  104. package/build/_modules/account-security/_enums/account-session-state.type-enum.d.ts +6 -6
  105. package/build/_modules/account-security/_enums/account-session-state.type-enum.js +10 -10
  106. package/build/_modules/account-security/_models/account-challenge-adapter.interface.d.ts +8 -8
  107. package/build/_modules/account-security/_models/account-challenge-adapter.interface.js +2 -2
  108. package/build/_modules/account-security/_models/account-challenge-issued.interface.d.ts +6 -6
  109. package/build/_modules/account-security/_models/account-challenge-issued.interface.js +2 -2
  110. package/build/_modules/account-security/_models/account-challenge-record.interface.d.ts +12 -12
  111. package/build/_modules/account-security/_models/account-challenge-record.interface.js +2 -2
  112. package/build/_modules/account-security/_models/account-challenge-result.interface.d.ts +7 -7
  113. package/build/_modules/account-security/_models/account-challenge-result.interface.js +2 -2
  114. package/build/_modules/account-security/_models/account-challenge-settings.interface.d.ts +8 -8
  115. package/build/_modules/account-security/_models/account-challenge-settings.interface.js +2 -2
  116. package/build/_modules/account-security/_models/account-password-policy.interface.d.ts +11 -11
  117. package/build/_modules/account-security/_models/account-password-policy.interface.js +2 -2
  118. package/build/_modules/account-security/_models/account-password-verification.interface.d.ts +5 -5
  119. package/build/_modules/account-security/_models/account-password-verification.interface.js +2 -2
  120. package/build/_modules/account-security/_models/account-refresh-token-record.interface.d.ts +12 -12
  121. package/build/_modules/account-security/_models/account-refresh-token-record.interface.js +2 -2
  122. package/build/_modules/account-security/_models/account-session-adapter.interface.d.ts +18 -18
  123. package/build/_modules/account-security/_models/account-session-adapter.interface.js +2 -2
  124. package/build/_modules/account-security/_models/account-session-claims.interface.d.ts +7 -7
  125. package/build/_modules/account-security/_models/account-session-claims.interface.js +2 -2
  126. package/build/_modules/account-security/_models/account-session-context.interface.d.ts +6 -6
  127. package/build/_modules/account-security/_models/account-session-context.interface.js +2 -2
  128. package/build/_modules/account-security/_models/account-session-create.interface.d.ts +7 -7
  129. package/build/_modules/account-security/_models/account-session-create.interface.js +2 -2
  130. package/build/_modules/account-security/_models/account-session-record.interface.d.ts +20 -20
  131. package/build/_modules/account-security/_models/account-session-record.interface.js +2 -2
  132. package/build/_modules/account-security/_models/account-session-rotate.interface.d.ts +10 -10
  133. package/build/_modules/account-security/_models/account-session-rotate.interface.js +2 -2
  134. package/build/_modules/account-security/_models/account-session-settings.interface.d.ts +10 -10
  135. package/build/_modules/account-security/_models/account-session-settings.interface.js +2 -2
  136. package/build/_modules/account-security/_models/account-session-token-pair.interface.d.ts +8 -8
  137. package/build/_modules/account-security/_models/account-session-token-pair.interface.js +2 -2
  138. package/build/_modules/account-security/_models/account-session-view.interface.d.ts +12 -12
  139. package/build/_modules/account-security/_models/account-session-view.interface.js +2 -2
  140. package/build/_modules/account-security/account-challenge.control-service.d.ts +23 -23
  141. package/build/_modules/account-security/account-challenge.control-service.js +116 -116
  142. package/build/_modules/account-security/account-password.control-service.d.ts +23 -23
  143. package/build/_modules/account-security/account-password.control-service.js +213 -213
  144. package/build/_modules/account-security/account-session.control-service.d.ts +38 -38
  145. package/build/_modules/account-security/account-session.control-service.js +276 -276
  146. package/build/_modules/account-security/index.d.ts +23 -23
  147. package/build/_modules/account-security/index.js +15 -15
  148. package/build/_modules/admin-auth/_models/admin-api-key-config.interface.d.ts +31 -31
  149. package/build/_modules/admin-auth/_models/admin-api-key-config.interface.js +2 -2
  150. package/build/_modules/admin-auth/admin-api-key.auth-service.d.ts +89 -89
  151. package/build/_modules/admin-auth/admin-api-key.auth-service.js +194 -194
  152. package/build/_modules/admin-auth/index.d.ts +2 -2
  153. package/build/_modules/admin-auth/index.js +5 -5
  154. package/build/_modules/ai/_collections/ai-model-config-validator.util.d.ts +31 -31
  155. package/build/_modules/ai/_collections/ai-model-config-validator.util.js +94 -94
  156. package/build/_modules/ai/_collections/ai-provider-error.util.d.ts +43 -43
  157. package/build/_modules/ai/_collections/ai-provider-error.util.js +120 -120
  158. package/build/_modules/ai/_models/ai-input-interfaces.d.ts +53 -53
  159. package/build/_modules/ai/_models/ai-input-interfaces.js +5 -5
  160. package/build/_modules/ai/_models/ai-test-generation-result.interface.d.ts +16 -16
  161. package/build/_modules/ai/_models/ai-test-generation-result.interface.js +2 -2
  162. package/build/_modules/ai/_models/interfaces/dynts-ai-cost-event-callback.interface.d.ts +13 -13
  163. package/build/_modules/ai/_models/interfaces/dynts-ai-cost-event-callback.interface.js +2 -2
  164. package/build/_modules/ai/_models/interfaces/dynts-ai-cost-event.interface.d.ts +49 -49
  165. package/build/_modules/ai/_models/interfaces/dynts-ai-cost-event.interface.js +2 -2
  166. package/build/_modules/ai/_models/interfaces/dynts-ai-provider-error.interface.d.ts +16 -16
  167. package/build/_modules/ai/_models/interfaces/dynts-ai-provider-error.interface.js +2 -2
  168. package/build/_modules/ai/_modules/ai-mock/_collections/aim-default-collection.util.d.ts +22 -22
  169. package/build/_modules/ai/_modules/ai-mock/_collections/aim-default-collection.util.js +51 -51
  170. package/build/_modules/ai/_modules/ai-mock/_collections/aim-fixture-match.util.d.ts +33 -33
  171. package/build/_modules/ai/_modules/ai-mock/_collections/aim-fixture-match.util.js +55 -55
  172. package/build/_modules/ai/_modules/ai-mock/_collections/aim-fixture-serializer.util.d.ts +40 -40
  173. package/build/_modules/ai/_modules/ai-mock/_collections/aim-fixture-serializer.util.js +89 -89
  174. package/build/_modules/ai/_modules/ai-mock/_enums/aim-modality.enum.d.ts +27 -27
  175. package/build/_modules/ai/_modules/ai-mock/_enums/aim-modality.enum.js +28 -28
  176. package/build/_modules/ai/_modules/ai-mock/_models/interfaces/aim-call-input.interface.d.ts +14 -14
  177. package/build/_modules/ai/_modules/ai-mock/_models/interfaces/aim-call-input.interface.js +2 -2
  178. package/build/_modules/ai/_modules/ai-mock/_models/interfaces/aim-error.interface.d.ts +10 -10
  179. package/build/_modules/ai/_modules/ai-mock/_models/interfaces/aim-error.interface.js +2 -2
  180. package/build/_modules/ai/_modules/ai-mock/_models/interfaces/aim-fixture.interface.d.ts +29 -29
  181. package/build/_modules/ai/_modules/ai-mock/_models/interfaces/aim-fixture.interface.js +2 -2
  182. package/build/_modules/ai/_modules/ai-mock/_models/interfaces/aim-request.interface.d.ts +18 -18
  183. package/build/_modules/ai/_modules/ai-mock/_models/interfaces/aim-request.interface.js +2 -2
  184. package/build/_modules/ai/_modules/ai-mock/_models/interfaces/aim-service-collection.interface.d.ts +18 -18
  185. package/build/_modules/ai/_modules/ai-mock/_models/interfaces/aim-service-collection.interface.js +2 -2
  186. package/build/_modules/ai/_modules/ai-mock/_services/ai-embedding-mock.service.d.ts +80 -80
  187. package/build/_modules/ai/_modules/ai-mock/_services/ai-embedding-mock.service.js +166 -166
  188. package/build/_modules/ai/_modules/ai-mock/_services/aim-fixture-harness.service.d.ts +47 -47
  189. package/build/_modules/ai/_modules/ai-mock/_services/aim-fixture-harness.service.js +103 -103
  190. package/build/_modules/ai/_modules/ai-mock/_services/aim-fixture-store.service.d.ts +34 -34
  191. package/build/_modules/ai/_modules/ai-mock/_services/aim-fixture-store.service.js +59 -59
  192. package/build/_modules/ai/_modules/ai-mock/_services/aim-mock.service.d.ts +73 -73
  193. package/build/_modules/ai/_modules/ai-mock/_services/aim-mock.service.js +133 -133
  194. package/build/_modules/ai/_modules/ai-mock/fixtures/aim-text.fixtures.d.ts +8 -8
  195. package/build/_modules/ai/_modules/ai-mock/fixtures/aim-text.fixtures.js +650 -650
  196. package/build/_modules/ai/_modules/ai-mock/index.d.ts +14 -14
  197. package/build/_modules/ai/_modules/ai-mock/index.js +42 -42
  198. package/build/_modules/ai/_modules/anthropic/_services/aai-user-key.control-service.d.ts +35 -35
  199. package/build/_modules/ai/_modules/anthropic/_services/aai-user-key.control-service.js +117 -117
  200. package/build/_modules/ai/_modules/anthropic/index.d.ts +2 -2
  201. package/build/_modules/ai/_modules/anthropic/index.js +7 -7
  202. package/build/_modules/ai/_modules/document-ai/_collections/dai-chunking.util.d.ts +84 -84
  203. package/build/_modules/ai/_modules/document-ai/_collections/dai-chunking.util.js +467 -467
  204. package/build/_modules/ai/_modules/document-ai/_collections/dai-code-chunking.util.d.ts +109 -109
  205. package/build/_modules/ai/_modules/document-ai/_collections/dai-code-chunking.util.js +418 -418
  206. package/build/_modules/ai/_modules/document-ai/_collections/dai-document.util.d.ts +28 -28
  207. package/build/_modules/ai/_modules/document-ai/_collections/dai-document.util.js +73 -73
  208. package/build/_modules/ai/_modules/document-ai/_enums/dai-compare-result-type.enum.d.ts +6 -6
  209. package/build/_modules/ai/_modules/document-ai/_enums/dai-compare-result-type.enum.js +10 -10
  210. package/build/_modules/ai/_modules/document-ai/_models/data-models/dai-doc-chunk.data-model.d.ts +51 -51
  211. package/build/_modules/ai/_modules/document-ai/_models/data-models/dai-doc-chunk.data-model.js +132 -132
  212. package/build/_modules/ai/_modules/document-ai/_models/data-models/dai-doc-page.data-model.d.ts +47 -47
  213. package/build/_modules/ai/_modules/document-ai/_models/data-models/dai-doc-page.data-model.js +136 -136
  214. package/build/_modules/ai/_modules/document-ai/_models/data-models/dai-document.data-model.d.ts +17 -17
  215. package/build/_modules/ai/_modules/document-ai/_models/data-models/dai-document.data-model.js +76 -76
  216. package/build/_modules/ai/_modules/document-ai/_models/interfaces/dai-code-chunk.interface.d.ts +49 -49
  217. package/build/_modules/ai/_modules/document-ai/_models/interfaces/dai-code-chunk.interface.js +2 -2
  218. package/build/_modules/ai/_modules/document-ai/_models/interfaces/dai-doc-chunk-compare-result.interface.d.ts +8 -8
  219. package/build/_modules/ai/_modules/document-ai/_models/interfaces/dai-doc-chunk-compare-result.interface.js +2 -2
  220. package/build/_modules/ai/_modules/document-ai/_models/interfaces/dai-doc-page-compare-result.interface.d.ts +11 -11
  221. package/build/_modules/ai/_modules/document-ai/_models/interfaces/dai-doc-page-compare-result.interface.js +2 -2
  222. package/build/_modules/ai/_modules/document-ai/_models/interfaces/dai-document-compare-result.interface.d.ts +12 -12
  223. package/build/_modules/ai/_modules/document-ai/_models/interfaces/dai-document-compare-result.interface.js +2 -2
  224. package/build/_modules/ai/_modules/document-ai/index.d.ts +12 -12
  225. package/build/_modules/ai/_modules/document-ai/index.js +27 -27
  226. package/build/_modules/ai/_modules/fdp-ai/_services/fdpai-user-key.control-service.d.ts +34 -34
  227. package/build/_modules/ai/_modules/fdp-ai/_services/fdpai-user-key.control-service.js +128 -128
  228. package/build/_modules/ai/_modules/fdp-ai/index.d.ts +2 -2
  229. package/build/_modules/ai/_modules/fdp-ai/index.js +7 -7
  230. package/build/_modules/ai/_modules/open-ai/_collections/oai-global-settings.const.d.ts +2 -2
  231. package/build/_modules/ai/_modules/open-ai/_collections/oai-global-settings.const.js +8 -8
  232. package/build/_modules/ai/_modules/open-ai/_collections/oai-llm-predefined-requests-hu.conts.d.ts +2 -2
  233. package/build/_modules/ai/_modules/open-ai/_collections/oai-llm-predefined-requests-hu.conts.js +74 -74
  234. package/build/_modules/ai/_modules/open-ai/_collections/oai-llm-predefined-requests.conts.d.ts +2 -2
  235. package/build/_modules/ai/_modules/open-ai/_collections/oai-llm-predefined-requests.conts.js +67 -67
  236. package/build/_modules/ai/_modules/open-ai/_enums/oai-gpt-message-role.enum.js +42 -42
  237. package/build/_modules/ai/_modules/open-ai/_models/interfaces/oai-global-settings.interface.d.ts +5 -5
  238. package/build/_modules/ai/_modules/open-ai/_models/interfaces/oai-global-settings.interface.js +2 -2
  239. package/build/_modules/ai/_modules/open-ai/_models/interfaces/oai-gpt-message.interface.js +6 -6
  240. package/build/_modules/ai/_modules/open-ai/_models/interfaces/oai-llm-predefined-requests.interface.d.ts +51 -51
  241. package/build/_modules/ai/_modules/open-ai/_models/interfaces/oai-llm-predefined-requests.interface.js +2 -2
  242. package/build/_modules/ai/_modules/open-ai/_services/data-services/oai-doc-chunk-data.service.d.ts +21 -21
  243. package/build/_modules/ai/_modules/open-ai/_services/data-services/oai-doc-chunk-data.service.js +187 -187
  244. package/build/_modules/ai/_modules/open-ai/_services/data-services/oai-doc-page.data-service.d.ts +26 -26
  245. package/build/_modules/ai/_modules/open-ai/_services/data-services/oai-doc-page.data-service.js +278 -278
  246. package/build/_modules/ai/_modules/open-ai/_services/data-services/oai-document.data-service.d.ts +22 -22
  247. package/build/_modules/ai/_modules/open-ai/_services/data-services/oai-document.data-service.js +322 -322
  248. package/build/_modules/ai/_modules/open-ai/_services/data-services/oai-vector-data.service.d.ts +119 -119
  249. package/build/_modules/ai/_modules/open-ai/_services/data-services/oai-vector-data.service.js +480 -480
  250. package/build/_modules/ai/_modules/open-ai/_services/oai-embedding.control-service.d.ts +25 -25
  251. package/build/_modules/ai/_modules/open-ai/_services/oai-embedding.control-service.js +103 -103
  252. package/build/_modules/ai/_modules/open-ai/_services/oai-llm-chat.service-base.d.ts +169 -169
  253. package/build/_modules/ai/_modules/open-ai/_services/oai-llm-chat.service-base.js +479 -479
  254. package/build/_modules/ai/_modules/open-ai/_services/oai-llm.service-base.d.ts +229 -229
  255. package/build/_modules/ai/_modules/open-ai/_services/oai-llm.service-base.js +617 -617
  256. package/build/_modules/ai/_modules/open-ai/_services/oai-user-key.control-service.d.ts +39 -39
  257. package/build/_modules/ai/_modules/open-ai/_services/oai-user-key.control-service.js +110 -110
  258. package/build/_modules/ai/_modules/open-ai/index.d.ts +14 -14
  259. package/build/_modules/ai/_modules/open-ai/index.js +55 -55
  260. package/build/_modules/ai/_services/ai-embedding-provider.registry.d.ts +51 -51
  261. package/build/_modules/ai/_services/ai-embedding-provider.registry.js +78 -78
  262. package/build/_modules/ai/_services/ai-embedding.service-base.d.ts +41 -41
  263. package/build/_modules/ai/_services/ai-embedding.service-base.js +11 -11
  264. package/build/_modules/ai/_services/ai-llm-chat.service-base.d.ts +39 -39
  265. package/build/_modules/ai/_services/ai-llm-chat.service-base.js +11 -11
  266. package/build/_modules/ai/_services/ai-llm.service-base.d.ts +148 -148
  267. package/build/_modules/ai/_services/ai-llm.service-base.js +378 -378
  268. package/build/_modules/ai/_services/ai-provider.service-base.d.ts +46 -46
  269. package/build/_modules/ai/_services/ai-provider.service-base.js +43 -43
  270. package/build/_modules/ai/_services/ai-user-key.service-base.d.ts +44 -44
  271. package/build/_modules/ai/_services/ai-user-key.service-base.js +14 -14
  272. package/build/_modules/ai/_services/lmstudio-embedding.control-service.d.ts +110 -110
  273. package/build/_modules/ai/_services/lmstudio-embedding.control-service.js +297 -297
  274. package/build/_modules/ai/index.d.ts +16 -16
  275. package/build/_modules/ai/index.js +30 -30
  276. package/build/_modules/artifact-compiler/_enums/artifact-compile-outcome.type-enum.d.ts +5 -5
  277. package/build/_modules/artifact-compiler/_enums/artifact-compile-outcome.type-enum.js +9 -9
  278. package/build/_modules/artifact-compiler/_enums/artifact-compile-stage.type-enum.d.ts +8 -8
  279. package/build/_modules/artifact-compiler/_enums/artifact-compile-stage.type-enum.js +12 -12
  280. package/build/_modules/artifact-compiler/_enums/artifact-retry-class.type-enum.d.ts +6 -6
  281. package/build/_modules/artifact-compiler/_enums/artifact-retry-class.type-enum.js +10 -10
  282. package/build/_modules/artifact-compiler/_models/artifact-compile.interface.d.ts +32 -32
  283. package/build/_modules/artifact-compiler/_models/artifact-compile.interface.js +2 -2
  284. package/build/_modules/artifact-compiler/artifact-compiler.control-service.d.ts +36 -36
  285. package/build/_modules/artifact-compiler/artifact-compiler.control-service.js +273 -273
  286. package/build/_modules/artifact-compiler/index.d.ts +5 -5
  287. package/build/_modules/artifact-compiler/index.js +11 -11
  288. package/build/_modules/assistant/_collections/ass-global-settings.const.d.ts +2 -2
  289. package/build/_modules/assistant/_collections/ass-global-settings.const.js +14 -14
  290. package/build/_modules/assistant/_collections/ass.util.d.ts +15 -15
  291. package/build/_modules/assistant/_collections/ass.util.js +42 -42
  292. package/build/_modules/assistant/_models/ass-global-settings.interface.d.ts +13 -13
  293. package/build/_modules/assistant/_models/ass-global-settings.interface.js +2 -2
  294. package/build/_modules/assistant/_services/ass-io.control-service.d.ts +19 -19
  295. package/build/_modules/assistant/_services/ass-io.control-service.js +57 -57
  296. package/build/_modules/assistant/_services/ass-main.control-service.d.ts +32 -32
  297. package/build/_modules/assistant/_services/ass-main.control-service.js +65 -65
  298. package/build/_modules/assistant/index.d.ts +6 -6
  299. package/build/_modules/assistant/index.js +18 -18
  300. package/build/_modules/bot/_collections/bot-default-commands.const.d.ts +2 -2
  301. package/build/_modules/bot/_collections/bot-default-commands.const.js +13 -13
  302. package/build/_modules/bot/_collections/bot-global-settings.const.d.ts +2 -2
  303. package/build/_modules/bot/_collections/bot-global-settings.const.js +31 -31
  304. package/build/_modules/bot/_models/bot-channel-wrapper.interface.d.ts +25 -25
  305. package/build/_modules/bot/_models/bot-channel-wrapper.interface.js +38 -38
  306. package/build/_modules/bot/_models/bot-command.interface.d.ts +7 -7
  307. package/build/_modules/bot/_models/bot-command.interface.js +2 -2
  308. package/build/_modules/bot/_models/bot-global-settings.interface.d.ts +85 -85
  309. package/build/_modules/bot/_models/bot-global-settings.interface.js +2 -2
  310. package/build/_modules/bot/_models/bot-last-mention-date.interface.d.ts +6 -6
  311. package/build/_modules/bot/_models/bot-last-mention-date.interface.js +2 -2
  312. package/build/_modules/bot/_models/bot-last-message-date.interface.d.ts +5 -5
  313. package/build/_modules/bot/_models/bot-last-message-date.interface.js +2 -2
  314. package/build/_modules/bot/_models/bot-message-wrapper.interface.d.ts +37 -37
  315. package/build/_modules/bot/_models/bot-message-wrapper.interface.js +54 -54
  316. package/build/_modules/bot/_models/bot-user-wrapper.interface.d.ts +23 -23
  317. package/build/_modules/bot/_models/bot-user-wrapper.interface.js +28 -28
  318. package/build/_modules/bot/_modules/discord-bot/_models/dib-platform.types.js +10 -10
  319. package/build/_modules/bot/_modules/discord-bot/_services/dib-messaging-provider.control-service.d.ts +69 -69
  320. package/build/_modules/bot/_modules/discord-bot/_services/dib-messaging-provider.control-service.js +497 -497
  321. package/build/_modules/bot/_modules/discord-bot/index.d.ts +1 -1
  322. package/build/_modules/bot/_modules/discord-bot/index.js +12 -12
  323. package/build/_modules/bot/_modules/dynamo-bot/_collections/dyb-operations.util.d.ts +16 -16
  324. package/build/_modules/bot/_modules/dynamo-bot/_collections/dyb-operations.util.js +42 -42
  325. package/build/_modules/bot/_modules/dynamo-bot/_models/dyb-platform.types.d.ts +9 -9
  326. package/build/_modules/bot/_modules/dynamo-bot/_models/dyb-platform.types.js +2 -2
  327. package/build/_modules/bot/_modules/dynamo-bot/_services/dyb-messaging-provider.control-service.d.ts +59 -59
  328. package/build/_modules/bot/_modules/dynamo-bot/_services/dyb-messaging-provider.control-service.js +349 -349
  329. package/build/_modules/bot/_modules/dynamo-bot/index.d.ts +3 -3
  330. package/build/_modules/bot/_modules/dynamo-bot/index.js +15 -15
  331. package/build/_modules/bot/_modules/slack-bot/_models/slb-platform.types.d.ts +6 -6
  332. package/build/_modules/bot/_modules/slack-bot/_models/slb-platform.types.js +2 -2
  333. package/build/_modules/bot/_modules/slack-bot/_services/slb-messaging-provider.control-service.d.ts +56 -56
  334. package/build/_modules/bot/_modules/slack-bot/_services/slb-messaging-provider.control-service.js +137 -137
  335. package/build/_modules/bot/_modules/slack-bot/index.d.ts +2 -2
  336. package/build/_modules/bot/_modules/slack-bot/index.js +12 -12
  337. package/build/_modules/bot/_modules/teams-bot/_models/teb-platform.types.d.ts +6 -6
  338. package/build/_modules/bot/_modules/teams-bot/_models/teb-platform.types.js +2 -2
  339. package/build/_modules/bot/_modules/teams-bot/_services/teb-messaging-provider.control-service.d.ts +56 -56
  340. package/build/_modules/bot/_modules/teams-bot/_services/teb-messaging-provider.control-service.js +137 -137
  341. package/build/_modules/bot/_modules/teams-bot/index.d.ts +2 -2
  342. package/build/_modules/bot/_modules/teams-bot/index.js +12 -12
  343. package/build/_modules/bot/_services/bot-commands.control-service.d.ts +12 -12
  344. package/build/_modules/bot/_services/bot-commands.control-service.js +117 -117
  345. package/build/_modules/bot/_services/bot-io.control-service.d.ts +23 -23
  346. package/build/_modules/bot/_services/bot-io.control-service.js +226 -226
  347. package/build/_modules/bot/_services/bot-main.control-service.d.ts +35 -35
  348. package/build/_modules/bot/_services/bot-main.control-service.js +195 -195
  349. package/build/_modules/bot/_services/bot-messaging-provider.service-base.d.ts +71 -71
  350. package/build/_modules/bot/_services/bot-messaging-provider.service-base.js +15 -15
  351. package/build/_modules/bot/_services/bot-routines.control-service.d.ts +13 -13
  352. package/build/_modules/bot/_services/bot-routines.control-service.js +59 -59
  353. package/build/_modules/bot/index.d.ts +17 -17
  354. package/build/_modules/bot/index.js +36 -36
  355. package/build/_modules/custom-data/custom-data.controller.d.ts +5 -5
  356. package/build/_modules/custom-data/custom-data.controller.js +56 -56
  357. package/build/_modules/custom-data/custom-data.data-service.d.ts +5 -5
  358. package/build/_modules/custom-data/custom-data.data-service.js +11 -11
  359. package/build/_modules/custom-data/get-custom-data-routing-module.util.d.ts +3 -3
  360. package/build/_modules/custom-data/get-custom-data-routing-module.util.js +16 -16
  361. package/build/_modules/custom-data/index.d.ts +4 -4
  362. package/build/_modules/custom-data/index.js +9 -9
  363. package/build/_modules/data-readers/_collections/dynts-sqlite-reader.util.d.ts +58 -58
  364. package/build/_modules/data-readers/_collections/dynts-sqlite-reader.util.js +168 -168
  365. package/build/_modules/data-readers/_models/interfaces/dynts-sqlite-reader.interface.d.ts +31 -31
  366. package/build/_modules/data-readers/_models/interfaces/dynts-sqlite-reader.interface.js +7 -7
  367. package/build/_modules/data-readers/index.d.ts +2 -2
  368. package/build/_modules/data-readers/index.js +10 -10
  369. package/build/_modules/defaults/_collections/default-endpoints.util.d.ts +248 -248
  370. package/build/_modules/defaults/_collections/default-endpoints.util.js +386 -386
  371. package/build/_modules/defaults/_models/default-user.data-model.d.ts +19 -19
  372. package/build/_modules/defaults/_models/default-user.data-model.js +72 -72
  373. package/build/_modules/defaults/_services/default-auth.service.d.ts +50 -50
  374. package/build/_modules/defaults/_services/default-auth.service.js +158 -158
  375. package/build/_modules/defaults/_services/default-socket-events.service.d.ts +23 -23
  376. package/build/_modules/defaults/_services/default-socket-events.service.js +60 -60
  377. package/build/_modules/defaults/_services/default-user.data-service.d.ts +24 -24
  378. package/build/_modules/defaults/_services/default-user.data-service.js +87 -87
  379. package/build/_modules/defaults/index.d.ts +5 -5
  380. package/build/_modules/defaults/index.js +17 -17
  381. package/build/_modules/discord-assistant/_collections/dias-global-settings.const.d.ts +2 -2
  382. package/build/_modules/discord-assistant/_collections/dias-global-settings.const.js +16 -16
  383. package/build/_modules/discord-assistant/_collections/dias.util.d.ts +31 -31
  384. package/build/_modules/discord-assistant/_collections/dias.util.js +85 -85
  385. package/build/_modules/discord-assistant/_models/dias-global-settings.interface.d.ts +17 -17
  386. package/build/_modules/discord-assistant/_models/dias-global-settings.interface.js +2 -2
  387. package/build/_modules/discord-assistant/_models/dias-knowledge.data-model.d.ts +8 -8
  388. package/build/_modules/discord-assistant/_models/dias-knowledge.data-model.js +46 -46
  389. package/build/_modules/discord-assistant/_services/dias-chunk.data-service.d.ts +17 -17
  390. package/build/_modules/discord-assistant/_services/dias-chunk.data-service.js +123 -123
  391. package/build/_modules/discord-assistant/_services/dias-io.control-service.d.ts +10 -10
  392. package/build/_modules/discord-assistant/_services/dias-io.control-service.js +49 -49
  393. package/build/_modules/discord-assistant/_services/dias-main.control-service.d.ts +3 -3
  394. package/build/_modules/discord-assistant/_services/dias-main.control-service.js +7 -7
  395. package/build/_modules/discord-assistant/_services/dias.service-base.d.ts +18 -18
  396. package/build/_modules/discord-assistant/_services/dias.service-base.js +46 -46
  397. package/build/_modules/discord-assistant/index.d.ts +11 -11
  398. package/build/_modules/discord-assistant/index.js +24 -24
  399. package/build/_modules/discord-assistant-voiced/_services/dias-discord-bot.control-service.d.ts +3 -3
  400. package/build/_modules/discord-assistant-voiced/_services/dias-discord-bot.control-service.js +7 -7
  401. package/build/_modules/discord-assistant-voiced/index.d.ts +2 -2
  402. package/build/_modules/discord-assistant-voiced/index.js +28 -28
  403. package/build/_modules/discord-bot/_collections/dibo-default-commands.const.d.ts +2 -2
  404. package/build/_modules/discord-bot/_collections/dibo-default-commands.const.js +12 -12
  405. package/build/_modules/discord-bot/_collections/dibo-global-settings.conts.d.ts +2 -2
  406. package/build/_modules/discord-bot/_collections/dibo-global-settings.conts.js +43 -43
  407. package/build/_modules/discord-bot/_collections/dibo-operations.util.d.ts +22 -22
  408. package/build/_modules/discord-bot/_collections/dibo-operations.util.js +275 -275
  409. package/build/_modules/discord-bot/_models/dibo-command.interface.d.ts +7 -7
  410. package/build/_modules/discord-bot/_models/dibo-command.interface.js +2 -2
  411. package/build/_modules/discord-bot/_models/dibo-global-settings.interface.d.ts +87 -87
  412. package/build/_modules/discord-bot/_models/dibo-global-settings.interface.js +2 -2
  413. package/build/_modules/discord-bot/_models/dibo-last-mention-date.inteface.d.ts +6 -6
  414. package/build/_modules/discord-bot/_models/dibo-last-mention-date.inteface.js +2 -2
  415. package/build/_modules/discord-bot/_models/dibo-last-message-date.interface.d.ts +5 -5
  416. package/build/_modules/discord-bot/_models/dibo-last-message-date.interface.js +2 -2
  417. package/build/_modules/discord-bot/_services/dibo-commands.control-service.d.ts +11 -11
  418. package/build/_modules/discord-bot/_services/dibo-commands.control-service.js +109 -109
  419. package/build/_modules/discord-bot/_services/dibo-io.control-service.d.ts +21 -21
  420. package/build/_modules/discord-bot/_services/dibo-io.control-service.js +218 -218
  421. package/build/_modules/discord-bot/_services/dibo-main.control-service.d.ts +89 -89
  422. package/build/_modules/discord-bot/_services/dibo-main.control-service.js +363 -363
  423. package/build/_modules/discord-bot/_services/dibo-routines.control-service.d.ts +13 -13
  424. package/build/_modules/discord-bot/_services/dibo-routines.control-service.js +73 -73
  425. package/build/_modules/discord-bot/index.d.ts +11 -11
  426. package/build/_modules/discord-bot/index.js +30 -30
  427. package/build/_modules/local-vector-search/_enums/lvs-search-mode.enum.d.ts +34 -34
  428. package/build/_modules/local-vector-search/_enums/lvs-search-mode.enum.js +38 -38
  429. package/build/_modules/local-vector-search/_models/data-models/lvs-vector-persist.data-model.d.ts +35 -35
  430. package/build/_modules/local-vector-search/_models/data-models/lvs-vector-persist.data-model.js +53 -53
  431. package/build/_modules/local-vector-search/_models/lvs-search-result.interface.d.ts +16 -16
  432. package/build/_modules/local-vector-search/_models/lvs-search-result.interface.js +2 -2
  433. package/build/_modules/local-vector-search/_services/lvs-bm25.util.d.ts +88 -88
  434. package/build/_modules/local-vector-search/_services/lvs-bm25.util.js +189 -189
  435. package/build/_modules/local-vector-search/_services/lvs-doc-chunk-data.service.d.ts +26 -26
  436. package/build/_modules/local-vector-search/_services/lvs-doc-chunk-data.service.js +197 -197
  437. package/build/_modules/local-vector-search/_services/lvs-local-vector-search.data-service.d.ts +145 -145
  438. package/build/_modules/local-vector-search/_services/lvs-local-vector-search.data-service.js +294 -294
  439. package/build/_modules/local-vector-search/_services/lvs-persistent-vector-pool.control-service.d.ts +74 -74
  440. package/build/_modules/local-vector-search/_services/lvs-persistent-vector-pool.control-service.js +152 -152
  441. package/build/_modules/local-vector-search/_services/lvs-vector-persist.data-service.d.ts +51 -51
  442. package/build/_modules/local-vector-search/_services/lvs-vector-persist.data-service.js +83 -83
  443. package/build/_modules/local-vector-search/_services/lvs-vector-pool.control-service.d.ts +99 -99
  444. package/build/_modules/local-vector-search/_services/lvs-vector-pool.control-service.js +276 -276
  445. package/build/_modules/local-vector-search/index.d.ts +8 -8
  446. package/build/_modules/local-vector-search/index.js +15 -15
  447. package/build/_modules/logs/_models/file-log-entry.interface.d.ts +13 -13
  448. package/build/_modules/logs/_models/file-log-entry.interface.js +2 -2
  449. package/build/_modules/logs/_models/file-log-read-result.interface.d.ts +35 -35
  450. package/build/_modules/logs/_models/file-log-read-result.interface.js +2 -2
  451. package/build/_modules/logs/file-log.service.d.ts +132 -132
  452. package/build/_modules/logs/file-log.service.js +444 -444
  453. package/build/_modules/logs/file-logs.controller.d.ts +40 -40
  454. package/build/_modules/logs/file-logs.controller.js +138 -138
  455. package/build/_modules/logs/get-file-logs-routing-module.util.d.ts +31 -31
  456. package/build/_modules/logs/get-file-logs-routing-module.util.js +37 -37
  457. package/build/_modules/logs/get-logs-routing-module.util.d.ts +18 -18
  458. package/build/_modules/logs/get-logs-routing-module.util.js +31 -31
  459. package/build/_modules/logs/index.d.ts +8 -8
  460. package/build/_modules/logs/index.js +15 -15
  461. package/build/_modules/logs/log-buffer.service.d.ts +37 -37
  462. package/build/_modules/logs/log-buffer.service.js +96 -96
  463. package/build/_modules/logs/logs.controller.d.ts +26 -26
  464. package/build/_modules/logs/logs.controller.js +89 -89
  465. package/build/_modules/logs/logs.service.d.ts +39 -39
  466. package/build/_modules/logs/logs.service.js +96 -96
  467. package/build/_modules/mcp/_models/interfaces/dynts-mcp.interface.d.ts +108 -108
  468. package/build/_modules/mcp/_models/interfaces/dynts-mcp.interface.js +13 -13
  469. package/build/_modules/mcp/_services/dynts-mcp-server.service-base.d.ts +70 -70
  470. package/build/_modules/mcp/_services/dynts-mcp-server.service-base.js +98 -98
  471. package/build/_modules/mcp/_services/dynts-mcp.adapter.d.ts +56 -56
  472. package/build/_modules/mcp/_services/dynts-mcp.adapter.js +138 -138
  473. package/build/_modules/mcp/index.d.ts +3 -3
  474. package/build/_modules/mcp/index.js +12 -12
  475. package/build/_modules/messaging/_collections/get-messaging-routing-module.util.d.ts +7 -7
  476. package/build/_modules/messaging/_collections/get-messaging-routing-module.util.js +20 -20
  477. package/build/_modules/messaging/_collections/msg-global-settings.const.d.ts +5 -5
  478. package/build/_modules/messaging/_collections/msg-global-settings.const.js +22 -22
  479. package/build/_modules/messaging/_collections/msg.util.d.ts +24 -24
  480. package/build/_modules/messaging/_collections/msg.util.js +62 -62
  481. package/build/_modules/messaging/_models/msg-global-settings.interface.d.ts +28 -28
  482. package/build/_modules/messaging/_models/msg-global-settings.interface.js +2 -2
  483. package/build/_modules/messaging/_services/msg-conversation.data-service.d.ts +28 -28
  484. package/build/_modules/messaging/_services/msg-conversation.data-service.js +109 -109
  485. package/build/_modules/messaging/_services/msg-events.service.d.ts +61 -61
  486. package/build/_modules/messaging/_services/msg-events.service.js +203 -203
  487. package/build/_modules/messaging/_services/msg-integration.control-service.js +180 -180
  488. package/build/_modules/messaging/_services/msg-main.control-service.d.ts +62 -62
  489. package/build/_modules/messaging/_services/msg-main.control-service.js +428 -428
  490. package/build/_modules/messaging/_services/msg-message.data-service.d.ts +28 -28
  491. package/build/_modules/messaging/_services/msg-message.data-service.js +103 -103
  492. package/build/_modules/messaging/_services/msg.controller.d.ts +12 -12
  493. package/build/_modules/messaging/_services/msg.controller.js +256 -256
  494. package/build/_modules/messaging/index.d.ts +10 -10
  495. package/build/_modules/messaging/index.js +27 -27
  496. package/build/_modules/mock/app-extended-server.mock.d.ts +41 -41
  497. package/build/_modules/mock/app-extended-server.mock.js +169 -169
  498. package/build/_modules/mock/app-integration-test.mock.d.ts +19 -19
  499. package/build/_modules/mock/app-integration-test.mock.js +45 -45
  500. package/build/_modules/mock/app-params.mock.d.ts +2 -2
  501. package/build/_modules/mock/app-params.mock.js +9 -9
  502. package/build/_modules/mock/app-server.mock.d.ts +41 -41
  503. package/build/_modules/mock/app-server.mock.js +148 -148
  504. package/build/_modules/mock/auth-service.mock.d.ts +10 -10
  505. package/build/_modules/mock/auth-service.mock.js +19 -19
  506. package/build/_modules/mock/controller.mock.d.ts +5 -5
  507. package/build/_modules/mock/controller.mock.js +14 -14
  508. package/build/_modules/mock/data-model.mock.d.ts +26 -26
  509. package/build/_modules/mock/data-model.mock.js +72 -72
  510. package/build/_modules/mock/email-service-collection.mock.d.ts +7 -7
  511. package/build/_modules/mock/email-service-collection.mock.js +12 -12
  512. package/build/_modules/mock/email-service.mock.d.ts +4 -4
  513. package/build/_modules/mock/email-service.mock.js +20 -20
  514. package/build/_modules/mock/endpoint.mock.d.ts +8 -8
  515. package/build/_modules/mock/endpoint.mock.js +79 -79
  516. package/build/_modules/mock/socket-client.mock.d.ts +9 -9
  517. package/build/_modules/mock/socket-client.mock.js +38 -38
  518. package/build/_modules/mock/socket-server.mock.d.ts +15 -15
  519. package/build/_modules/mock/socket-server.mock.js +32 -32
  520. package/build/_modules/oauth2/_routes/oauth2.controller.d.ts +16 -16
  521. package/build/_modules/oauth2/_routes/oauth2.controller.js +96 -96
  522. package/build/_modules/oauth2/_services/oauth2.auth-service.d.ts +30 -30
  523. package/build/_modules/oauth2/_services/oauth2.auth-service.js +215 -215
  524. package/build/_modules/oauth2/_services/oauth2.control-service.d.ts +132 -132
  525. package/build/_modules/oauth2/_services/oauth2.control-service.js +576 -576
  526. package/build/_modules/oauth2/index.d.ts +3 -3
  527. package/build/_modules/oauth2/index.js +14 -14
  528. package/build/_modules/privacy-lifecycle/_enums/privacy-consent-decision.type-enum.d.ts +5 -5
  529. package/build/_modules/privacy-lifecycle/_enums/privacy-consent-decision.type-enum.js +9 -9
  530. package/build/_modules/privacy-lifecycle/_enums/privacy-contributor-action.type-enum.d.ts +10 -10
  531. package/build/_modules/privacy-lifecycle/_enums/privacy-contributor-action.type-enum.js +14 -14
  532. package/build/_modules/privacy-lifecycle/_enums/privacy-contributor-outcome.type-enum.d.ts +7 -7
  533. package/build/_modules/privacy-lifecycle/_enums/privacy-contributor-outcome.type-enum.js +11 -11
  534. package/build/_modules/privacy-lifecycle/_enums/privacy-request-state.type-enum.d.ts +15 -15
  535. package/build/_modules/privacy-lifecycle/_enums/privacy-request-state.type-enum.js +19 -19
  536. package/build/_modules/privacy-lifecycle/_enums/privacy-request.type-enum.d.ts +9 -9
  537. package/build/_modules/privacy-lifecycle/_enums/privacy-request.type-enum.js +13 -13
  538. package/build/_modules/privacy-lifecycle/_models/privacy-consent-input.interface.d.ts +11 -11
  539. package/build/_modules/privacy-lifecycle/_models/privacy-consent-input.interface.js +2 -2
  540. package/build/_modules/privacy-lifecycle/_models/privacy-consent-persistence-result.interface.d.ts +6 -6
  541. package/build/_modules/privacy-lifecycle/_models/privacy-consent-persistence-result.interface.js +2 -2
  542. package/build/_modules/privacy-lifecycle/_models/privacy-consent-record.interface.d.ts +14 -14
  543. package/build/_modules/privacy-lifecycle/_models/privacy-consent-record.interface.js +2 -2
  544. package/build/_modules/privacy-lifecycle/_models/privacy-consent-result.interface.d.ts +6 -6
  545. package/build/_modules/privacy-lifecycle/_models/privacy-consent-result.interface.js +2 -2
  546. package/build/_modules/privacy-lifecycle/_models/privacy-consent-view.interface.d.ts +12 -12
  547. package/build/_modules/privacy-lifecycle/_models/privacy-consent-view.interface.js +2 -2
  548. package/build/_modules/privacy-lifecycle/_models/privacy-contributor-context.interface.d.ts +8 -8
  549. package/build/_modules/privacy-lifecycle/_models/privacy-contributor-context.interface.js +2 -2
  550. package/build/_modules/privacy-lifecycle/_models/privacy-contributor-outcome.interface.d.ts +13 -13
  551. package/build/_modules/privacy-lifecycle/_models/privacy-contributor-outcome.interface.js +2 -2
  552. package/build/_modules/privacy-lifecycle/_models/privacy-contributor-plan.interface.d.ts +7 -7
  553. package/build/_modules/privacy-lifecycle/_models/privacy-contributor-plan.interface.js +2 -2
  554. package/build/_modules/privacy-lifecycle/_models/privacy-contributor.interface.d.ts +10 -10
  555. package/build/_modules/privacy-lifecycle/_models/privacy-contributor.interface.js +2 -2
  556. package/build/_modules/privacy-lifecycle/_models/privacy-ledger-adapter.interface.d.ts +12 -12
  557. package/build/_modules/privacy-lifecycle/_models/privacy-ledger-adapter.interface.js +2 -2
  558. package/build/_modules/privacy-lifecycle/_models/privacy-ledger-result.interface.d.ts +8 -8
  559. package/build/_modules/privacy-lifecycle/_models/privacy-ledger-result.interface.js +2 -2
  560. package/build/_modules/privacy-lifecycle/_models/privacy-ledger-settings.interface.d.ts +6 -6
  561. package/build/_modules/privacy-lifecycle/_models/privacy-ledger-settings.interface.js +2 -2
  562. package/build/_modules/privacy-lifecycle/_models/privacy-legal-acceptance-input.interface.d.ts +10 -10
  563. package/build/_modules/privacy-lifecycle/_models/privacy-legal-acceptance-input.interface.js +2 -2
  564. package/build/_modules/privacy-lifecycle/_models/privacy-legal-acceptance-persistence-result.interface.d.ts +6 -6
  565. package/build/_modules/privacy-lifecycle/_models/privacy-legal-acceptance-persistence-result.interface.js +2 -2
  566. package/build/_modules/privacy-lifecycle/_models/privacy-legal-acceptance-result.interface.d.ts +6 -6
  567. package/build/_modules/privacy-lifecycle/_models/privacy-legal-acceptance-result.interface.js +2 -2
  568. package/build/_modules/privacy-lifecycle/_models/privacy-legal-acceptance-view.interface.d.ts +11 -11
  569. package/build/_modules/privacy-lifecycle/_models/privacy-legal-acceptance-view.interface.js +2 -2
  570. package/build/_modules/privacy-lifecycle/_models/privacy-legal-acceptance.interface.d.ts +13 -13
  571. package/build/_modules/privacy-lifecycle/_models/privacy-legal-acceptance.interface.js +2 -2
  572. package/build/_modules/privacy-lifecycle/_models/privacy-lifecycle-adapter.interface.d.ts +14 -14
  573. package/build/_modules/privacy-lifecycle/_models/privacy-lifecycle-adapter.interface.js +2 -2
  574. package/build/_modules/privacy-lifecycle/_models/privacy-lifecycle-settings.interface.d.ts +8 -8
  575. package/build/_modules/privacy-lifecycle/_models/privacy-lifecycle-settings.interface.js +2 -2
  576. package/build/_modules/privacy-lifecycle/_models/privacy-request-create-result.interface.d.ts +6 -6
  577. package/build/_modules/privacy-lifecycle/_models/privacy-request-create-result.interface.js +2 -2
  578. package/build/_modules/privacy-lifecycle/_models/privacy-request-open.interface.d.ts +9 -9
  579. package/build/_modules/privacy-lifecycle/_models/privacy-request-open.interface.js +2 -2
  580. package/build/_modules/privacy-lifecycle/_models/privacy-request-persistence-create-result.interface.d.ts +6 -6
  581. package/build/_modules/privacy-lifecycle/_models/privacy-request-persistence-create-result.interface.js +2 -2
  582. package/build/_modules/privacy-lifecycle/_models/privacy-request-record.interface.d.ts +20 -20
  583. package/build/_modules/privacy-lifecycle/_models/privacy-request-record.interface.js +2 -2
  584. package/build/_modules/privacy-lifecycle/_models/privacy-request-result.interface.d.ts +7 -7
  585. package/build/_modules/privacy-lifecycle/_models/privacy-request-result.interface.js +2 -2
  586. package/build/_modules/privacy-lifecycle/_models/privacy-request-view.interface.d.ts +19 -19
  587. package/build/_modules/privacy-lifecycle/_models/privacy-request-view.interface.js +2 -2
  588. package/build/_modules/privacy-lifecycle/index.d.ts +32 -32
  589. package/build/_modules/privacy-lifecycle/index.js +17 -17
  590. package/build/_modules/privacy-lifecycle/privacy-ledger.control-service.d.ts +27 -27
  591. package/build/_modules/privacy-lifecycle/privacy-ledger.control-service.js +167 -167
  592. package/build/_modules/privacy-lifecycle/privacy-lifecycle.control-service.d.ts +41 -41
  593. package/build/_modules/privacy-lifecycle/privacy-lifecycle.control-service.js +363 -363
  594. package/build/_modules/rate-limit/_enums/rate-limit-store-kind.type-enum.d.ts +5 -5
  595. package/build/_modules/rate-limit/_enums/rate-limit-store-kind.type-enum.js +9 -9
  596. package/build/_modules/rate-limit/_models/rate-limit-config.interface.d.ts +70 -70
  597. package/build/_modules/rate-limit/_models/rate-limit-config.interface.js +2 -2
  598. package/build/_modules/rate-limit/_models/rate-limit-consume-request.interface.d.ts +8 -8
  599. package/build/_modules/rate-limit/_models/rate-limit-consume-request.interface.js +2 -2
  600. package/build/_modules/rate-limit/_models/rate-limit-consume-result.interface.d.ts +6 -6
  601. package/build/_modules/rate-limit/_models/rate-limit-consume-result.interface.js +2 -2
  602. package/build/_modules/rate-limit/_models/rate-limit-policy.interface.d.ts +15 -15
  603. package/build/_modules/rate-limit/_models/rate-limit-policy.interface.js +2 -2
  604. package/build/_modules/rate-limit/_models/rate-limit-store.interface.d.ts +8 -8
  605. package/build/_modules/rate-limit/_models/rate-limit-store.interface.js +2 -2
  606. package/build/_modules/rate-limit/index.d.ts +8 -8
  607. package/build/_modules/rate-limit/index.js +9 -9
  608. package/build/_modules/rate-limit/rate-limit-in-memory.store.d.ts +18 -18
  609. package/build/_modules/rate-limit/rate-limit-in-memory.store.js +70 -70
  610. package/build/_modules/rate-limit/rate-limit.middleware.d.ts +68 -68
  611. package/build/_modules/rate-limit/rate-limit.middleware.js +378 -378
  612. package/build/_modules/scheduler/_models/scheduler-job.interface.d.ts +33 -33
  613. package/build/_modules/scheduler/_models/scheduler-job.interface.js +2 -2
  614. package/build/_modules/scheduler/get-scheduler-routing-module.util.d.ts +17 -17
  615. package/build/_modules/scheduler/get-scheduler-routing-module.util.js +30 -30
  616. package/build/_modules/scheduler/index.d.ts +4 -4
  617. package/build/_modules/scheduler/index.js +9 -9
  618. package/build/_modules/scheduler/scheduler.controller.d.ts +24 -24
  619. package/build/_modules/scheduler/scheduler.controller.js +53 -53
  620. package/build/_modules/scheduler/scheduler.service.d.ts +53 -53
  621. package/build/_modules/scheduler/scheduler.service.js +163 -163
  622. package/build/_modules/scoped-config/_enums/dynts-scoped-config-level.enum.d.ts +18 -18
  623. package/build/_modules/scoped-config/_enums/dynts-scoped-config-level.enum.js +22 -22
  624. package/build/_modules/scoped-config/_models/data-models/dynts-scoped-config.data-model.d.ts +43 -43
  625. package/build/_modules/scoped-config/_models/data-models/dynts-scoped-config.data-model.js +67 -67
  626. package/build/_modules/scoped-config/_models/interfaces/dynts-scoped-config.interface.d.ts +88 -88
  627. package/build/_modules/scoped-config/_models/interfaces/dynts-scoped-config.interface.js +11 -11
  628. package/build/_modules/scoped-config/_services/dynts-scoped-config.control-service.d.ts +83 -83
  629. package/build/_modules/scoped-config/_services/dynts-scoped-config.control-service.js +219 -219
  630. package/build/_modules/scoped-config/_services/dynts-scoped-config.data-service.d.ts +53 -53
  631. package/build/_modules/scoped-config/_services/dynts-scoped-config.data-service.js +75 -75
  632. package/build/_modules/scoped-config/index.d.ts +5 -5
  633. package/build/_modules/scoped-config/index.js +14 -14
  634. package/build/_modules/server/errors/errors.control-service.d.ts +21 -21
  635. package/build/_modules/server/errors/errors.control-service.js +10 -10
  636. package/build/_modules/server/errors/errors.controller.d.ts +144 -144
  637. package/build/_modules/server/errors/errors.controller.js +404 -404
  638. package/build/_modules/server/errors/errors.data-service.d.ts +70 -70
  639. package/build/_modules/server/errors/errors.data-service.js +677 -677
  640. package/build/_modules/server/index.d.ts +15 -15
  641. package/build/_modules/server/index.js +35 -35
  642. package/build/_modules/server/safe-diagnostic/safe-diagnostic-cause.type-enum.d.ts +8 -8
  643. package/build/_modules/server/safe-diagnostic/safe-diagnostic-cause.type-enum.js +12 -12
  644. package/build/_modules/server/safe-diagnostic/safe-diagnostic-stage.type-enum.d.ts +20 -19
  645. package/build/_modules/server/safe-diagnostic/safe-diagnostic-stage.type-enum.d.ts.map +1 -1
  646. package/build/_modules/server/safe-diagnostic/safe-diagnostic-stage.type-enum.js +24 -23
  647. package/build/_modules/server/safe-diagnostic/safe-diagnostic-stage.type-enum.js.map +1 -1
  648. package/build/_modules/server/safe-diagnostic/safe-diagnostic.control-service.d.ts +18 -18
  649. package/build/_modules/server/safe-diagnostic/safe-diagnostic.control-service.js +82 -82
  650. package/build/_modules/server/safe-diagnostic/safe-diagnostic.interface.d.ts +18 -18
  651. package/build/_modules/server/safe-diagnostic/safe-diagnostic.interface.js +2 -2
  652. package/build/_modules/server/server-status/db-readiness-probe-code.type-enum.d.ts +13 -13
  653. package/build/_modules/server/server-status/db-readiness-probe-code.type-enum.js +17 -17
  654. package/build/_modules/server/server-status/db-readiness-probe-stage.type-enum.d.ts +7 -7
  655. package/build/_modules/server/server-status/db-readiness-probe-stage.type-enum.js +11 -11
  656. package/build/_modules/server/server-status/db-readiness-probe.control-service.d.ts +13 -13
  657. package/build/_modules/server/server-status/db-readiness-probe.control-service.js +125 -125
  658. package/build/_modules/server/server-status/db-readiness-probe.interface.d.ts +17 -17
  659. package/build/_modules/server/server-status/db-readiness-probe.interface.js +2 -2
  660. package/build/_modules/server/server-status/server-status-snapshot.control-service.d.ts +4 -4
  661. package/build/_modules/server/server-status/server-status-snapshot.control-service.js +7 -7
  662. package/build/_modules/server/server-status/server-status-snapshot.data-service.d.ts +6 -6
  663. package/build/_modules/server/server-status/server-status-snapshot.data-service.js +22 -22
  664. package/build/_modules/server/server-status/server-status.control-service.d.ts +111 -111
  665. package/build/_modules/server/server-status/server-status.control-service.js +302 -302
  666. package/build/_modules/server/server-status/server-status.controller.d.ts +92 -92
  667. package/build/_modules/server/server-status/server-status.controller.js +253 -253
  668. package/build/_modules/socket/_enums/socket-security.enum.d.ts +10 -10
  669. package/build/_modules/socket/_enums/socket-security.enum.js +14 -14
  670. package/build/_modules/socket/_models/socket-client-service-params.control-model.d.ts +8 -8
  671. package/build/_modules/socket/_models/socket-client-service-params.control-model.js +16 -16
  672. package/build/_modules/socket/_models/socket-presence.control-model.d.ts +25 -25
  673. package/build/_modules/socket/_models/socket-presence.control-model.js +140 -140
  674. package/build/_modules/socket/_models/socket-server-service-params.control-model.d.ts +22 -22
  675. package/build/_modules/socket/_models/socket-server-service-params.control-model.js +31 -31
  676. package/build/_modules/socket/_services/socket-client.service.d.ts +37 -37
  677. package/build/_modules/socket/_services/socket-client.service.js +196 -196
  678. package/build/_modules/socket/_services/socket-server.service.d.ts +98 -98
  679. package/build/_modules/socket/_services/socket-server.service.js +673 -673
  680. package/build/_modules/socket/app-extended.server.d.ts +145 -145
  681. package/build/_modules/socket/app-extended.server.js +521 -521
  682. package/build/_modules/socket/index.d.ts +8 -8
  683. package/build/_modules/socket/index.js +35 -35
  684. package/build/_modules/test/get-test-routing-module.util.d.ts +3 -3
  685. package/build/_modules/test/get-test-routing-module.util.js +16 -16
  686. package/build/_modules/test/index.d.ts +3 -3
  687. package/build/_modules/test/index.js +11 -11
  688. package/build/_modules/test/test.controller.d.ts +5 -5
  689. package/build/_modules/test/test.controller.js +103 -103
  690. package/build/_modules/test-email-sink/_collections/test-email-pattern.const.d.ts +10 -10
  691. package/build/_modules/test-email-sink/_collections/test-email-pattern.const.js +13 -13
  692. package/build/_modules/test-email-sink/_models/data-models/dynts-sent-test-mail.data-model.d.ts +21 -21
  693. package/build/_modules/test-email-sink/_models/data-models/dynts-sent-test-mail.data-model.js +38 -38
  694. package/build/_modules/test-email-sink/_services/dynts-test-email-sink.service.d.ts +49 -49
  695. package/build/_modules/test-email-sink/_services/dynts-test-email-sink.service.js +117 -117
  696. package/build/_modules/test-email-sink/get-sent-mail-routing-module.util.d.ts +14 -14
  697. package/build/_modules/test-email-sink/get-sent-mail-routing-module.util.js +26 -26
  698. package/build/_modules/test-email-sink/index.d.ts +11 -11
  699. package/build/_modules/test-email-sink/index.js +14 -14
  700. package/build/_modules/test-email-sink/test-email-sink.controller.d.ts +23 -23
  701. package/build/_modules/test-email-sink/test-email-sink.controller.js +66 -66
  702. package/build/_modules/usage/get-usage-routing-module.util.d.ts +3 -3
  703. package/build/_modules/usage/get-usage-routing-module.util.js +16 -16
  704. package/build/_modules/usage/index.d.ts +4 -4
  705. package/build/_modules/usage/index.js +13 -13
  706. package/build/_modules/usage/usage.controller.d.ts +6 -6
  707. package/build/_modules/usage/usage.controller.js +105 -105
  708. package/build/_modules/usage/usage.data-service.d.ts +17 -17
  709. package/build/_modules/usage/usage.data-service.js +135 -135
  710. package/build/_services/base/api.service-base.d.ts +9 -9
  711. package/build/_services/base/api.service-base.js +46 -46
  712. package/build/_services/base/archive-data.service.d.ts +25 -25
  713. package/build/_services/base/archive-data.service.js +151 -151
  714. package/build/_services/base/data.service.d.ts +402 -402
  715. package/build/_services/base/data.service.js +2131 -2131
  716. package/build/_services/base/db.service.d.ts +424 -424
  717. package/build/_services/base/db.service.js +1356 -1356
  718. package/build/_services/base/singleton.service-base.d.ts +8 -8
  719. package/build/_services/base/singleton.service-base.js +21 -21
  720. package/build/_services/base/singleton.service.d.ts +11 -11
  721. package/build/_services/base/singleton.service.js +31 -31
  722. package/build/_services/core/api.service.d.ts +45 -45
  723. package/build/_services/core/api.service.js +456 -456
  724. package/build/_services/core/auth.service.d.ts +129 -129
  725. package/build/_services/core/auth.service.js +59 -59
  726. package/build/_services/core/collection-growth-monitor.service.d.ts +76 -76
  727. package/build/_services/core/collection-growth-monitor.service.js +165 -165
  728. package/build/_services/core/db-stats.service.d.ts +33 -33
  729. package/build/_services/core/db-stats.service.js +64 -64
  730. package/build/_services/core/diagnostics.service.d.ts +42 -42
  731. package/build/_services/core/diagnostics.service.js +121 -121
  732. package/build/_services/core/email.service.d.ts +77 -77
  733. package/build/_services/core/email.service.js +503 -503
  734. package/build/_services/core/event-loop-diag.service.d.ts +49 -49
  735. package/build/_services/core/event-loop-diag.service.js +106 -106
  736. package/build/_services/core/global.service.d.ts +83 -83
  737. package/build/_services/core/global.service.js +386 -386
  738. package/build/_services/core/memory-guard.service.d.ts +166 -166
  739. package/build/_services/core/memory-guard.service.js +369 -369
  740. package/build/_services/core/migration-runner.service.d.ts +39 -39
  741. package/build/_services/core/migration-runner.service.js +74 -74
  742. package/build/_services/core/mongo-transaction.control-service.d.ts +18 -18
  743. package/build/_services/core/mongo-transaction.control-service.js +94 -94
  744. package/build/_services/core/request-hunter.service.d.ts +73 -73
  745. package/build/_services/core/request-hunter.service.js +122 -122
  746. package/build/_services/core/service-collection.service.d.ts +4 -4
  747. package/build/_services/core/service-collection.service.js +7 -7
  748. package/build/_services/route/controller.service.d.ts +124 -124
  749. package/build/_services/route/controller.service.js +95 -95
  750. package/build/_services/route/routing-module.service.d.ts +80 -80
  751. package/build/_services/route/routing-module.service.js +250 -250
  752. package/build/_services/server/app.server.d.ts +429 -429
  753. package/build/_services/server/app.server.js +1226 -1226
  754. package/build/_services/shared.static-service.d.ts +43 -36
  755. package/build/_services/shared.static-service.d.ts.map +1 -1
  756. package/build/_services/shared.static-service.js +92 -72
  757. package/build/_services/shared.static-service.js.map +1 -1
  758. package/build/index.d.ts +63 -63
  759. package/build/index.js +101 -101
  760. package/package.json +15 -9
  761. package/src/_models/control-models/app-params.control-model.spec.ts +23 -23
  762. package/src/_models/control-models/app-params.control-model.ts +10 -10
  763. package/src/_models/control-models/endpoint-params.control-model.spec.ts +102 -17
  764. package/src/_models/control-models/endpoint-params.control-model.ts +131 -220
  765. package/src/_modules/server/index.ts +8 -8
  766. package/src/_modules/server/safe-diagnostic/safe-diagnostic-cause.type-enum.ts +8 -8
  767. package/src/_modules/server/safe-diagnostic/safe-diagnostic-stage.type-enum.ts +18 -17
  768. package/src/_modules/server/safe-diagnostic/safe-diagnostic.control-service.spec.ts +124 -124
  769. package/src/_modules/server/safe-diagnostic/safe-diagnostic.control-service.ts +99 -99
  770. package/src/_modules/server/safe-diagnostic/safe-diagnostic.interface.ts +20 -20
  771. package/src/_services/core/global.service.ts +55 -55
  772. package/src/_services/server/app-safe-diagnostic.spec.ts +124 -124
  773. package/src/_services/server/app.server.ts +294 -294
  774. package/src/_services/shared.static-service.spec.ts +43 -9
  775. package/src/_services/shared.static-service.ts +37 -8
@@ -1,674 +1,674 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DyNTS_SocketServerService = void 0;
4
- const fsm_dynamo_1 = require("@futdevpro/fsm-dynamo");
5
- const socket_1 = require("@futdevpro/fsm-dynamo/socket");
6
- const global_settings_const_1 = require("../../../_collections/global-settings.const");
7
- const singleton_service_1 = require("../../../_services/base/singleton.service");
8
- const socket_security_enum_1 = require("../_enums/socket-security.enum");
9
- /**
10
- * You need to define the following functions:
11
- * ```ts
12
- * getServiceParams(): DyNTS_SocketServerServiceParams;
13
- *
14
- * getIncomingEvents(): DyFM_SocketEvent<any>[];
15
- *
16
- * getPresenceFromSubscriptionEventContent(
17
- * socketSubscription: T_SubscriptionContent,
18
- * socket: SocketIO.Socket
19
- * ): Promise<T_Presence>;
20
- * ```
21
- */
22
- class DyNTS_SocketServerService extends singleton_service_1.DyNTS_SingletonService {
23
- params;
24
- get name() { return this.params.name; }
25
- get port() { return this.params.port; }
26
- /** BFR-MASTERPROMPTER-025: explicit dedikált-listener opt-in (default false = shared). */
27
- get dedicatedPort() { return this.params.dedicatedPort ?? false; }
28
- get security() { return this.params.security; }
29
- get activeSubscriptionsCount() { return this.presences.length; }
30
- openSocketServer;
31
- secureSocketServer;
32
- /* private connectEvent: DyFM_SocketEvent<SocketIO.Socket>; */
33
- incomingEvents;
34
- /* private subscriptionEvent: DyFM_SocketEvent<any>; */
35
- /* private unsubscribeEvent: DyFM_SocketEvent<any>; */
36
- presences = [];
37
- disconnectedSockets = new WeakSet();
38
- get logSetup() { return global_settings_const_1.DyNTS_global_settings.log_settings.setup; }
39
- get highDetailedLogs() { return global_settings_const_1.DyNTS_global_settings.log_settings.highDetailedLogs; }
40
- defaultErrorUserMsg = `We encountered an unhandled Socket Server Error, ` +
41
- `\nplease contact the responsible development team.`;
42
- /* readonly thisLocationStack: string; */
43
- constructor() {
44
- super();
45
- /* this.thisLocationStack = DyNTS_getStackLocation(); */
46
- this.asyncConstructor().catch((error) => {
47
- fsm_dynamo_1.DyFM_Log.error(`Socket Server Service setup failed: "${this.params?.name}" (${this.params?.port})`, error);
48
- });
49
- }
50
- async asyncConstructor() {
51
- try {
52
- this.params = this.getServiceParams();
53
- this.incomingEvents = this.getIncomingEvents() ?? [];
54
- await this.prepareEvents();
55
- if (this.logSetup)
56
- console.log(`Socket Server Service setup done: "${this.params.name}" (${this.params.port}) ` +
57
- `security: ${this.params.security}\n`);
58
- }
59
- catch (error) {
60
- fsm_dynamo_1.DyFM_Log.error(`Socket Server Service setup failed: "${this.params?.name}" (${this.params?.port})`, error);
61
- throw new fsm_dynamo_1.DyFM_Error({
62
- errorCode: `${global_settings_const_1.DyNTS_global_settings.systemShortCodeName}|DyNTS-SSS-GPFSRC0`,
63
- error: error,
64
- });
65
- }
66
- }
67
- /**
68
- * You must setup events and required services for this function
69
- */
70
- async prepareEvents() {
71
- try {
72
- /** Setup connect event */
73
- /* const connectEventIndex = this.incomingEvents.findIndex(
74
- (event: DyFM_SocketEvent<any>) =>
75
- event.eventKey === DyFM_SocketEvent_Key.connection
76
- );
77
-
78
- if (0 <= connectEventIndex) {
79
- this.connectEvent = this.incomingEvents.splice(connectEventIndex)[0];
80
- } else {
81
- this.connectEvent = new DyFM_SocketEvent({
82
- eventKey: DyFM_SocketEvent_Key.connection,
83
- });
84
- }
85
- this.connectEvent.serviceName = this.params.name; */
86
- if (!this.getPresenceFromSubscriptionEventContent) {
87
- throw new fsm_dynamo_1.DyFM_Error({
88
- error: new Error('getPresenceFromSubscriptionEventContent must be set'),
89
- errorCode: `${global_settings_const_1.DyNTS_global_settings.systemShortCodeName}|DyNTS-SSS-PPE1`,
90
- });
91
- }
92
- if (!this.getSubscriptionTasks) {
93
- fsm_dynamo_1.DyFM_Log.warn(`You should not set the subscription event, ` +
94
- `in case you need additional steps for your subscriptions.`, `${this.params.name} (${this.params.port})`);
95
- }
96
- if (this.incomingEvents.find((event) => event.eventKey === socket_1.DyFM_SocketEvent_Key.subscribe)) {
97
- fsm_dynamo_1.DyFM_Log.warn(`You need to use getSubscriptionTasks() ` +
98
- `instead of setting the subscribe event in getIncomingEvents().`, `${this.params.name} (${this.params.port})`);
99
- }
100
- if (!this.incomingEvents.find((event) => event.eventKey === socket_1.DyFM_SocketEvent_Key.unsubscribe)) {
101
- fsm_dynamo_1.DyFM_Log.warn(`You should not set the unsubscribe event, ` +
102
- `in case you need additional steps for your unsubscribe.`, `${this.params.name} (${this.params.port})`);
103
- }
104
- if (this.incomingEvents.find((event) => !event.eventKey)) {
105
- throw new fsm_dynamo_1.DyFM_Error({
106
- error: new Error('eventKey must be set'),
107
- errorCode: `${global_settings_const_1.DyNTS_global_settings.systemShortCodeName}|DyNTS-SSS-PPE2`,
108
- });
109
- }
110
- this.incomingEvents.push(new socket_1.DyFM_SocketEvent({
111
- eventKey: socket_1.DyFM_SocketEvent_Key.disconnect,
112
- }));
113
- if (this.errorHandling) {
114
- this.incomingEvents.push(new socket_1.DyFM_SocketEvent({
115
- serviceName: this.params.name,
116
- eventKey: socket_1.DyFM_SocketEvent_Key.error,
117
- tasks: [
118
- async (content) => this.errorHandling(content),
119
- ],
120
- }));
121
- }
122
- else {
123
- fsm_dynamo_1.DyFM_Log.warn(`You should not set the error event, ` +
124
- `in case you need additional steps for your error.`, `${this.params.name} (${this.params.port})`);
125
- this.incomingEvents.push(new socket_1.DyFM_SocketEvent({
126
- serviceName: this.params.name,
127
- eventKey: socket_1.DyFM_SocketEvent_Key.error,
128
- tasks: [
129
- async (content) => {
130
- if (content instanceof fsm_dynamo_1.DyFM_Error) {
131
- content.logSimple(`=--> socket-client (${this.params.name}) ERROR`);
132
- }
133
- else {
134
- fsm_dynamo_1.DyFM_Log.error(`=--> socket-client (${this.params.name}) ERROR:`, content);
135
- }
136
- }
137
- ],
138
- }));
139
- }
140
- // Merge incoming events of the same eventKey
141
- const eventKeys = this.incomingEvents.map((event) => event.eventKey).filter((eventKey, index, self) => self.indexOf(eventKey) === index);
142
- const mergedEvents = [];
143
- eventKeys.forEach((eventKey) => {
144
- const events = this.incomingEvents.filter((event) => event.eventKey === eventKey);
145
- mergedEvents.push(new socket_1.DyFM_SocketEvent({
146
- eventKey: eventKey,
147
- preProcesses: events.map((event) => event.preProcesses).flat(),
148
- tasks: events.map((event) => event.tasks).flat(),
149
- }));
150
- });
151
- this.incomingEvents = mergedEvents;
152
- if (global_settings_const_1.DyNTS_global_settings.log_settings.setup) {
153
- fsm_dynamo_1.DyFM_Log.log(`Socket Server Service - Event Preparation setup done: ` +
154
- `"${this.params?.name}" (${this.params?.port})` +
155
- `\nincomingEvents:`, this.incomingEvents.map((event) => `\n\t"${event.eventKey}": preProcesses: ${event.preProcesses?.length} ` +
156
- `tasks: ${event.tasks?.length}`));
157
- }
158
- // Set incoming events serviceName
159
- this.incomingEvents.forEach((event) => {
160
- event.serviceName = this.params.name;
161
- });
162
- }
163
- catch (error) {
164
- fsm_dynamo_1.DyFM_Log.error(`Socket Server Service - Event Preparation setup failed: ` +
165
- `"${this.params?.name}" (${this.params?.port})`, error);
166
- throw error;
167
- }
168
- }
169
- // eslint-disable-next-line max-lines-per-function
170
- async setupSocketServer(newSocketServer, security, successCallback, options) {
171
- try {
172
- if (this.highDetailedLogs)
173
- console.log('\nfn:. setupSocketServer');
174
- const effectivePort = options?.effectivePort ?? this.params.port;
175
- newSocketServer.on(socket_1.DyFM_SocketEvent_Key.incomingNewConnection, async (socket) => {
176
- try {
177
- let issuer = `${this.params.name} anonymous socket`;
178
- /* await this.connectEvent.executeEventTasks(socket); */
179
- await fsm_dynamo_1.DyFM_Array.asyncForEach(this.incomingEvents.filter((event) => event.eventKey === socket_1.DyFM_SocketEvent_Key.incomingNewConnection), async (event) => {
180
- await event.executeEventTasks(socket);
181
- });
182
- if (this.getPresenceFromSubscriptionEventContent) {
183
- socket.on(socket_1.DyFM_SocketEvent_Key.subscribe, async (content) => {
184
- let presence;
185
- try {
186
- /**
187
- * usually socket logs are in event.executeEventTasks(),
188
- * but subscribe event is an exception from this,
189
- * to be able to check content before getPresenceFromSubscriptionEventContent
190
- */
191
- if (global_settings_const_1.DyNTS_global_settings.log_settings.socket_eventContent) {
192
- fsm_dynamo_1.DyFM_Log.log(`--=> incoming socket (${this.params.name}) ` +
193
- `event: "${socket_1.DyFM_SocketEvent_Key.subscribe}";` +
194
- `\ncontent:`, content);
195
- }
196
- else {
197
- fsm_dynamo_1.DyFM_Log.log(`--=> incoming socket (${this.params.name}) ` +
198
- `event: "${socket_1.DyFM_SocketEvent_Key.subscribe}"`);
199
- }
200
- presence = await this.getPresenceFromSubscriptionEventContent(content, socket);
201
- presence.serviceName = this.params.name;
202
- issuer = presence.issuerLocalId;
203
- await this.addSocketToPresence(presence);
204
- /* await this.subscriptionEvent.executeEventTasks(content, issuer); */
205
- if (this.getSubscriptionTasks) {
206
- await fsm_dynamo_1.DyFM_Array.asyncForEach(this.getSubscriptionTasks(), async (task) => {
207
- await task(content, issuer);
208
- });
209
- }
210
- socket.emit(socket_1.DyFM_SocketEvent_Key.subscriptionSuccessful, 'subscribe was successful', error => {
211
- fsm_dynamo_1.DyFM_Log.error(`Emitting subscriptionSuccessful event failed!` +
212
- `\nerror:`, error);
213
- });
214
- fsm_dynamo_1.DyFM_Log.success(`<-==> socket(${this.params.name}) subscription successful (${issuer})`);
215
- }
216
- catch (error) {
217
- if (error instanceof fsm_dynamo_1.DyFM_Error) {
218
- error.logShort(`Socket Subscription failed: "${this.params.name}" ` +
219
- `(${this.params.port}) will disconnect now...`);
220
- }
221
- else if (global_settings_const_1.DyNTS_global_settings.log_settings.socket_eventContent) {
222
- fsm_dynamo_1.DyFM_Log.error(`Socket Subscription failed: "${this.params.name}" ` +
223
- `(${this.params.port}) will disconnect now...`,
224
- /* `${this.thisLocationStack}`, */
225
- error);
226
- }
227
- else {
228
- fsm_dynamo_1.DyFM_Log.error(`Socket Subscription failed: "${this.params.name}" `, `(${this.params.port}) will disconnect now...`);
229
- }
230
- await this.closeSocket(socket, issuer, error);
231
- }
232
- });
233
- socket.on(socket_1.DyFM_SocketEvent_Key.unsubscribe, async (issuer) => {
234
- try {
235
- /**
236
- * usually socket logs are in event.executeEventTasks(),
237
- * but unsubscribe event is an exception from this,
238
- * to be able to check content before getPresenceFromSubscriptionEventContent
239
- */
240
- if (global_settings_const_1.DyNTS_global_settings.log_settings.socket_eventContent) {
241
- fsm_dynamo_1.DyFM_Log.log(`--=> incoming socket (${this.params.name}) ` +
242
- `event: ${socket_1.DyFM_SocketEvent_Key.unsubscribe};` +
243
- `\ncontent:`, issuer);
244
- }
245
- else {
246
- fsm_dynamo_1.DyFM_Log.log(`--=> incoming socket (${this.params.name}) ` +
247
- `event: ${socket_1.DyFM_SocketEvent_Key.unsubscribe}`);
248
- }
249
- /* await this.unsubscribeEvent.executeEventTasks(null, issuer); */
250
- await fsm_dynamo_1.DyFM_Array.asyncForEach(this.incomingEvents.filter((event) => event.eventKey === socket_1.DyFM_SocketEvent_Key.unsubscribe), async (event) => {
251
- await event.executeEventTasks(null, issuer);
252
- });
253
- await this.removeSubscription(socket, issuer);
254
- fsm_dynamo_1.DyFM_Log.success(`< x > socket(${this.params.name}) unsubscribe successful (${issuer})`);
255
- }
256
- catch (error) {
257
- if (error instanceof fsm_dynamo_1.DyFM_Error) {
258
- error.logSimple(`Socket Unsubscription failed: "${this.params.name}" ` +
259
- `(${this.params.port}) will disconnect now...`);
260
- }
261
- else if (global_settings_const_1.DyNTS_global_settings.log_settings.socket_eventContent) {
262
- fsm_dynamo_1.DyFM_Log.error(`Socket unsubscribe failed: "${this.params.name}" `, `(${this.params.port}) will disconnect now...`, error);
263
- }
264
- else {
265
- fsm_dynamo_1.DyFM_Log.error(`Socket unsubscribe failed: "${this.params.name}" `, `(${this.params.port}) will disconnect now...`);
266
- }
267
- socket.emit(socket_1.DyFM_SocketEvent_Key.error, error);
268
- await this.removeSubscription(socket, issuer);
269
- }
270
- });
271
- }
272
- this.incomingEvents.filter((event) => event.eventKey !== socket_1.DyFM_SocketEvent_Key.incomingNewConnection &&
273
- event.eventKey !== socket_1.DyFM_SocketEvent_Key.subscribe &&
274
- event.eventKey !== socket_1.DyFM_SocketEvent_Key.unsubscribe).forEach((event) => {
275
- socket.on(event.eventKey, async (content) => {
276
- try {
277
- if (event.eventKey === socket_1.DyFM_SocketEvent_Key.disconnect) {
278
- await this.executeDisconnectTasks(socket, issuer);
279
- }
280
- else {
281
- await event.executeEventTasks(content, issuer, socket);
282
- }
283
- }
284
- catch (error) {
285
- if (error instanceof fsm_dynamo_1.DyFM_Error) {
286
- error.logSimple(`Socket Event failed: "${this.params.name}" (${this.params.port})`);
287
- }
288
- else {
289
- fsm_dynamo_1.DyFM_Log.error(`Socket Event failed: "${this.params.name}" (${this.params.port})`, error);
290
- }
291
- socket.emit(socket_1.DyFM_SocketEvent_Key.error, error);
292
- }
293
- });
294
- });
295
- if (global_settings_const_1.DyNTS_global_settings.log_settings.socket_mainEvents) {
296
- fsm_dynamo_1.DyFM_Log.success(`< > socket(${this.params.name}): new CONNECTION established`);
297
- }
298
- }
299
- catch (error) {
300
- if (error instanceof fsm_dynamo_1.DyFM_Error) {
301
- error.logSimple(`Socket Connection failed: "${this.params.name}" ` +
302
- `(${this.params.port}) will disconnect now...`);
303
- }
304
- else {
305
- fsm_dynamo_1.DyFM_Log.error(`Socket Connection failed: "${this.params.name}" ` +
306
- `(${this.params.port}) will disconnect now...`, error);
307
- }
308
- await this.closeSocket(socket, `${this.params.name} on connection error`, error);
309
- }
310
- });
311
- const isAttach = options?.attachedToExistingServer === true ||
312
- (this.params.port === undefined && options?.effectivePort !== undefined);
313
- if (isAttach) {
314
- fsm_dynamo_1.DyFM_Log.success(`\nsocket server setup finished: "${this.params.name}"` +
315
- (effectivePort !== undefined ? ` (attached to server on port: ${effectivePort})` : ' (attached to existing server)'));
316
- successCallback();
317
- }
318
- else {
319
- try {
320
- const portToListen = this.params.port ?? options?.effectivePort;
321
- if (portToListen === undefined) {
322
- throw new Error(`PORT NOT SET: "${this.params.name}". ` +
323
- `Either set port in getServiceParams() or pass effectivePort in setupSocketServer options.`);
324
- }
325
- newSocketServer.listen(portToListen);
326
- fsm_dynamo_1.DyFM_Log.success(`\nsocket server setup finished: "${this.params.name}"` +
327
- `\nsocket server listening on port: "${portToListen}"`);
328
- }
329
- catch (listenError) {
330
- const portForMsg = this.params.port ?? options?.effectivePort;
331
- const errorMessage = `Failed to bind socket server "${this.params.name}" to port ${portForMsg}. ` +
332
- `This could be due to port already in use or insufficient permissions. ` +
333
- `Please ensure the port is available and try again.`;
334
- fsm_dynamo_1.DyFM_Log.error(errorMessage, listenError);
335
- throw new Error(errorMessage);
336
- }
337
- successCallback();
338
- }
339
- if (security === socket_security_enum_1.DyNTS_SocketSecurity.open) {
340
- this.openSocketServer = newSocketServer;
341
- return this.openSocketServer;
342
- }
343
- else {
344
- this.secureSocketServer = newSocketServer;
345
- return this.secureSocketServer;
346
- }
347
- }
348
- catch (error) {
349
- if (error instanceof fsm_dynamo_1.DyFM_Error) {
350
- error.logSimple(`Socket Server Service - Deep Setup failed: "${this.params?.name}" ` +
351
- `(${this.params?.port})`);
352
- }
353
- else {
354
- fsm_dynamo_1.DyFM_Log.error(`Socket Server Service - Deep Setup failed: "${this.params?.name}" ` +
355
- `(${this.params?.port})`, error);
356
- }
357
- throw error;
358
- }
359
- }
360
- async addSocketToPresence(newPresence) {
361
- try {
362
- const activePresence = this.presences.find((pres) => pres.issuerLocalId === newPresence.issuerLocalId);
363
- if (activePresence) {
364
- activePresence.sockets.push(...newPresence.sockets);
365
- }
366
- else {
367
- this.presences.push(newPresence);
368
- }
369
- }
370
- catch (error) {
371
- if (error instanceof fsm_dynamo_1.DyFM_Error) {
372
- error.logShort(`Socket Subscription failed: "${this.params?.name}" (${this.params?.port})`);
373
- }
374
- else if (global_settings_const_1.DyNTS_global_settings.log_settings.socket_eventContent) {
375
- fsm_dynamo_1.DyFM_Log.error(`Socket Subscription failed: "${this.params?.name}" (${this.params?.port})`,
376
- /* `${this.thisLocationStack}`, */
377
- error);
378
- }
379
- else {
380
- fsm_dynamo_1.DyFM_Log.error(`Socket Subscription failed: "${this.params?.name}" (${this.params?.port})`);
381
- }
382
- throw error;
383
- }
384
- }
385
- async closeSocket(socket, issuer, withError) {
386
- try {
387
- if (withError) {
388
- socket.emit(socket_1.DyFM_SocketEvent_Key.error, withError);
389
- }
390
- await this.executeDisconnectTasks(socket, issuer);
391
- /* if (this.getSubscriptionCloseTasks) {
392
- await DyFM_Array.asyncForEach(
393
- this.getSubscriptionCloseTasks(),
394
- async (task: DyFM_SocketEventTask<null>) => {
395
- await task(null, issuer);
396
- }
397
- );
398
- } */
399
- socket.disconnect();
400
- }
401
- catch (error) {
402
- throw new fsm_dynamo_1.DyFM_Error({
403
- ...this._getDefaultErrorSettings('closeSocket', error),
404
- errorCode: `${global_settings_const_1.DyNTS_global_settings.systemShortCodeName}|DyNTS-SSS-CS0`,
405
- });
406
- }
407
- }
408
- /** Disconnect taskokat socketenkent pontosan egyszer, magaval a sockettel futtatja. */
409
- async executeDisconnectTasks(socket, issuer) {
410
- if (this.disconnectedSockets.has(socket)) {
411
- return;
412
- }
413
- this.disconnectedSockets.add(socket);
414
- try {
415
- await fsm_dynamo_1.DyFM_Array.asyncForEach(this.incomingEvents.filter((event) => event.eventKey === socket_1.DyFM_SocketEvent_Key.disconnect), async (event) => {
416
- await event.executeEventTasks(socket, issuer);
417
- });
418
- await this.removeSocketFromPresence(socket);
419
- fsm_dynamo_1.DyFM_Log.info(`< x > socket(${this.params.name}) disconnected (${issuer})`);
420
- }
421
- catch (error) {
422
- this.disconnectedSockets.delete(socket);
423
- throw error;
424
- }
425
- }
426
- async removeSocketFromPresence(socket) {
427
- try {
428
- const presence = this.presences.find((pres) => pres.sockets.includes(socket));
429
- if (presence) {
430
- const socketIndex = presence.sockets.indexOf(socket);
431
- if (socketIndex !== -1) {
432
- presence.sockets.splice(socketIndex, 1);
433
- }
434
- if (presence.sockets.length === 0) {
435
- const presenceIndex = this.presences.indexOf(presence);
436
- if (presenceIndex !== -1) {
437
- this.presences.splice(presenceIndex, 1);
438
- }
439
- }
440
- }
441
- }
442
- catch (error) {
443
- throw new fsm_dynamo_1.DyFM_Error({
444
- ...this._getDefaultErrorSettings('removeSocketFromPresence', error),
445
- errorCode: `${global_settings_const_1.DyNTS_global_settings.systemShortCodeName}|DyNTS-SSS-RSO0`,
446
- });
447
- }
448
- }
449
- async removeSubscription(socket, issuer) {
450
- try {
451
- if (!this.presences.length) {
452
- throw new fsm_dynamo_1.DyFM_Error({
453
- ...this._getDefaultErrorSettings('removeSubscription', new Error(`No presences found (${this.params.name})`), issuer ?? 'unknown issuer'),
454
- errorCode: `${global_settings_const_1.DyNTS_global_settings.systemShortCodeName}|DyNTS-SSS-RS1`,
455
- });
456
- }
457
- const activePresenceIndex = this.presences.findIndex((pres) => pres.sockets.includes(socket));
458
- if (activePresenceIndex === -1) {
459
- throw new fsm_dynamo_1.DyFM_Error({
460
- ...this._getDefaultErrorSettings('sendEventForId', new Error(`closing socket (${this.params.name}) does not match any in the activePresences`), issuer ?? 'unknown issuer'),
461
- errorCode: `${global_settings_const_1.DyNTS_global_settings.systemShortCodeName}|DyNTS-SSS-RS2`,
462
- });
463
- }
464
- const activePresence = this.presences[activePresenceIndex];
465
- if (issuer && activePresence.issuerLocalId !== issuer) {
466
- throw new fsm_dynamo_1.DyFM_Error({
467
- ...this._getDefaultErrorSettings('sendEventForId', new Error(`socket unsubscription for "${issuer}" and ` +
468
- `"${activePresence.issuerLocalId}" does not match.`), issuer),
469
- errorCode: `${global_settings_const_1.DyNTS_global_settings.systemShortCodeName}|DyNTS-SSS-RS3`,
470
- });
471
- }
472
- const socketIndex = activePresence.sockets.findIndex((s) => s === socket);
473
- if (socketIndex === -1) {
474
- throw new fsm_dynamo_1.DyFM_Error({
475
- ...this._getDefaultErrorSettings('sendEventForId', new Error(`closing socket (${this.params.name}) does not match any in the activePresences`), activePresence.issuerLocalId),
476
- errorCode: `${global_settings_const_1.DyNTS_global_settings.systemShortCodeName}|DyNTS-SSS-RS4`,
477
- });
478
- }
479
- activePresence.sockets.splice(socketIndex, 1);
480
- await fsm_dynamo_1.DyFM_Array.asyncForEach(this.incomingEvents.filter((event) => event.eventKey === socket_1.DyFM_SocketEvent_Key.unsubscribeSuccessful), async (event) => {
481
- await event.executeEventTasks(null, issuer);
482
- });
483
- /* if (this.getSubscriptionCloseTasks) {
484
- await DyFM_Array.asyncForEach(
485
- this.getSubscriptionCloseTasks(),
486
- async (task: DyFM_SocketEventTask<null>) => {
487
- await task(null, issuer);
488
- }
489
- );
490
- } */
491
- if (activePresence.sockets.length === 0) {
492
- this.presences.splice(activePresenceIndex, 1);
493
- }
494
- socket.emit(socket_1.DyFM_SocketEvent_Key.unsubscribeSuccessful, 'unsubscribe was successful');
495
- socket.disconnect();
496
- fsm_dynamo_1.DyFM_Log.info(`<x==> socket (${this.params.name}) unsubscription successful (${issuer})`);
497
- }
498
- catch (error) {
499
- throw new fsm_dynamo_1.DyFM_Error({
500
- ...this._getDefaultErrorSettings('sendEventForId', error, issuer ?? 'unknown issuer'),
501
- errorCode: `${global_settings_const_1.DyNTS_global_settings.systemShortCodeName}|DyNTS-SSS-RS0`,
502
- message: `socket (${this.params.name}) Subscription Removal failed: "${this.params?.name}"`,
503
- });
504
- }
505
- }
506
- /* emitServerEvent(event: string, content: any): void {
507
- try {
508
- DyFM_Log.log(` <=-- emitting server socket(${this.params.name}) event: ${event}`);
509
-
510
- this.openSocketServer.emit(event, content, error => {
511
- DyFM_Log.error(`Emitting server event '${event}' failed!\nerror:`, error);
512
- });
513
- } catch (error) {
514
- throw new DyFM_Error({
515
- ...this._getDefaultErrorSettings(
516
- 'emitEvent',
517
- error
518
- ),
519
-
520
- errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-SSS-500',
521
- message: `socket(${this.params.name}) Event Emit (${event}) failed: ${this.params?.name}`,
522
- });
523
- }
524
- } */
525
- idIsSubscribed(id) {
526
- try {
527
- return !!this.presences.find((presence) => presence.issuerLocalId === id);
528
- }
529
- catch (error) {
530
- throw new fsm_dynamo_1.DyFM_Error({
531
- ...this._getDefaultErrorSettings('idIsSubscribed', error),
532
- errorCode: `${global_settings_const_1.DyNTS_global_settings.systemShortCodeName}|DyNTS-SSS-IIS0`,
533
- message: `socket (${this.params.name}) ID Subscription Check (${id}) failed`,
534
- });
535
- }
536
- }
537
- async emitError(presenceIssuerId, error, issuer) {
538
- try {
539
- await this.sendEventForId(presenceIssuerId, socket_1.DyFM_SocketEvent_Key.error, error, issuer);
540
- }
541
- catch (error) {
542
- throw new fsm_dynamo_1.DyFM_Error({
543
- ...this._getDefaultErrorSettings('emitError', error, presenceIssuerId),
544
- errorCode: `${global_settings_const_1.DyNTS_global_settings.systemShortCodeName}|DyNTS-SSS-EE0`,
545
- message: `socket (${this.params.name}) Error Emit (id: ${presenceIssuerId}) failed`,
546
- });
547
- }
548
- }
549
- async sendEventForId(id, event, content, issuer) {
550
- try {
551
- if (!event) {
552
- throw new fsm_dynamo_1.DyFM_Error({
553
- ...this._getDefaultErrorSettings('sendEventForId', new Error('No event was provided'), content?.source),
554
- errorCode: `${global_settings_const_1.DyNTS_global_settings.systemShortCodeName}|DyNTS-SSS-SEFI1`,
555
- });
556
- }
557
- if (!id) {
558
- throw new fsm_dynamo_1.DyFM_Error({
559
- ...this._getDefaultErrorSettings('sendEventForId', new Error('No ID was provided'), content?.source),
560
- errorCode: `${global_settings_const_1.DyNTS_global_settings.systemShortCodeName}|DyNTS-SSS-SEFI2`,
561
- });
562
- }
563
- const presence = this.presences.find((pres) => pres.issuerLocalId === id);
564
- if (!presence) {
565
- throw new fsm_dynamo_1.DyFM_Error({
566
- ...this._getDefaultErrorSettings('sendEventForId', new Error(`No active socket with this specific ID: "${id}"`), content?.source),
567
- errorCode: `${global_settings_const_1.DyNTS_global_settings.systemShortCodeName}|DyNTS-SSS-SEFI3`,
568
- });
569
- }
570
- presence.emitEvent(event, content, issuer);
571
- if (global_settings_const_1.DyNTS_global_settings.log_settings.socket_eventContent) {
572
- fsm_dynamo_1.DyFM_Log.success(` <--= emitted socket (${this.params.name}) event: "${event}", ` +
573
- `\n presenceId: "${id}", sockets: ${presence.sockets.length}` +
574
- `\n content:`, content);
575
- }
576
- else {
577
- fsm_dynamo_1.DyFM_Log.success(` <--= emitted socket (${this.params.name}) event: "${event}", ` +
578
- `\n presenceId: ${id}, sockets: ${presence.sockets.length}`);
579
- }
580
- }
581
- catch (error) {
582
- try {
583
- if (error?.flag?.includes(fsm_dynamo_1.DyFM_errorFlag) && error?.additionalInfo?.inactiveSockets) {
584
- const sockets = error.additionalInfo.inactiveSockets;
585
- await fsm_dynamo_1.DyFM_Array.asyncForEach(sockets, async (socket) => {
586
- await this.removeSubscription(socket);
587
- });
588
- const presence = this.presences.find((pres) => pres.issuerLocalId === id);
589
- if (!presence) {
590
- throw new fsm_dynamo_1.DyFM_Error({
591
- ...this._getDefaultErrorSettings('sendEventForId', new Error(`No active socket (${this.params.name}) with this specific ID: "${id}"`), content?.source),
592
- errorCode: `${global_settings_const_1.DyNTS_global_settings.systemShortCodeName}|DyNTS-SSS-SEFI4`,
593
- });
594
- }
595
- }
596
- }
597
- catch (error) {
598
- throw new fsm_dynamo_1.DyFM_Error({
599
- ...this._getDefaultErrorSettings('sendEventForId', error, content?.source),
600
- errorCode: `${global_settings_const_1.DyNTS_global_settings.systemShortCodeName}|DyNTS-SSS-SEFI5`,
601
- message: `Error handling of inactive sockets (${this.params.name}) failed!` +
602
- `\n(Socket Event Emit for id (${id}, ${event}) failed)`,
603
- });
604
- }
605
- throw new fsm_dynamo_1.DyFM_Error({
606
- ...this._getDefaultErrorSettings('sendEventForId', error, content?.source),
607
- errorCode: `${global_settings_const_1.DyNTS_global_settings.systemShortCodeName}|DyNTS-SSS-SEFI0`,
608
- message: `socket (${this.params.name}) Event Emit for id (${id}, ${event}) failed`,
609
- });
610
- }
611
- }
612
- async broadcastEvent(event, content, issuer) {
613
- try {
614
- fsm_dynamo_1.DyFM_Log.log(`<=-== broadcasting socket (${this.params.name}) event: "${event}"`);
615
- this.presences.forEach((presence) => {
616
- presence.emitEvent(event, content, issuer);
617
- });
618
- }
619
- catch (error) {
620
- if (global_settings_const_1.DyNTS_global_settings.log_settings.detailedErrors) {
621
- if (error instanceof fsm_dynamo_1.DyFM_Error) {
622
- error.logSimple(`socket (${this.params.name}) Event Broadcast (${event}) failed`);
623
- }
624
- else {
625
- fsm_dynamo_1.DyFM_Log.error(`socket (${this.params.name}) Event Broadcast (${event}) failed`, error);
626
- }
627
- }
628
- throw new fsm_dynamo_1.DyFM_Error({
629
- ...this._getDefaultErrorSettings('broadcastEvent', error),
630
- errorCode: `${global_settings_const_1.DyNTS_global_settings.systemShortCodeName}|DyNTS-SSS-BE0`,
631
- message: `socket (${this.params.name}) Event Broadcast (${event}) failed`,
632
- });
633
- }
634
- }
635
- async sendError(error, issuer) {
636
- try {
637
- await this.sendEventForId(issuer, socket_1.DyFM_SocketEvent_Key.error, error, issuer);
638
- }
639
- catch (error) {
640
- throw new fsm_dynamo_1.DyFM_Error({
641
- ...this._getDefaultErrorSettings('sendError', error, issuer),
642
- errorCode: `${global_settings_const_1.DyNTS_global_settings.systemShortCodeName}|DyNTS-SSS-SE0`,
643
- message: `socket (${this.params.name}) Error Send (${issuer}) failed`,
644
- });
645
- }
646
- }
647
- _getDefaultErrorSettings(fnName, error, issuer) {
648
- return {
649
- status: error?.___status ?? 500,
650
- message: error?.message ??
651
- error?._message ??
652
- `${fnName} was UNSUCCESSFUL (NTS)`,
653
- addECToUserMsg: !error?.__userMessage,
654
- userMessage: error?.__userMessage ?? this.defaultErrorUserMsg,
655
- issuer: issuer,
656
- issuerService: this.constructor?.name,
657
- error: error,
658
- };
659
- }
660
- /**
661
- * You can setup tasks for the unsubscribe event in this function
662
- */
663
- /* protected getUnsubscribeTasks?(): DyFM_SocketEventTask<T_SubscriptionContent>[]; */
664
- /**
665
- * You can setup preprocesses for the unsubscribe event in this function
666
- */
667
- /* protected getUnsubscribePreProcesses?(): DyFM_SocketEventPreprocessTask[]; */
668
- /**
669
- * You can setup tasks for the error event in this function
670
- */
671
- errorHandling;
672
- }
673
- exports.DyNTS_SocketServerService = DyNTS_SocketServerService;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DyNTS_SocketServerService = void 0;
4
+ const fsm_dynamo_1 = require("@futdevpro/fsm-dynamo");
5
+ const socket_1 = require("@futdevpro/fsm-dynamo/socket");
6
+ const global_settings_const_1 = require("../../../_collections/global-settings.const");
7
+ const singleton_service_1 = require("../../../_services/base/singleton.service");
8
+ const socket_security_enum_1 = require("../_enums/socket-security.enum");
9
+ /**
10
+ * You need to define the following functions:
11
+ * ```ts
12
+ * getServiceParams(): DyNTS_SocketServerServiceParams;
13
+ *
14
+ * getIncomingEvents(): DyFM_SocketEvent<any>[];
15
+ *
16
+ * getPresenceFromSubscriptionEventContent(
17
+ * socketSubscription: T_SubscriptionContent,
18
+ * socket: SocketIO.Socket
19
+ * ): Promise<T_Presence>;
20
+ * ```
21
+ */
22
+ class DyNTS_SocketServerService extends singleton_service_1.DyNTS_SingletonService {
23
+ params;
24
+ get name() { return this.params.name; }
25
+ get port() { return this.params.port; }
26
+ /** BFR-MASTERPROMPTER-025: explicit dedikált-listener opt-in (default false = shared). */
27
+ get dedicatedPort() { return this.params.dedicatedPort ?? false; }
28
+ get security() { return this.params.security; }
29
+ get activeSubscriptionsCount() { return this.presences.length; }
30
+ openSocketServer;
31
+ secureSocketServer;
32
+ /* private connectEvent: DyFM_SocketEvent<SocketIO.Socket>; */
33
+ incomingEvents;
34
+ /* private subscriptionEvent: DyFM_SocketEvent<any>; */
35
+ /* private unsubscribeEvent: DyFM_SocketEvent<any>; */
36
+ presences = [];
37
+ disconnectedSockets = new WeakSet();
38
+ get logSetup() { return global_settings_const_1.DyNTS_global_settings.log_settings.setup; }
39
+ get highDetailedLogs() { return global_settings_const_1.DyNTS_global_settings.log_settings.highDetailedLogs; }
40
+ defaultErrorUserMsg = `We encountered an unhandled Socket Server Error, ` +
41
+ `\nplease contact the responsible development team.`;
42
+ /* readonly thisLocationStack: string; */
43
+ constructor() {
44
+ super();
45
+ /* this.thisLocationStack = DyNTS_getStackLocation(); */
46
+ this.asyncConstructor().catch((error) => {
47
+ fsm_dynamo_1.DyFM_Log.error(`Socket Server Service setup failed: "${this.params?.name}" (${this.params?.port})`, error);
48
+ });
49
+ }
50
+ async asyncConstructor() {
51
+ try {
52
+ this.params = this.getServiceParams();
53
+ this.incomingEvents = this.getIncomingEvents() ?? [];
54
+ await this.prepareEvents();
55
+ if (this.logSetup)
56
+ console.log(`Socket Server Service setup done: "${this.params.name}" (${this.params.port}) ` +
57
+ `security: ${this.params.security}\n`);
58
+ }
59
+ catch (error) {
60
+ fsm_dynamo_1.DyFM_Log.error(`Socket Server Service setup failed: "${this.params?.name}" (${this.params?.port})`, error);
61
+ throw new fsm_dynamo_1.DyFM_Error({
62
+ errorCode: `${global_settings_const_1.DyNTS_global_settings.systemShortCodeName}|DyNTS-SSS-GPFSRC0`,
63
+ error: error,
64
+ });
65
+ }
66
+ }
67
+ /**
68
+ * You must setup events and required services for this function
69
+ */
70
+ async prepareEvents() {
71
+ try {
72
+ /** Setup connect event */
73
+ /* const connectEventIndex = this.incomingEvents.findIndex(
74
+ (event: DyFM_SocketEvent<any>) =>
75
+ event.eventKey === DyFM_SocketEvent_Key.connection
76
+ );
77
+
78
+ if (0 <= connectEventIndex) {
79
+ this.connectEvent = this.incomingEvents.splice(connectEventIndex)[0];
80
+ } else {
81
+ this.connectEvent = new DyFM_SocketEvent({
82
+ eventKey: DyFM_SocketEvent_Key.connection,
83
+ });
84
+ }
85
+ this.connectEvent.serviceName = this.params.name; */
86
+ if (!this.getPresenceFromSubscriptionEventContent) {
87
+ throw new fsm_dynamo_1.DyFM_Error({
88
+ error: new Error('getPresenceFromSubscriptionEventContent must be set'),
89
+ errorCode: `${global_settings_const_1.DyNTS_global_settings.systemShortCodeName}|DyNTS-SSS-PPE1`,
90
+ });
91
+ }
92
+ if (!this.getSubscriptionTasks) {
93
+ fsm_dynamo_1.DyFM_Log.warn(`You should not set the subscription event, ` +
94
+ `in case you need additional steps for your subscriptions.`, `${this.params.name} (${this.params.port})`);
95
+ }
96
+ if (this.incomingEvents.find((event) => event.eventKey === socket_1.DyFM_SocketEvent_Key.subscribe)) {
97
+ fsm_dynamo_1.DyFM_Log.warn(`You need to use getSubscriptionTasks() ` +
98
+ `instead of setting the subscribe event in getIncomingEvents().`, `${this.params.name} (${this.params.port})`);
99
+ }
100
+ if (!this.incomingEvents.find((event) => event.eventKey === socket_1.DyFM_SocketEvent_Key.unsubscribe)) {
101
+ fsm_dynamo_1.DyFM_Log.warn(`You should not set the unsubscribe event, ` +
102
+ `in case you need additional steps for your unsubscribe.`, `${this.params.name} (${this.params.port})`);
103
+ }
104
+ if (this.incomingEvents.find((event) => !event.eventKey)) {
105
+ throw new fsm_dynamo_1.DyFM_Error({
106
+ error: new Error('eventKey must be set'),
107
+ errorCode: `${global_settings_const_1.DyNTS_global_settings.systemShortCodeName}|DyNTS-SSS-PPE2`,
108
+ });
109
+ }
110
+ this.incomingEvents.push(new socket_1.DyFM_SocketEvent({
111
+ eventKey: socket_1.DyFM_SocketEvent_Key.disconnect,
112
+ }));
113
+ if (this.errorHandling) {
114
+ this.incomingEvents.push(new socket_1.DyFM_SocketEvent({
115
+ serviceName: this.params.name,
116
+ eventKey: socket_1.DyFM_SocketEvent_Key.error,
117
+ tasks: [
118
+ async (content) => this.errorHandling(content),
119
+ ],
120
+ }));
121
+ }
122
+ else {
123
+ fsm_dynamo_1.DyFM_Log.warn(`You should not set the error event, ` +
124
+ `in case you need additional steps for your error.`, `${this.params.name} (${this.params.port})`);
125
+ this.incomingEvents.push(new socket_1.DyFM_SocketEvent({
126
+ serviceName: this.params.name,
127
+ eventKey: socket_1.DyFM_SocketEvent_Key.error,
128
+ tasks: [
129
+ async (content) => {
130
+ if (content instanceof fsm_dynamo_1.DyFM_Error) {
131
+ content.logSimple(`=--> socket-client (${this.params.name}) ERROR`);
132
+ }
133
+ else {
134
+ fsm_dynamo_1.DyFM_Log.error(`=--> socket-client (${this.params.name}) ERROR:`, content);
135
+ }
136
+ }
137
+ ],
138
+ }));
139
+ }
140
+ // Merge incoming events of the same eventKey
141
+ const eventKeys = this.incomingEvents.map((event) => event.eventKey).filter((eventKey, index, self) => self.indexOf(eventKey) === index);
142
+ const mergedEvents = [];
143
+ eventKeys.forEach((eventKey) => {
144
+ const events = this.incomingEvents.filter((event) => event.eventKey === eventKey);
145
+ mergedEvents.push(new socket_1.DyFM_SocketEvent({
146
+ eventKey: eventKey,
147
+ preProcesses: events.map((event) => event.preProcesses).flat(),
148
+ tasks: events.map((event) => event.tasks).flat(),
149
+ }));
150
+ });
151
+ this.incomingEvents = mergedEvents;
152
+ if (global_settings_const_1.DyNTS_global_settings.log_settings.setup) {
153
+ fsm_dynamo_1.DyFM_Log.log(`Socket Server Service - Event Preparation setup done: ` +
154
+ `"${this.params?.name}" (${this.params?.port})` +
155
+ `\nincomingEvents:`, this.incomingEvents.map((event) => `\n\t"${event.eventKey}": preProcesses: ${event.preProcesses?.length} ` +
156
+ `tasks: ${event.tasks?.length}`));
157
+ }
158
+ // Set incoming events serviceName
159
+ this.incomingEvents.forEach((event) => {
160
+ event.serviceName = this.params.name;
161
+ });
162
+ }
163
+ catch (error) {
164
+ fsm_dynamo_1.DyFM_Log.error(`Socket Server Service - Event Preparation setup failed: ` +
165
+ `"${this.params?.name}" (${this.params?.port})`, error);
166
+ throw error;
167
+ }
168
+ }
169
+ // eslint-disable-next-line max-lines-per-function
170
+ async setupSocketServer(newSocketServer, security, successCallback, options) {
171
+ try {
172
+ if (this.highDetailedLogs)
173
+ console.log('\nfn:. setupSocketServer');
174
+ const effectivePort = options?.effectivePort ?? this.params.port;
175
+ newSocketServer.on(socket_1.DyFM_SocketEvent_Key.incomingNewConnection, async (socket) => {
176
+ try {
177
+ let issuer = `${this.params.name} anonymous socket`;
178
+ /* await this.connectEvent.executeEventTasks(socket); */
179
+ await fsm_dynamo_1.DyFM_Array.asyncForEach(this.incomingEvents.filter((event) => event.eventKey === socket_1.DyFM_SocketEvent_Key.incomingNewConnection), async (event) => {
180
+ await event.executeEventTasks(socket);
181
+ });
182
+ if (this.getPresenceFromSubscriptionEventContent) {
183
+ socket.on(socket_1.DyFM_SocketEvent_Key.subscribe, async (content) => {
184
+ let presence;
185
+ try {
186
+ /**
187
+ * usually socket logs are in event.executeEventTasks(),
188
+ * but subscribe event is an exception from this,
189
+ * to be able to check content before getPresenceFromSubscriptionEventContent
190
+ */
191
+ if (global_settings_const_1.DyNTS_global_settings.log_settings.socket_eventContent) {
192
+ fsm_dynamo_1.DyFM_Log.log(`--=> incoming socket (${this.params.name}) ` +
193
+ `event: "${socket_1.DyFM_SocketEvent_Key.subscribe}";` +
194
+ `\ncontent:`, content);
195
+ }
196
+ else {
197
+ fsm_dynamo_1.DyFM_Log.log(`--=> incoming socket (${this.params.name}) ` +
198
+ `event: "${socket_1.DyFM_SocketEvent_Key.subscribe}"`);
199
+ }
200
+ presence = await this.getPresenceFromSubscriptionEventContent(content, socket);
201
+ presence.serviceName = this.params.name;
202
+ issuer = presence.issuerLocalId;
203
+ await this.addSocketToPresence(presence);
204
+ /* await this.subscriptionEvent.executeEventTasks(content, issuer); */
205
+ if (this.getSubscriptionTasks) {
206
+ await fsm_dynamo_1.DyFM_Array.asyncForEach(this.getSubscriptionTasks(), async (task) => {
207
+ await task(content, issuer);
208
+ });
209
+ }
210
+ socket.emit(socket_1.DyFM_SocketEvent_Key.subscriptionSuccessful, 'subscribe was successful', error => {
211
+ fsm_dynamo_1.DyFM_Log.error(`Emitting subscriptionSuccessful event failed!` +
212
+ `\nerror:`, error);
213
+ });
214
+ fsm_dynamo_1.DyFM_Log.success(`<-==> socket(${this.params.name}) subscription successful (${issuer})`);
215
+ }
216
+ catch (error) {
217
+ if (error instanceof fsm_dynamo_1.DyFM_Error) {
218
+ error.logShort(`Socket Subscription failed: "${this.params.name}" ` +
219
+ `(${this.params.port}) will disconnect now...`);
220
+ }
221
+ else if (global_settings_const_1.DyNTS_global_settings.log_settings.socket_eventContent) {
222
+ fsm_dynamo_1.DyFM_Log.error(`Socket Subscription failed: "${this.params.name}" ` +
223
+ `(${this.params.port}) will disconnect now...`,
224
+ /* `${this.thisLocationStack}`, */
225
+ error);
226
+ }
227
+ else {
228
+ fsm_dynamo_1.DyFM_Log.error(`Socket Subscription failed: "${this.params.name}" `, `(${this.params.port}) will disconnect now...`);
229
+ }
230
+ await this.closeSocket(socket, issuer, error);
231
+ }
232
+ });
233
+ socket.on(socket_1.DyFM_SocketEvent_Key.unsubscribe, async (issuer) => {
234
+ try {
235
+ /**
236
+ * usually socket logs are in event.executeEventTasks(),
237
+ * but unsubscribe event is an exception from this,
238
+ * to be able to check content before getPresenceFromSubscriptionEventContent
239
+ */
240
+ if (global_settings_const_1.DyNTS_global_settings.log_settings.socket_eventContent) {
241
+ fsm_dynamo_1.DyFM_Log.log(`--=> incoming socket (${this.params.name}) ` +
242
+ `event: ${socket_1.DyFM_SocketEvent_Key.unsubscribe};` +
243
+ `\ncontent:`, issuer);
244
+ }
245
+ else {
246
+ fsm_dynamo_1.DyFM_Log.log(`--=> incoming socket (${this.params.name}) ` +
247
+ `event: ${socket_1.DyFM_SocketEvent_Key.unsubscribe}`);
248
+ }
249
+ /* await this.unsubscribeEvent.executeEventTasks(null, issuer); */
250
+ await fsm_dynamo_1.DyFM_Array.asyncForEach(this.incomingEvents.filter((event) => event.eventKey === socket_1.DyFM_SocketEvent_Key.unsubscribe), async (event) => {
251
+ await event.executeEventTasks(null, issuer);
252
+ });
253
+ await this.removeSubscription(socket, issuer);
254
+ fsm_dynamo_1.DyFM_Log.success(`< x > socket(${this.params.name}) unsubscribe successful (${issuer})`);
255
+ }
256
+ catch (error) {
257
+ if (error instanceof fsm_dynamo_1.DyFM_Error) {
258
+ error.logSimple(`Socket Unsubscription failed: "${this.params.name}" ` +
259
+ `(${this.params.port}) will disconnect now...`);
260
+ }
261
+ else if (global_settings_const_1.DyNTS_global_settings.log_settings.socket_eventContent) {
262
+ fsm_dynamo_1.DyFM_Log.error(`Socket unsubscribe failed: "${this.params.name}" `, `(${this.params.port}) will disconnect now...`, error);
263
+ }
264
+ else {
265
+ fsm_dynamo_1.DyFM_Log.error(`Socket unsubscribe failed: "${this.params.name}" `, `(${this.params.port}) will disconnect now...`);
266
+ }
267
+ socket.emit(socket_1.DyFM_SocketEvent_Key.error, error);
268
+ await this.removeSubscription(socket, issuer);
269
+ }
270
+ });
271
+ }
272
+ this.incomingEvents.filter((event) => event.eventKey !== socket_1.DyFM_SocketEvent_Key.incomingNewConnection &&
273
+ event.eventKey !== socket_1.DyFM_SocketEvent_Key.subscribe &&
274
+ event.eventKey !== socket_1.DyFM_SocketEvent_Key.unsubscribe).forEach((event) => {
275
+ socket.on(event.eventKey, async (content) => {
276
+ try {
277
+ if (event.eventKey === socket_1.DyFM_SocketEvent_Key.disconnect) {
278
+ await this.executeDisconnectTasks(socket, issuer);
279
+ }
280
+ else {
281
+ await event.executeEventTasks(content, issuer, socket);
282
+ }
283
+ }
284
+ catch (error) {
285
+ if (error instanceof fsm_dynamo_1.DyFM_Error) {
286
+ error.logSimple(`Socket Event failed: "${this.params.name}" (${this.params.port})`);
287
+ }
288
+ else {
289
+ fsm_dynamo_1.DyFM_Log.error(`Socket Event failed: "${this.params.name}" (${this.params.port})`, error);
290
+ }
291
+ socket.emit(socket_1.DyFM_SocketEvent_Key.error, error);
292
+ }
293
+ });
294
+ });
295
+ if (global_settings_const_1.DyNTS_global_settings.log_settings.socket_mainEvents) {
296
+ fsm_dynamo_1.DyFM_Log.success(`< > socket(${this.params.name}): new CONNECTION established`);
297
+ }
298
+ }
299
+ catch (error) {
300
+ if (error instanceof fsm_dynamo_1.DyFM_Error) {
301
+ error.logSimple(`Socket Connection failed: "${this.params.name}" ` +
302
+ `(${this.params.port}) will disconnect now...`);
303
+ }
304
+ else {
305
+ fsm_dynamo_1.DyFM_Log.error(`Socket Connection failed: "${this.params.name}" ` +
306
+ `(${this.params.port}) will disconnect now...`, error);
307
+ }
308
+ await this.closeSocket(socket, `${this.params.name} on connection error`, error);
309
+ }
310
+ });
311
+ const isAttach = options?.attachedToExistingServer === true ||
312
+ (this.params.port === undefined && options?.effectivePort !== undefined);
313
+ if (isAttach) {
314
+ fsm_dynamo_1.DyFM_Log.success(`\nsocket server setup finished: "${this.params.name}"` +
315
+ (effectivePort !== undefined ? ` (attached to server on port: ${effectivePort})` : ' (attached to existing server)'));
316
+ successCallback();
317
+ }
318
+ else {
319
+ try {
320
+ const portToListen = this.params.port ?? options?.effectivePort;
321
+ if (portToListen === undefined) {
322
+ throw new Error(`PORT NOT SET: "${this.params.name}". ` +
323
+ `Either set port in getServiceParams() or pass effectivePort in setupSocketServer options.`);
324
+ }
325
+ newSocketServer.listen(portToListen);
326
+ fsm_dynamo_1.DyFM_Log.success(`\nsocket server setup finished: "${this.params.name}"` +
327
+ `\nsocket server listening on port: "${portToListen}"`);
328
+ }
329
+ catch (listenError) {
330
+ const portForMsg = this.params.port ?? options?.effectivePort;
331
+ const errorMessage = `Failed to bind socket server "${this.params.name}" to port ${portForMsg}. ` +
332
+ `This could be due to port already in use or insufficient permissions. ` +
333
+ `Please ensure the port is available and try again.`;
334
+ fsm_dynamo_1.DyFM_Log.error(errorMessage, listenError);
335
+ throw new Error(errorMessage);
336
+ }
337
+ successCallback();
338
+ }
339
+ if (security === socket_security_enum_1.DyNTS_SocketSecurity.open) {
340
+ this.openSocketServer = newSocketServer;
341
+ return this.openSocketServer;
342
+ }
343
+ else {
344
+ this.secureSocketServer = newSocketServer;
345
+ return this.secureSocketServer;
346
+ }
347
+ }
348
+ catch (error) {
349
+ if (error instanceof fsm_dynamo_1.DyFM_Error) {
350
+ error.logSimple(`Socket Server Service - Deep Setup failed: "${this.params?.name}" ` +
351
+ `(${this.params?.port})`);
352
+ }
353
+ else {
354
+ fsm_dynamo_1.DyFM_Log.error(`Socket Server Service - Deep Setup failed: "${this.params?.name}" ` +
355
+ `(${this.params?.port})`, error);
356
+ }
357
+ throw error;
358
+ }
359
+ }
360
+ async addSocketToPresence(newPresence) {
361
+ try {
362
+ const activePresence = this.presences.find((pres) => pres.issuerLocalId === newPresence.issuerLocalId);
363
+ if (activePresence) {
364
+ activePresence.sockets.push(...newPresence.sockets);
365
+ }
366
+ else {
367
+ this.presences.push(newPresence);
368
+ }
369
+ }
370
+ catch (error) {
371
+ if (error instanceof fsm_dynamo_1.DyFM_Error) {
372
+ error.logShort(`Socket Subscription failed: "${this.params?.name}" (${this.params?.port})`);
373
+ }
374
+ else if (global_settings_const_1.DyNTS_global_settings.log_settings.socket_eventContent) {
375
+ fsm_dynamo_1.DyFM_Log.error(`Socket Subscription failed: "${this.params?.name}" (${this.params?.port})`,
376
+ /* `${this.thisLocationStack}`, */
377
+ error);
378
+ }
379
+ else {
380
+ fsm_dynamo_1.DyFM_Log.error(`Socket Subscription failed: "${this.params?.name}" (${this.params?.port})`);
381
+ }
382
+ throw error;
383
+ }
384
+ }
385
+ async closeSocket(socket, issuer, withError) {
386
+ try {
387
+ if (withError) {
388
+ socket.emit(socket_1.DyFM_SocketEvent_Key.error, withError);
389
+ }
390
+ await this.executeDisconnectTasks(socket, issuer);
391
+ /* if (this.getSubscriptionCloseTasks) {
392
+ await DyFM_Array.asyncForEach(
393
+ this.getSubscriptionCloseTasks(),
394
+ async (task: DyFM_SocketEventTask<null>) => {
395
+ await task(null, issuer);
396
+ }
397
+ );
398
+ } */
399
+ socket.disconnect();
400
+ }
401
+ catch (error) {
402
+ throw new fsm_dynamo_1.DyFM_Error({
403
+ ...this._getDefaultErrorSettings('closeSocket', error),
404
+ errorCode: `${global_settings_const_1.DyNTS_global_settings.systemShortCodeName}|DyNTS-SSS-CS0`,
405
+ });
406
+ }
407
+ }
408
+ /** Disconnect taskokat socketenkent pontosan egyszer, magaval a sockettel futtatja. */
409
+ async executeDisconnectTasks(socket, issuer) {
410
+ if (this.disconnectedSockets.has(socket)) {
411
+ return;
412
+ }
413
+ this.disconnectedSockets.add(socket);
414
+ try {
415
+ await fsm_dynamo_1.DyFM_Array.asyncForEach(this.incomingEvents.filter((event) => event.eventKey === socket_1.DyFM_SocketEvent_Key.disconnect), async (event) => {
416
+ await event.executeEventTasks(socket, issuer);
417
+ });
418
+ await this.removeSocketFromPresence(socket);
419
+ fsm_dynamo_1.DyFM_Log.info(`< x > socket(${this.params.name}) disconnected (${issuer})`);
420
+ }
421
+ catch (error) {
422
+ this.disconnectedSockets.delete(socket);
423
+ throw error;
424
+ }
425
+ }
426
+ async removeSocketFromPresence(socket) {
427
+ try {
428
+ const presence = this.presences.find((pres) => pres.sockets.includes(socket));
429
+ if (presence) {
430
+ const socketIndex = presence.sockets.indexOf(socket);
431
+ if (socketIndex !== -1) {
432
+ presence.sockets.splice(socketIndex, 1);
433
+ }
434
+ if (presence.sockets.length === 0) {
435
+ const presenceIndex = this.presences.indexOf(presence);
436
+ if (presenceIndex !== -1) {
437
+ this.presences.splice(presenceIndex, 1);
438
+ }
439
+ }
440
+ }
441
+ }
442
+ catch (error) {
443
+ throw new fsm_dynamo_1.DyFM_Error({
444
+ ...this._getDefaultErrorSettings('removeSocketFromPresence', error),
445
+ errorCode: `${global_settings_const_1.DyNTS_global_settings.systemShortCodeName}|DyNTS-SSS-RSO0`,
446
+ });
447
+ }
448
+ }
449
+ async removeSubscription(socket, issuer) {
450
+ try {
451
+ if (!this.presences.length) {
452
+ throw new fsm_dynamo_1.DyFM_Error({
453
+ ...this._getDefaultErrorSettings('removeSubscription', new Error(`No presences found (${this.params.name})`), issuer ?? 'unknown issuer'),
454
+ errorCode: `${global_settings_const_1.DyNTS_global_settings.systemShortCodeName}|DyNTS-SSS-RS1`,
455
+ });
456
+ }
457
+ const activePresenceIndex = this.presences.findIndex((pres) => pres.sockets.includes(socket));
458
+ if (activePresenceIndex === -1) {
459
+ throw new fsm_dynamo_1.DyFM_Error({
460
+ ...this._getDefaultErrorSettings('sendEventForId', new Error(`closing socket (${this.params.name}) does not match any in the activePresences`), issuer ?? 'unknown issuer'),
461
+ errorCode: `${global_settings_const_1.DyNTS_global_settings.systemShortCodeName}|DyNTS-SSS-RS2`,
462
+ });
463
+ }
464
+ const activePresence = this.presences[activePresenceIndex];
465
+ if (issuer && activePresence.issuerLocalId !== issuer) {
466
+ throw new fsm_dynamo_1.DyFM_Error({
467
+ ...this._getDefaultErrorSettings('sendEventForId', new Error(`socket unsubscription for "${issuer}" and ` +
468
+ `"${activePresence.issuerLocalId}" does not match.`), issuer),
469
+ errorCode: `${global_settings_const_1.DyNTS_global_settings.systemShortCodeName}|DyNTS-SSS-RS3`,
470
+ });
471
+ }
472
+ const socketIndex = activePresence.sockets.findIndex((s) => s === socket);
473
+ if (socketIndex === -1) {
474
+ throw new fsm_dynamo_1.DyFM_Error({
475
+ ...this._getDefaultErrorSettings('sendEventForId', new Error(`closing socket (${this.params.name}) does not match any in the activePresences`), activePresence.issuerLocalId),
476
+ errorCode: `${global_settings_const_1.DyNTS_global_settings.systemShortCodeName}|DyNTS-SSS-RS4`,
477
+ });
478
+ }
479
+ activePresence.sockets.splice(socketIndex, 1);
480
+ await fsm_dynamo_1.DyFM_Array.asyncForEach(this.incomingEvents.filter((event) => event.eventKey === socket_1.DyFM_SocketEvent_Key.unsubscribeSuccessful), async (event) => {
481
+ await event.executeEventTasks(null, issuer);
482
+ });
483
+ /* if (this.getSubscriptionCloseTasks) {
484
+ await DyFM_Array.asyncForEach(
485
+ this.getSubscriptionCloseTasks(),
486
+ async (task: DyFM_SocketEventTask<null>) => {
487
+ await task(null, issuer);
488
+ }
489
+ );
490
+ } */
491
+ if (activePresence.sockets.length === 0) {
492
+ this.presences.splice(activePresenceIndex, 1);
493
+ }
494
+ socket.emit(socket_1.DyFM_SocketEvent_Key.unsubscribeSuccessful, 'unsubscribe was successful');
495
+ socket.disconnect();
496
+ fsm_dynamo_1.DyFM_Log.info(`<x==> socket (${this.params.name}) unsubscription successful (${issuer})`);
497
+ }
498
+ catch (error) {
499
+ throw new fsm_dynamo_1.DyFM_Error({
500
+ ...this._getDefaultErrorSettings('sendEventForId', error, issuer ?? 'unknown issuer'),
501
+ errorCode: `${global_settings_const_1.DyNTS_global_settings.systemShortCodeName}|DyNTS-SSS-RS0`,
502
+ message: `socket (${this.params.name}) Subscription Removal failed: "${this.params?.name}"`,
503
+ });
504
+ }
505
+ }
506
+ /* emitServerEvent(event: string, content: any): void {
507
+ try {
508
+ DyFM_Log.log(` <=-- emitting server socket(${this.params.name}) event: ${event}`);
509
+
510
+ this.openSocketServer.emit(event, content, error => {
511
+ DyFM_Log.error(`Emitting server event '${event}' failed!\nerror:`, error);
512
+ });
513
+ } catch (error) {
514
+ throw new DyFM_Error({
515
+ ...this._getDefaultErrorSettings(
516
+ 'emitEvent',
517
+ error
518
+ ),
519
+
520
+ errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-SSS-500',
521
+ message: `socket(${this.params.name}) Event Emit (${event}) failed: ${this.params?.name}`,
522
+ });
523
+ }
524
+ } */
525
+ idIsSubscribed(id) {
526
+ try {
527
+ return !!this.presences.find((presence) => presence.issuerLocalId === id);
528
+ }
529
+ catch (error) {
530
+ throw new fsm_dynamo_1.DyFM_Error({
531
+ ...this._getDefaultErrorSettings('idIsSubscribed', error),
532
+ errorCode: `${global_settings_const_1.DyNTS_global_settings.systemShortCodeName}|DyNTS-SSS-IIS0`,
533
+ message: `socket (${this.params.name}) ID Subscription Check (${id}) failed`,
534
+ });
535
+ }
536
+ }
537
+ async emitError(presenceIssuerId, error, issuer) {
538
+ try {
539
+ await this.sendEventForId(presenceIssuerId, socket_1.DyFM_SocketEvent_Key.error, error, issuer);
540
+ }
541
+ catch (error) {
542
+ throw new fsm_dynamo_1.DyFM_Error({
543
+ ...this._getDefaultErrorSettings('emitError', error, presenceIssuerId),
544
+ errorCode: `${global_settings_const_1.DyNTS_global_settings.systemShortCodeName}|DyNTS-SSS-EE0`,
545
+ message: `socket (${this.params.name}) Error Emit (id: ${presenceIssuerId}) failed`,
546
+ });
547
+ }
548
+ }
549
+ async sendEventForId(id, event, content, issuer) {
550
+ try {
551
+ if (!event) {
552
+ throw new fsm_dynamo_1.DyFM_Error({
553
+ ...this._getDefaultErrorSettings('sendEventForId', new Error('No event was provided'), content?.source),
554
+ errorCode: `${global_settings_const_1.DyNTS_global_settings.systemShortCodeName}|DyNTS-SSS-SEFI1`,
555
+ });
556
+ }
557
+ if (!id) {
558
+ throw new fsm_dynamo_1.DyFM_Error({
559
+ ...this._getDefaultErrorSettings('sendEventForId', new Error('No ID was provided'), content?.source),
560
+ errorCode: `${global_settings_const_1.DyNTS_global_settings.systemShortCodeName}|DyNTS-SSS-SEFI2`,
561
+ });
562
+ }
563
+ const presence = this.presences.find((pres) => pres.issuerLocalId === id);
564
+ if (!presence) {
565
+ throw new fsm_dynamo_1.DyFM_Error({
566
+ ...this._getDefaultErrorSettings('sendEventForId', new Error(`No active socket with this specific ID: "${id}"`), content?.source),
567
+ errorCode: `${global_settings_const_1.DyNTS_global_settings.systemShortCodeName}|DyNTS-SSS-SEFI3`,
568
+ });
569
+ }
570
+ presence.emitEvent(event, content, issuer);
571
+ if (global_settings_const_1.DyNTS_global_settings.log_settings.socket_eventContent) {
572
+ fsm_dynamo_1.DyFM_Log.success(` <--= emitted socket (${this.params.name}) event: "${event}", ` +
573
+ `\n presenceId: "${id}", sockets: ${presence.sockets.length}` +
574
+ `\n content:`, content);
575
+ }
576
+ else {
577
+ fsm_dynamo_1.DyFM_Log.success(` <--= emitted socket (${this.params.name}) event: "${event}", ` +
578
+ `\n presenceId: ${id}, sockets: ${presence.sockets.length}`);
579
+ }
580
+ }
581
+ catch (error) {
582
+ try {
583
+ if (error?.flag?.includes(fsm_dynamo_1.DyFM_errorFlag) && error?.additionalInfo?.inactiveSockets) {
584
+ const sockets = error.additionalInfo.inactiveSockets;
585
+ await fsm_dynamo_1.DyFM_Array.asyncForEach(sockets, async (socket) => {
586
+ await this.removeSubscription(socket);
587
+ });
588
+ const presence = this.presences.find((pres) => pres.issuerLocalId === id);
589
+ if (!presence) {
590
+ throw new fsm_dynamo_1.DyFM_Error({
591
+ ...this._getDefaultErrorSettings('sendEventForId', new Error(`No active socket (${this.params.name}) with this specific ID: "${id}"`), content?.source),
592
+ errorCode: `${global_settings_const_1.DyNTS_global_settings.systemShortCodeName}|DyNTS-SSS-SEFI4`,
593
+ });
594
+ }
595
+ }
596
+ }
597
+ catch (error) {
598
+ throw new fsm_dynamo_1.DyFM_Error({
599
+ ...this._getDefaultErrorSettings('sendEventForId', error, content?.source),
600
+ errorCode: `${global_settings_const_1.DyNTS_global_settings.systemShortCodeName}|DyNTS-SSS-SEFI5`,
601
+ message: `Error handling of inactive sockets (${this.params.name}) failed!` +
602
+ `\n(Socket Event Emit for id (${id}, ${event}) failed)`,
603
+ });
604
+ }
605
+ throw new fsm_dynamo_1.DyFM_Error({
606
+ ...this._getDefaultErrorSettings('sendEventForId', error, content?.source),
607
+ errorCode: `${global_settings_const_1.DyNTS_global_settings.systemShortCodeName}|DyNTS-SSS-SEFI0`,
608
+ message: `socket (${this.params.name}) Event Emit for id (${id}, ${event}) failed`,
609
+ });
610
+ }
611
+ }
612
+ async broadcastEvent(event, content, issuer) {
613
+ try {
614
+ fsm_dynamo_1.DyFM_Log.log(`<=-== broadcasting socket (${this.params.name}) event: "${event}"`);
615
+ this.presences.forEach((presence) => {
616
+ presence.emitEvent(event, content, issuer);
617
+ });
618
+ }
619
+ catch (error) {
620
+ if (global_settings_const_1.DyNTS_global_settings.log_settings.detailedErrors) {
621
+ if (error instanceof fsm_dynamo_1.DyFM_Error) {
622
+ error.logSimple(`socket (${this.params.name}) Event Broadcast (${event}) failed`);
623
+ }
624
+ else {
625
+ fsm_dynamo_1.DyFM_Log.error(`socket (${this.params.name}) Event Broadcast (${event}) failed`, error);
626
+ }
627
+ }
628
+ throw new fsm_dynamo_1.DyFM_Error({
629
+ ...this._getDefaultErrorSettings('broadcastEvent', error),
630
+ errorCode: `${global_settings_const_1.DyNTS_global_settings.systemShortCodeName}|DyNTS-SSS-BE0`,
631
+ message: `socket (${this.params.name}) Event Broadcast (${event}) failed`,
632
+ });
633
+ }
634
+ }
635
+ async sendError(error, issuer) {
636
+ try {
637
+ await this.sendEventForId(issuer, socket_1.DyFM_SocketEvent_Key.error, error, issuer);
638
+ }
639
+ catch (error) {
640
+ throw new fsm_dynamo_1.DyFM_Error({
641
+ ...this._getDefaultErrorSettings('sendError', error, issuer),
642
+ errorCode: `${global_settings_const_1.DyNTS_global_settings.systemShortCodeName}|DyNTS-SSS-SE0`,
643
+ message: `socket (${this.params.name}) Error Send (${issuer}) failed`,
644
+ });
645
+ }
646
+ }
647
+ _getDefaultErrorSettings(fnName, error, issuer) {
648
+ return {
649
+ status: error?.___status ?? 500,
650
+ message: error?.message ??
651
+ error?._message ??
652
+ `${fnName} was UNSUCCESSFUL (NTS)`,
653
+ addECToUserMsg: !error?.__userMessage,
654
+ userMessage: error?.__userMessage ?? this.defaultErrorUserMsg,
655
+ issuer: issuer,
656
+ issuerService: this.constructor?.name,
657
+ error: error,
658
+ };
659
+ }
660
+ /**
661
+ * You can setup tasks for the unsubscribe event in this function
662
+ */
663
+ /* protected getUnsubscribeTasks?(): DyFM_SocketEventTask<T_SubscriptionContent>[]; */
664
+ /**
665
+ * You can setup preprocesses for the unsubscribe event in this function
666
+ */
667
+ /* protected getUnsubscribePreProcesses?(): DyFM_SocketEventPreprocessTask[]; */
668
+ /**
669
+ * You can setup tasks for the error event in this function
670
+ */
671
+ errorHandling;
672
+ }
673
+ exports.DyNTS_SocketServerService = DyNTS_SocketServerService;
674
674
  //# sourceMappingURL=socket-server.service.js.map