@rockster/core 0.0.4 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (318) hide show
  1. package/access/access.module.js +3 -7
  2. package/access/access.module.js.map +1 -1
  3. package/access/constants.d.ts +2 -0
  4. package/access/constants.js +6 -0
  5. package/access/constants.js.map +1 -0
  6. package/access/controllers/controllers.d.ts +2 -1
  7. package/access/controllers/controllers.js +3 -1
  8. package/access/controllers/controllers.js.map +1 -1
  9. package/access/controllers/scope-access-profile.controller.d.ts +17 -0
  10. package/access/controllers/scope-access-profile.controller.js +111 -0
  11. package/access/controllers/scope-access-profile.controller.js.map +1 -0
  12. package/access/controllers/scope-group-user.controller.d.ts +11 -4
  13. package/access/controllers/scope-group-user.controller.js +57 -9
  14. package/access/controllers/scope-group-user.controller.js.map +1 -1
  15. package/access/controllers/scope-group.controller.d.ts +8 -5
  16. package/access/controllers/scope-group.controller.js +66 -12
  17. package/access/controllers/scope-group.controller.js.map +1 -1
  18. package/access/controllers/scope-owner.controller.d.ts +3 -2
  19. package/access/controllers/scope-owner.controller.js +18 -4
  20. package/access/controllers/scope-owner.controller.js.map +1 -1
  21. package/access/controllers/scope-user.controller.d.ts +2 -2
  22. package/access/controllers/scope-user.controller.js +19 -5
  23. package/access/controllers/scope-user.controller.js.map +1 -1
  24. package/access/decorators/context-params.decorator.d.ts +2 -0
  25. package/access/decorators/context-params.decorator.js +13 -0
  26. package/access/decorators/context-params.decorator.js.map +1 -0
  27. package/access/decorators/index.d.ts +2 -0
  28. package/access/decorators/index.js +19 -0
  29. package/access/decorators/index.js.map +1 -0
  30. package/access/decorators/scope-context-id-resolver.decorator.d.ts +10 -0
  31. package/access/decorators/scope-context-id-resolver.decorator.js +22 -0
  32. package/access/decorators/scope-context-id-resolver.decorator.js.map +1 -0
  33. package/access/entities/entities.d.ts +3 -1
  34. package/access/entities/entities.js +4 -0
  35. package/access/entities/entities.js.map +1 -1
  36. package/access/entities/index.d.ts +2 -0
  37. package/access/entities/index.js +2 -0
  38. package/access/entities/index.js.map +1 -1
  39. package/access/entities/scope-access-profile-key.d.ts +6 -0
  40. package/access/entities/scope-access-profile-key.js +40 -0
  41. package/access/entities/scope-access-profile-key.js.map +1 -0
  42. package/access/entities/scope-access-profile.d.ts +6 -0
  43. package/access/entities/scope-access-profile.js +37 -0
  44. package/access/entities/scope-access-profile.js.map +1 -0
  45. package/access/entities/scope-group.d.ts +3 -0
  46. package/access/entities/scope-group.js +16 -0
  47. package/access/entities/scope-group.js.map +1 -1
  48. package/access/functions/assert-context-admin-access.d.ts +15 -0
  49. package/access/functions/assert-context-admin-access.js +62 -0
  50. package/access/functions/assert-context-admin-access.js.map +1 -0
  51. package/access/functions/assert-master-or-owner.d.ts +9 -0
  52. package/access/functions/assert-master-or-owner.js +40 -0
  53. package/access/functions/assert-master-or-owner.js.map +1 -0
  54. package/access/functions/assert-scope-action-access.d.ts +32 -0
  55. package/access/functions/assert-scope-action-access.js +189 -0
  56. package/access/functions/assert-scope-action-access.js.map +1 -0
  57. package/access/functions/build-scope-resolver-initial-data.d.ts +4 -0
  58. package/access/functions/build-scope-resolver-initial-data.js +17 -0
  59. package/access/functions/build-scope-resolver-initial-data.js.map +1 -0
  60. package/access/functions/describe-action-scope.d.ts +9 -0
  61. package/access/functions/describe-action-scope.js +27 -0
  62. package/access/functions/describe-action-scope.js.map +1 -0
  63. package/access/functions/index.d.ts +5 -0
  64. package/access/functions/index.js +5 -0
  65. package/access/functions/index.js.map +1 -1
  66. package/access/functions/init-scope-service-executors.d.ts +3 -0
  67. package/access/functions/init-scope-service-executors.js +38 -0
  68. package/access/functions/init-scope-service-executors.js.map +1 -0
  69. package/access/functions/normalize-scope-keys.d.ts +4 -0
  70. package/access/functions/normalize-scope-keys.js +17 -0
  71. package/access/functions/normalize-scope-keys.js.map +1 -0
  72. package/access/functions/register-scope.d.ts +16 -5
  73. package/access/functions/register-scope.js +57 -45
  74. package/access/functions/register-scope.js.map +1 -1
  75. package/access/functions/resolve-scope-context-id.d.ts +9 -0
  76. package/access/functions/resolve-scope-context-id.js +71 -0
  77. package/access/functions/resolve-scope-context-id.js.map +1 -0
  78. package/access/functions/warn-if-public.d.ts +12 -0
  79. package/access/functions/warn-if-public.js +20 -0
  80. package/access/functions/warn-if-public.js.map +1 -0
  81. package/access/index.d.ts +2 -0
  82. package/access/index.js +2 -0
  83. package/access/index.js.map +1 -1
  84. package/access/interfaces/index.d.ts +1 -0
  85. package/access/interfaces/index.js +1 -0
  86. package/access/interfaces/index.js.map +1 -1
  87. package/access/interfaces/resolve-scope-context-id.d.ts +21 -0
  88. package/access/interfaces/resolve-scope-context-id.js +3 -0
  89. package/access/interfaces/resolve-scope-context-id.js.map +1 -0
  90. package/access/interfaces/scope-service-registry.d.ts +16 -1
  91. package/access/interfaces/scope-service.d.ts +6 -7
  92. package/access/models/scope-access-profile-keys-update.d.ts +5 -0
  93. package/access/models/scope-access-profile-keys-update.js +27 -0
  94. package/access/models/scope-access-profile-keys-update.js.map +1 -0
  95. package/access/models/scope-group-apply-access-profile.d.ts +6 -0
  96. package/access/models/scope-group-apply-access-profile.js +32 -0
  97. package/access/models/scope-group-apply-access-profile.js.map +1 -0
  98. package/access/models/scope-user-mapped.d.ts +1 -0
  99. package/access/models/scope-user-mapped.js +6 -0
  100. package/access/models/scope-user-mapped.js.map +1 -1
  101. package/access/models/scope-user.js +4 -2
  102. package/access/models/scope-user.js.map +1 -1
  103. package/access/queries/scope-access-profile.query.d.ts +1 -0
  104. package/access/queries/scope-access-profile.query.js +10 -0
  105. package/access/queries/scope-access-profile.query.js.map +1 -0
  106. package/access/queries/scope-group.query.js +9 -2
  107. package/access/queries/scope-group.query.js.map +1 -1
  108. package/access/services/index.d.ts +1 -0
  109. package/access/services/index.js +1 -0
  110. package/access/services/index.js.map +1 -1
  111. package/access/services/scope-access-profile.service.d.ts +13 -0
  112. package/access/services/scope-access-profile.service.js +75 -0
  113. package/access/services/scope-access-profile.service.js.map +1 -0
  114. package/access/services/scope-access.service.js +4 -2
  115. package/access/services/scope-access.service.js.map +1 -1
  116. package/access/services/scope-group-user.service.js +2 -2
  117. package/access/services/scope-group-user.service.js.map +1 -1
  118. package/access/services/scope-group.service.d.ts +10 -0
  119. package/access/services/scope-group.service.js +38 -1
  120. package/access/services/scope-group.service.js.map +1 -1
  121. package/access/services/scope-owner.service.d.ts +3 -0
  122. package/access/services/scope-owner.service.js +26 -1
  123. package/access/services/scope-owner.service.js.map +1 -1
  124. package/command/services/post-action-builder.js +19 -17
  125. package/command/services/post-action-builder.js.map +1 -1
  126. package/command/services/remove-action-builder.js +30 -22
  127. package/command/services/remove-action-builder.js.map +1 -1
  128. package/controllers/interfaces/controller-property.d.ts +7 -1
  129. package/controllers/services/default-action-builder.js +12 -30
  130. package/controllers/services/default-action-builder.js.map +1 -1
  131. package/controllers/services/restful-action-builder.js +25 -1
  132. package/controllers/services/restful-action-builder.js.map +1 -1
  133. package/core/contexts/request-context.d.ts +5 -0
  134. package/core/contexts/request-context.js +6 -0
  135. package/core/contexts/request-context.js.map +1 -0
  136. package/core/core.controller.js +6 -1
  137. package/core/core.controller.js.map +1 -1
  138. package/core/interfaces/action-docs.d.ts +15 -0
  139. package/core/interfaces/request-context.d.ts +5 -0
  140. package/core/services/request-router.js +2 -1
  141. package/core/services/request-router.js.map +1 -1
  142. package/database/database.controller.d.ts +1 -3
  143. package/database/database.controller.js +1 -5
  144. package/database/database.controller.js.map +1 -1
  145. package/database/decorators/protect-entity.decorator.d.ts +1 -0
  146. package/database/decorators/protect-entity.decorator.js +2 -3
  147. package/database/decorators/protect-entity.decorator.js.map +1 -1
  148. package/database/decorators/protected-entity.decorator.d.ts +1 -0
  149. package/database/decorators/protected-entity.decorator.js +2 -16
  150. package/database/decorators/protected-entity.decorator.js.map +1 -1
  151. package/database/functions/inject-repository-handle.js +4 -3
  152. package/database/functions/inject-repository-handle.js.map +1 -1
  153. package/database/interfaces/entity-object.d.ts +0 -6
  154. package/database/interfaces/index.d.ts +0 -1
  155. package/database/interfaces/index.js +0 -1
  156. package/database/interfaces/index.js.map +1 -1
  157. package/database/interfaces/repository.d.ts +8 -8
  158. package/docs/docs.module.js +3 -1
  159. package/docs/docs.module.js.map +1 -1
  160. package/docs/migrations/1747584000000-CreateDocsTables.d.ts +5 -0
  161. package/docs/migrations/1747584000000-CreateDocsTables.js +90 -0
  162. package/docs/migrations/1747584000000-CreateDocsTables.js.map +1 -0
  163. package/docs/migrations/migrations.d.ts +2 -0
  164. package/docs/migrations/migrations.js +8 -0
  165. package/docs/migrations/migrations.js.map +1 -0
  166. package/global.d.ts +2 -0
  167. package/global.js +1 -0
  168. package/global.js.map +1 -1
  169. package/index.d.ts +2 -1
  170. package/index.js +2 -1
  171. package/index.js.map +1 -1
  172. package/jobs/jobs.controller.d.ts +2 -0
  173. package/jobs/jobs.controller.js +20 -16
  174. package/jobs/jobs.controller.js.map +1 -1
  175. package/package.json +70 -70
  176. package/query/functions/add-join.js +2 -13
  177. package/query/functions/add-join.js.map +1 -1
  178. package/query/functions/create-query-builder.js +0 -10
  179. package/query/functions/create-query-builder.js.map +1 -1
  180. package/query/functions/execute-query.js +34 -0
  181. package/query/functions/execute-query.js.map +1 -1
  182. package/query/functions/load-properties.js +73 -5
  183. package/query/functions/load-properties.js.map +1 -1
  184. package/query/services/query-action-builder.js +12 -18
  185. package/query/services/query-action-builder.js.map +1 -1
  186. package/remote-logs/dtos/index.d.ts +2 -0
  187. package/remote-logs/dtos/index.js +19 -0
  188. package/remote-logs/dtos/index.js.map +1 -0
  189. package/remote-logs/dtos/remote-log-hooks.dto.d.ts +72 -0
  190. package/remote-logs/dtos/remote-log-hooks.dto.js +280 -0
  191. package/remote-logs/dtos/remote-log-hooks.dto.js.map +1 -0
  192. package/remote-logs/dtos/remote-log-search.dto.d.ts +34 -0
  193. package/remote-logs/dtos/remote-log-search.dto.js +146 -0
  194. package/remote-logs/dtos/remote-log-search.dto.js.map +1 -0
  195. package/remote-logs/environment.d.ts +4 -0
  196. package/remote-logs/environment.js +5 -0
  197. package/remote-logs/environment.js.map +1 -0
  198. package/remote-logs/index.d.ts +3 -0
  199. package/remote-logs/index.js +20 -0
  200. package/remote-logs/index.js.map +1 -0
  201. package/remote-logs/interfaces/index.d.ts +1 -0
  202. package/remote-logs/interfaces/index.js +18 -0
  203. package/remote-logs/interfaces/index.js.map +1 -0
  204. package/remote-logs/interfaces/remote-logs-module-options.d.ts +8 -0
  205. package/remote-logs/interfaces/remote-logs-module-options.js +3 -0
  206. package/remote-logs/interfaces/remote-logs-module-options.js.map +1 -0
  207. package/remote-logs/remote-logs-hooks.controller.d.ts +60 -0
  208. package/remote-logs/remote-logs-hooks.controller.js +331 -0
  209. package/remote-logs/remote-logs-hooks.controller.js.map +1 -0
  210. package/remote-logs/remote-logs.controller.d.ts +8 -0
  211. package/remote-logs/remote-logs.controller.js +41 -0
  212. package/remote-logs/remote-logs.controller.js.map +1 -0
  213. package/remote-logs/remote-logs.module.d.ts +12 -0
  214. package/remote-logs/remote-logs.module.js +107 -0
  215. package/remote-logs/remote-logs.module.js.map +1 -0
  216. package/remote-logs/services/opensearch.service.d.ts +13 -0
  217. package/remote-logs/services/opensearch.service.js +167 -0
  218. package/remote-logs/services/opensearch.service.js.map +1 -0
  219. package/security/auth.controller.js +4 -4
  220. package/security/auth.controller.js.map +1 -1
  221. package/security/functions/add-protected.d.ts +2 -2
  222. package/security/functions/add-protected.js +8 -5
  223. package/security/functions/add-protected.js.map +1 -1
  224. package/security/functions/create-authentication-interceptor.d.ts +44 -0
  225. package/security/functions/create-authentication-interceptor.js +114 -0
  226. package/security/functions/create-authentication-interceptor.js.map +1 -0
  227. package/security/functions/find-auth-context.d.ts +1 -2
  228. package/security/functions/find-auth-context.js +6 -11
  229. package/security/functions/find-auth-context.js.map +1 -1
  230. package/security/index.d.ts +1 -0
  231. package/security/index.js +1 -0
  232. package/security/index.js.map +1 -1
  233. package/security/interfaces/authorization-schema.d.ts +3 -1
  234. package/security/services/authorization.service.d.ts +5 -3
  235. package/security/services/authorization.service.js +56 -37
  236. package/security/services/authorization.service.js.map +1 -1
  237. package/storage/services/routes.service.js +1 -1
  238. package/storage/services/routes.service.js.map +1 -1
  239. package/tasks/constants.d.ts +3 -0
  240. package/tasks/constants.js +2 -1
  241. package/tasks/constants.js.map +1 -1
  242. package/tasks/controllers/task.controller.d.ts +3 -2
  243. package/tasks/controllers/task.controller.js +11 -40
  244. package/tasks/controllers/task.controller.js.map +1 -1
  245. package/tasks/decorators/index.d.ts +1 -0
  246. package/tasks/decorators/index.js +1 -0
  247. package/tasks/decorators/index.js.map +1 -1
  248. package/tasks/decorators/task-payload.decorator.d.ts +1 -0
  249. package/tasks/decorators/task-payload.decorator.js +12 -0
  250. package/tasks/decorators/task-payload.decorator.js.map +1 -0
  251. package/tasks/decorators/task.decorator.js +3 -0
  252. package/tasks/decorators/task.decorator.js.map +1 -1
  253. package/tasks/functions/compile-all-task-post-hooks.d.ts +1 -0
  254. package/tasks/functions/compile-all-task-post-hooks.js +27 -0
  255. package/tasks/functions/compile-all-task-post-hooks.js.map +1 -0
  256. package/tasks/functions/compile-task-hook-handle.d.ts +6 -0
  257. package/tasks/functions/compile-task-hook-handle.js +67 -0
  258. package/tasks/functions/compile-task-hook-handle.js.map +1 -0
  259. package/tasks/functions/create-task-hook.d.ts +9 -0
  260. package/tasks/functions/create-task-hook.js +13 -0
  261. package/tasks/functions/create-task-hook.js.map +1 -0
  262. package/tasks/functions/create-task-message-post.js +2 -0
  263. package/tasks/functions/create-task-message-post.js.map +1 -1
  264. package/tasks/functions/register-task-post-hook-interceptors.d.ts +3 -0
  265. package/tasks/functions/register-task-post-hook-interceptors.js +86 -0
  266. package/tasks/functions/register-task-post-hook-interceptors.js.map +1 -0
  267. package/tasks/functions/run-task-post-hooks.d.ts +11 -0
  268. package/tasks/functions/run-task-post-hooks.js +18 -0
  269. package/tasks/functions/run-task-post-hooks.js.map +1 -0
  270. package/tasks/functions/task-message-operations.d.ts +18 -0
  271. package/tasks/functions/task-message-operations.js +100 -0
  272. package/tasks/functions/task-message-operations.js.map +1 -0
  273. package/tasks/functions/validate-task-payload.d.ts +2 -0
  274. package/tasks/functions/validate-task-payload.js +19 -0
  275. package/tasks/functions/validate-task-payload.js.map +1 -0
  276. package/tasks/hook-constants.d.ts +2 -0
  277. package/tasks/hook-constants.js +6 -0
  278. package/tasks/hook-constants.js.map +1 -0
  279. package/tasks/index.d.ts +3 -0
  280. package/tasks/index.js +3 -0
  281. package/tasks/index.js.map +1 -1
  282. package/tasks/interfaces/compiled-task-post-hooks.d.ts +17 -0
  283. package/tasks/interfaces/compiled-task-post-hooks.js +3 -0
  284. package/tasks/interfaces/compiled-task-post-hooks.js.map +1 -0
  285. package/tasks/interfaces/index.d.ts +3 -0
  286. package/tasks/interfaces/index.js +3 -0
  287. package/tasks/interfaces/index.js.map +1 -1
  288. package/tasks/interfaces/task-hook.d.ts +16 -0
  289. package/tasks/interfaces/task-hook.js +8 -0
  290. package/tasks/interfaces/task-hook.js.map +1 -0
  291. package/tasks/interfaces/task-object.d.ts +4 -0
  292. package/tasks/interfaces/task-post-hook.d.ts +2 -0
  293. package/{database/interfaces/protector.js → tasks/interfaces/task-post-hook.js} +1 -1
  294. package/tasks/interfaces/task-post-hook.js.map +1 -0
  295. package/tasks/interfaces/task-settings.d.ts +5 -0
  296. package/tasks/services/task-runner.service.d.ts +24 -3
  297. package/tasks/services/task-runner.service.js +66 -28
  298. package/tasks/services/task-runner.service.js.map +1 -1
  299. package/translations/controllers/translation.controller.d.ts +3 -1
  300. package/translations/controllers/translation.controller.js +17 -3
  301. package/translations/controllers/translation.controller.js.map +1 -1
  302. package/translations/services/translations.service.d.ts +1 -0
  303. package/translations/services/translations.service.js +25 -6
  304. package/translations/services/translations.service.js.map +1 -1
  305. package/translations/services/translator.service.d.ts +1 -0
  306. package/translations/services/translator.service.js +6 -0
  307. package/translations/services/translator.service.js.map +1 -1
  308. package/database/functions/use-protector.d.ts +0 -2
  309. package/database/functions/use-protector.js +0 -11
  310. package/database/functions/use-protector.js.map +0 -1
  311. package/database/interfaces/protector.d.ts +0 -51
  312. package/database/interfaces/protector.js.map +0 -1
  313. package/database/services/protect-builder.d.ts +0 -60
  314. package/database/services/protect-builder.js +0 -524
  315. package/database/services/protect-builder.js.map +0 -1
  316. package/security/functions/add-protect.d.ts +0 -2
  317. package/security/functions/add-protect.js +0 -11
  318. package/security/functions/add-protect.js.map +0 -1
@@ -23,16 +23,24 @@ let TranslationsService = class TranslationsService {
23
23
  .createQueryBuilder('translationValues')
24
24
  .leftJoinAndMapOne('translationValues.translationConfig', translation_config_entity_1.TranslationConfig, 'translationConfig', `translationValues.translation_config_id = translationConfig.id`)
25
25
  .where(`
26
- (translationConfig.reference_id = '${referenceId}'
27
- AND translationValues.locale = '${locale}')
28
- OR translationValues.locale = translationConfig.default
29
- `)
26
+ translationConfig.reference_id = :referenceId
27
+ AND (
28
+ translationValues.locale = :locale
29
+ OR translationValues.locale = translationConfig.default
30
+ )
31
+ `, {
32
+ referenceId,
33
+ locale
34
+ })
30
35
  .getMany();
31
- const _default = values
36
+ const scoped = values.filter((value) => {
37
+ return value.translationConfig?.referenceId === referenceId;
38
+ });
39
+ const _default = scoped
32
40
  .find((value) => {
33
41
  return value.translationConfig?.default === value.locale;
34
42
  }) || { values: {} };
35
- const _requested = values
43
+ const _requested = scoped
36
44
  .find((value) => {
37
45
  return value.locale === locale;
38
46
  }) || { values: {} };
@@ -41,6 +49,17 @@ let TranslationsService = class TranslationsService {
41
49
  ..._requested.values
42
50
  };
43
51
  }
52
+ async getReferenceIdForConfig(translationConfigId) {
53
+ const config = await this
54
+ .repository
55
+ .manager
56
+ .getRepository(translation_config_entity_1.TranslationConfig)
57
+ .findOne({
58
+ where: { id: translationConfigId },
59
+ select: ['referenceId']
60
+ });
61
+ return config?.referenceId ?? null;
62
+ }
44
63
  };
45
64
  exports.TranslationsService = TranslationsService;
46
65
  __decorate([
@@ -1 +1 @@
1
- {"version":3,"file":"translations.service.js","sourceRoot":"./","sources":["translations/services/translations.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6DAAsD;AAEtD,qFAA0E;AAC1E,qFAA0E;AAC1E,6CAAkD;AAClD,qCAGiB;AACjB,uCAGqB;AAGd,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;IAS7B,KAAK,CAAC,SAAS,CACZ,WAAmB,EACnB,MAAc;QAEd,MAAM,MAAM,GAAG,MAAM,IAAI;aACrB,UAAU;aACV,kBAAkB,CAAC,mBAAmB,CAAC;aACvC,iBAAiB,CACf,qCAAqC,EACrC,6CAAiB,EACjB,mBAAmB,EACnB,gEAAgE,CAClE;aACA,KAAK,CAAC;iDACiC,WAAW;iDACX,MAAM;;UAE7C,CAAC;aACD,OAAO,EAAE,CAAC;QACd,MAAM,QAAQ,GAAG,MAAM;aACnB,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE;YACb,OAAO,KAAK,CAAC,iBAAiB,EAAE,OAAO,KAAK,KAAK,CAAC,MAAM,CAAC;QAC5D,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;QACxB,MAAM,UAAU,GAAG,MAAM;aACrB,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE;YACb,OAAO,KAAK,CAAC,MAAM,KAAK,MAAM,CAAC;QAClC,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;QACxB,OAAO;YACJ,GAAG,QAAQ,CAAC,MAAM;YAClB,GAAG,UAAU,CAAC,MAAM;SACtB,CAAC;IACL,CAAC;CACH,CAAA;AAzCY,kDAAmB;AAGnB;IADT,IAAA,2BAAgB,EAAC,GAAG,EAAE,CAAC,6CAAiB,CAAC;8BACpB,oBAAU;uDAAoB;AAG1C;IADT,IAAA,mBAAW,GAAE;;kDACiB;8BANrB,mBAAmB;IAD/B,IAAA,2BAAU,GAAE;GACA,mBAAmB,CAyC/B"}
1
+ {"version":3,"file":"translations.service.js","source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;aACP,aAAa,CAAC,6CAAiB,CAAC;aAChC,OAAO,CAAC;YACN,KAAK,EAAE,EAAE,EAAE,EAAE,mBAAmB,EAAE;YAClC,MAAM,EAAE,CAAC,aAAa,CAAC;SACzB,CAAC,CAAC;QACN,OAAO,MAAM,EAAE,WAAW,IAAI,IAAI,CAAC;IACtC,CAAC;CACH,CAAA;AAjEY,kDAAmB;AAGnB;IADT,IAAA,2BAAgB,EAAC,GAAG,EAAE,CAAC,6CAAiB,CAAC;8BACpB,oBAAU;uDAAoB;AAG1C;IADT,IAAA,mBAAW,GAAE;;kDACiB;8BANrB,mBAAmB;IAD/B,IAAA,2BAAU,GAAE;GACA,mBAAmB,CAiE/B"}
@@ -7,5 +7,6 @@ export declare class TranslatorService {
7
7
  protected cache: CacheClient;
8
8
  constructor(translationsService: TranslationsService);
9
9
  useValues(referenceId: string, locale: Locale): Promise<TranslatorHandle>;
10
+ invalidateReference(referenceId: string): Promise<void>;
10
11
  protected getHandle(values: Dictionary<string>): TranslatorHandle;
11
12
  }
@@ -33,6 +33,12 @@ let TranslatorService = class TranslatorService {
33
33
  await this.cache.expire(key, env_1.env.cacheTTL);
34
34
  return this.getHandle(values);
35
35
  }
36
+ async invalidateReference(referenceId) {
37
+ const keys = await this.cache.keys(`translations:${referenceId}:*`);
38
+ for (const key of keys) {
39
+ await this.cache.del(key);
40
+ }
41
+ }
36
42
  getHandle(values) {
37
43
  return (key, replaces = {}) => {
38
44
  let value = values[key] || key;
@@ -1 +1 @@
1
- {"version":3,"file":"translator.service.js","sourceRoot":"./","sources":["translations/services/translator.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6DAAsD;AACtD,iEAA6D;AAC7D,uCAGqB;AAOrB,gCAA6B;AAGtB,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IAK3B,YACa,mBAAwC;QAAxC,wBAAmB,GAAnB,mBAAmB,CAAqB;IAClD,CAAC;IAEJ,KAAK,CAAC,SAAS,CACZ,WAAmB,EACnB,MA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B,0CAAmB;GAN3C,iBAAiB,CAgD7B"}
1
+ {"version":3,"file":"translator.service.js","sourceRoot":"./","sources":["translations/services/translator.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6DAAsD;AACtD,iEAA6D;AAC7D,uCAGqB;AAOrB,gCAA6B;AAGtB,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IAK3B,YACa,mBAAwC;QAAxC,wBAAmB,GAAnB,mBAAmB,CAAqB;IAClD,CAAC;IAEJ,KAAK,CAAC,SAAS,CACZ,WAAmB,EACnB,MAAc;QAGd,MAAM,GAAG,GAAG,gBAAgB,WAAW,GAAG,MAAM,CAAC,CAAC,CAAC,IAAI,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;QACvE,MAAM,MAAM,GAAG,MAAM,IAAI;aACrB,KAAK;aACL,GAAG,CAAC,GAAG,CAAC,CAAC;QAEb,IAAI,MAAM,EAAE,CAAC;YACV,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;QAC7C,CAAC;QAED,MAAM,MAAM,GAAG,MAAM,IAAI;aACrB,mBAAmB;aACnB,SAAS,CACP,WAAW,EACX,MAAM,CACR,CAAC;QAGL,MAAM,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;QAClD,MAAM,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,EAAE,SAAG,CAAC,QAAQ,CAAC,CAAC;QAE3C,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IACjC,CAAC;IAED,KAAK,CAAC,mBAAmB,CAAC,WAAmB;QAC1C,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,gBAAgB,WAAW,IAAI,CAAC,CAAC;QACpE,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;YACtB,MAAM,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC7B,CAAC;IACJ,CAAC;IAES,SAAS,CAAC,MAA0B;QAC3C,OAAO,CAAC,GAAW,EAAE,WAA+B,EAAE,EAAE,EAAE;YACvD,IAAI,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC;YAC/B,MAAM;iBACF,mBAAmB,CAAC,QAAQ,CAAC;iBAC7B,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;gBAClB,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,OAAO,GAAG,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;YAC5D,CAAC,CAAC,CAAC;YACN,OAAO,KAAK,CAAC;QAChB,CAAC,CAAA;IACJ,CAAC;CACH,CAAA;AAvDY,8CAAiB;AAGjB;IADT,IAAA,mBAAW,GAAE;;gDACe;4BAHnB,iBAAiB;IAD7B,IAAA,2BAAU,GAAE;qCAOwB,0CAAmB;GAN3C,iBAAiB,CAuD7B"}
@@ -1,2 +0,0 @@
1
- import { Instantiable } from "@rockster/common";
2
- export declare const useProtector: (target: Instantiable) => import("../interfaces").Protector;
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useProtector = void 0;
4
- const useProtector = (target) => {
5
- const object = core
6
- .storage
7
- .findObject(target);
8
- return object?.protector;
9
- };
10
- exports.useProtector = useProtector;
11
- //# sourceMappingURL=use-protector.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-protector.js","sourceRoot":"./","sources":["database/functions/use-protector.ts"],"names":[],"mappings":";;;AAIO,MAAM,YAAY,GAAG,CAAC,MAAoB,EAAE,EAAE;IAClD,MAAM,MAAM,GAAG,IAAI;SACf,OAAO;SACP,UAAU,CAAC,MAAM,CACO,CAAC;IAC7B,OAAO,MAAM,EAAE,SAAS,CAAC;AAC5B,CAAC,CAAA;AANY,QAAA,YAAY,gBAMxB"}
@@ -1,51 +0,0 @@
1
- import { Dictionary, Instantiable } from "@rockster/common";
2
- import { EntityManager, SelectQueryBuilder } from "typeorm";
3
- export type IsAuthorizedHandle = {
4
- (args: {
5
- userId: string;
6
- keys: string[];
7
- contextId?: string;
8
- entityManager?: EntityManager;
9
- context?: string;
10
- }): Promise<void>;
11
- };
12
- export type GetUserPermissionsHandle = {
13
- (args: {
14
- userId: string;
15
- targetUserId: string;
16
- contextId: string;
17
- entityManager?: EntityManager;
18
- context: string;
19
- }): Promise<string[]>;
20
- };
21
- export type SetUserPermissionsHandle = {
22
- (args: {
23
- userId: string;
24
- targetUserId: string;
25
- contextId: string;
26
- entityManager?: EntityManager;
27
- context: string;
28
- accessKeys: string[];
29
- }): Promise<void>;
30
- };
31
- export type Protector = {
32
- target: Instantiable;
33
- rootCondition?: (args: {
34
- rootAlias: string;
35
- queryBuilder: SelectQueryBuilder<any>;
36
- userId: string;
37
- contextParams: Dictionary<any>;
38
- }) => SelectQueryBuilder<any>;
39
- relationCondition?: (args: {
40
- userId: string;
41
- contextParams: Dictionary<any>;
42
- alias: string;
43
- rootPath: Instantiable;
44
- }) => string;
45
- canRemove?: (userId: string, entityId: string, entityManager?: EntityManager) => Promise<void>;
46
- canModify?: <Entity>(userId: string, value: Entity, entityManager?: EntityManager) => Promise<void>;
47
- canCreate?: <Entity>(userId: string, value: Entity, entityManager?: EntityManager) => Promise<void>;
48
- isAuthorized?: IsAuthorizedHandle;
49
- getUserPermissions?: GetUserPermissionsHandle;
50
- setUserPermissions?: SetUserPermissionsHandle;
51
- };
@@ -1 +0,0 @@
1
- {"version":3,"file":"protector.js","sourceRoot":"./","sources":["database/interfaces/protector.ts"],"names":[],"mappings":""}
@@ -1,60 +0,0 @@
1
- import { ObjectNote, PropertyNote } from "@rockster/class-memory";
2
- import { Dictionary, Instantiable } from "@rockster/common";
3
- import { EntityManager } from "typeorm";
4
- import { GetUserPermissionsHandle, SetUserPermissionsHandle } from "../interfaces/protector";
5
- import { IProtectedEntityOptions } from "../decorators/protected-entity.decorator";
6
- import { IEntityObject } from "../interfaces/entity-object";
7
- import { IEntityProperty } from "../interfaces/entity-property";
8
- type ProtectedData = {
9
- object: ObjectNote<IEntityObject>;
10
- context?: PropertyNote<IEntityProperty>;
11
- options?: IProtectedEntityOptions;
12
- isContext: boolean;
13
- };
14
- type ProtectorData = {
15
- object: ObjectNote<IEntityObject>;
16
- target: PropertyNote<IEntityProperty>;
17
- context?: PropertyNote<IEntityProperty>;
18
- key?: PropertyNote<IEntityProperty>;
19
- };
20
- export declare class ProtectBuilder {
21
- build(object: ObjectNote<IEntityObject>): Promise<void>;
22
- protected buildProtectorConfig(object: ObjectNote<IEntityObject>): void;
23
- protected getRepository(target: Instantiable, entityManager?: EntityManager): import("typeorm").Repository<any>;
24
- protected createQueryBuilder({ authKeys, data, protectorData, userId, displayContext, entityManager, protectedData }: {
25
- protectorData: ProtectorData;
26
- userId: string;
27
- data: any;
28
- authKeys: string[];
29
- displayContext?: string;
30
- entityManager?: EntityManager;
31
- protectedData?: ProtectedData;
32
- }): import("typeorm").SelectQueryBuilder<any>;
33
- protected buildFilterKeys(protectorAlias: string, protectorKey: string, keys: string[]): string;
34
- protected getQueryContextAndKeyCondition(protectorData: ProtectorData, protectedData: ProtectedData, protectorAlias: string, alias: string, contextParams: Dictionary<any>, rootPath?: Instantiable): {
35
- context: string;
36
- key: string;
37
- };
38
- protected buildProtectedConfig(object: ObjectNote<IEntityObject>): void;
39
- protected getSetUserPermissions(data: ProtectorData): SetUserPermissionsHandle;
40
- protected getGetUserPermissions(data: ProtectorData): GetUserPermissionsHandle;
41
- protected getAuthContextFilter(targetUserId: string, data: ProtectorData, contextId: string): {
42
- where: {
43
- [x: string]: string;
44
- };
45
- keyProperty: PropertyNote<IEntityProperty>;
46
- contextProperty: PropertyNote<IEntityProperty>;
47
- targetProperty: PropertyNote<IEntityProperty>;
48
- };
49
- protected checkIsAuthorized({ data, userId, entityManager, keys, context, contextId }: {
50
- data: ProtectorData;
51
- entityManager?: EntityManager;
52
- keys: string[];
53
- context: string;
54
- contextId: string;
55
- userId: string;
56
- }): Promise<void>;
57
- protected getProtectedData(protector: ProtectorData, object: ObjectNote<IEntityObject>): ProtectedData;
58
- protected getProtectorData(protector: Instantiable): ProtectorData;
59
- }
60
- export {};