@rockster/core 0.0.4 → 0.1.0

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 (309) 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/database/functions/use-protector.d.ts +0 -2
  300. package/database/functions/use-protector.js +0 -11
  301. package/database/functions/use-protector.js.map +0 -1
  302. package/database/interfaces/protector.d.ts +0 -51
  303. package/database/interfaces/protector.js.map +0 -1
  304. package/database/services/protect-builder.d.ts +0 -60
  305. package/database/services/protect-builder.js +0 -524
  306. package/database/services/protect-builder.js.map +0 -1
  307. package/security/functions/add-protect.d.ts +0 -2
  308. package/security/functions/add-protect.js +0 -11
  309. package/security/functions/add-protect.js.map +0 -1
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.resolveScopeContextId = resolveScopeContextId;
4
+ const env_1 = require("../env");
5
+ const build_scope_resolver_initial_data_1 = require("./build-scope-resolver-initial-data");
6
+ const init_scope_service_executors_1 = require("./init-scope-service-executors");
7
+ const CONTEXT_ID_FIELDS = {
8
+ workspace: ["$workspaceId", "workspaceId"],
9
+ project: ["$projectId", "projectId"],
10
+ account: ["$accountId", "accountId"],
11
+ manager: ["$contextId", "contextId"],
12
+ };
13
+ function pickContextIdFromPayload(payload, contextName) {
14
+ if (!payload || typeof payload !== "object") {
15
+ return undefined;
16
+ }
17
+ const record = payload;
18
+ const fields = CONTEXT_ID_FIELDS[contextName] ?? ["$contextId", "contextId"];
19
+ for (const field of fields) {
20
+ const value = record[field];
21
+ if (value != null && String(value).trim() !== "") {
22
+ return String(value);
23
+ }
24
+ }
25
+ return undefined;
26
+ }
27
+ function normalizeRequestPayload(requestPayload, actionKind) {
28
+ if (actionKind === "remove") {
29
+ if (requestPayload == null
30
+ || typeof requestPayload === "string"
31
+ || typeof requestPayload === "number") {
32
+ return undefined;
33
+ }
34
+ }
35
+ return requestPayload;
36
+ }
37
+ async function resolveScopeContextId(params) {
38
+ const registry = env_1.env.scopeServiceRegistry.get(params.contextName);
39
+ if (registry?.withId === false) {
40
+ return undefined;
41
+ }
42
+ const handlerName = params.resolverHandler ?? init_scope_service_executors_1.DEFAULT_SCOPE_CONTEXT_RESOLVER;
43
+ const executor = registry?.resolvers?.[handlerName];
44
+ if (executor) {
45
+ const initialData = (0, build_scope_resolver_initial_data_1.buildScopeResolverInitialData)(params, params.requestContext, params.pendingAnnotations);
46
+ const resolved = await executor.handle(initialData);
47
+ if (resolved != null && String(resolved).trim() !== "") {
48
+ return String(resolved);
49
+ }
50
+ if (params.resolverHandler
51
+ && params.resolverHandler !== init_scope_service_executors_1.DEFAULT_SCOPE_CONTEXT_RESOLVER) {
52
+ return undefined;
53
+ }
54
+ }
55
+ else if (registry?.instance) {
56
+ throw new Error(`[${registry.Service.name}] scope resolver "${handlerName}" is not registered — decorate the method with @ScopeContextIdResolver()`);
57
+ }
58
+ const payload = normalizeRequestPayload(params.requestPayload, params.actionKind);
59
+ const fromPayload = pickContextIdFromPayload(payload, params.contextName);
60
+ if (fromPayload) {
61
+ return fromPayload;
62
+ }
63
+ if (params.actionKind === "remove" && params.idValue != null) {
64
+ const id = String(params.idValue).trim();
65
+ if (id !== "") {
66
+ return id;
67
+ }
68
+ }
69
+ return undefined;
70
+ }
71
+ //# sourceMappingURL=resolve-scope-context-id.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve-scope-context-id.js","sourceRoot":"./","sources":["access/functions/resolve-scope-context-id.ts"],"names":[],"mappings":";;AA0DA,sDAsDC;AA9GD,gCAA6B;AAE7B,2FAAoF;AACpF,iFAAgF;AAEhF,MAAM,iBAAiB,GAA6B;IACjD,SAAS,EAAE,CAAC,cAAc,EAAE,aAAa,CAAC;IAC1C,OAAO,EAAE,CAAC,YAAY,EAAE,WAAW,CAAC;IACpC,OAAO,EAAE,CAAC,YAAY,EAAE,WAAW,CAAC;IACpC,OAAO,EAAE,CAAC,YAAY,EAAE,WAAW,CAAC;CACtC,CAAC;AAQF,SAAS,wBAAwB,CAC9B,OAAgB,EAChB,WAAmB;IAEnB,IAAI,CAAC,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;QAC3C,OAAO,SAAS,CAAC;IACpB,CAAC;IAED,MAAM,MAAM,GAAG,OAAkC,CAAC;IAClD,MAAM,MAAM,GAAG,iBAAiB,CAAC,WAAW,CAAC,IAAI,CAAC,YAAY,EAAE,WAAW,CAAC,CAAC;IAE7E,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC1B,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;QAC5B,IAAI,KAAK,IAAI,IAAI,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;YAChD,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;QACxB,CAAC;IACJ,CAAC;IAED,OAAO,SAAS,CAAC;AACpB,CAAC;AAED,SAAS,uBAAuB,CAC7B,cAAuB,EACvB,UAAsD;IAEtD,IAAI,UAAU,KAAK,QAAQ,EAAE,CAAC;QAC3B,IACG,cAAc,IAAI,IAAI;eACnB,OAAO,cAAc,KAAK,QAAQ;eAClC,OAAO,cAAc,KAAK,QAAQ,EACtC,CAAC;YACA,OAAO,SAAS,CAAC;QACpB,CAAC;IACJ,CAAC;IAED,OAAO,cAAc,CAAC;AACzB,CAAC;AAEM,KAAK,UAAU,qBAAqB,CACxC,MAAmC;IAEnC,MAAM,QAAQ,GAAG,SAAG,CAAC,oBAAoB,CAAC,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IAElE,IAAI,QAAQ,EAAE,MAAM,KAAK,KAAK,EAAE,CAAC;QAC9B,OAAO,SAAS,CAAC;IACpB,CAAC;IAED,MAAM,WAAW,GAAG,MAAM,CAAC,eAAe,IAAI,6DAA8B,CAAC;IAC7E,MAAM,QAAQ,GAAG,QAAQ,EAAE,SAAS,EAAE,CAAC,WAAW,CAAC,CAAC;IAEpD,IAAI,QAAQ,EAAE,CAAC;QACZ,MAAM,WAAW,GAAG,IAAA,iEAA6B,EAC9C,MAAM,EACN,MAAM,CAAC,cAAc,EACrB,MAAM,CAAC,kBAAkB,CAC3B,CAAC;QACF,MAAM,QAAQ,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;QAEpD,IAAI,QAAQ,IAAI,IAAI,IAAI,MAAM,CAAC,QAAQ,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;YACtD,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC;QAC3B,CAAC;QAED,IACG,MAAM,CAAC,eAAe;eACnB,MAAM,CAAC,eAAe,KAAK,6DAA8B,EAC7D,CAAC;YACA,OAAO,SAAS,CAAC;QACpB,CAAC;IACJ,CAAC;SAAM,IAAI,QAAQ,EAAE,QAAQ,EAAE,CAAC;QAC7B,MAAM,IAAI,KAAK,CACZ,IAAI,QAAQ,CAAC,OAAO,CAAC,IAAI,qBAAqB,WAAW,0EAA0E,CACrI,CAAC;IACL,CAAC;IAED,MAAM,OAAO,GAAG,uBAAuB,CACpC,MAAM,CAAC,cAAc,EACrB,MAAM,CAAC,UAAU,CACnB,CAAC;IAEF,MAAM,WAAW,GAAG,wBAAwB,CAAC,OAAO,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;IAC1E,IAAI,WAAW,EAAE,CAAC;QACf,OAAO,WAAW,CAAC;IACtB,CAAC;IAED,IAAI,MAAM,CAAC,UAAU,KAAK,QAAQ,IAAI,MAAM,CAAC,OAAO,IAAI,IAAI,EAAE,CAAC;QAC5D,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC;QACzC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;YACb,OAAO,EAAE,CAAC;QACb,CAAC;IACJ,CAAC;IAED,OAAO,SAAS,CAAC;AACpB,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { PropertyNote } from "@rockster/class-memory";
2
+ import { IControllerProperty } from "../../controllers/interfaces/controller-property";
3
+ /**
4
+ * Standing warning for every endpoint exposed without authentication
5
+ * (`public: true`). Endpoints that use a special auth strategy
6
+ * (`property.authenticated`, via `createAuthenticationInterceptor`) are exempt —
7
+ * they skip the default auth service but still authenticate.
8
+ *
9
+ * Called by every action builder at registration so a public route can never
10
+ * ship silently.
11
+ */
12
+ export declare function warnIfPublic(label: string, property: PropertyNote<IControllerProperty>): void;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.warnIfPublic = warnIfPublic;
4
+ const logger_1 = require("@rockster/logger");
5
+ const logger = new logger_1.Logger("Security");
6
+ /**
7
+ * Standing warning for every endpoint exposed without authentication
8
+ * (`public: true`). Endpoints that use a special auth strategy
9
+ * (`property.authenticated`, via `createAuthenticationInterceptor`) are exempt —
10
+ * they skip the default auth service but still authenticate.
11
+ *
12
+ * Called by every action builder at registration so a public route can never
13
+ * ship silently.
14
+ */
15
+ function warnIfPublic(label, property) {
16
+ if (property.public && !property.authenticated) {
17
+ logger.warn(`[PUBLIC] ${label} — endpoint exposto sem autenticação (public:true)`);
18
+ }
19
+ }
20
+ //# sourceMappingURL=warn-if-public.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"warn-if-public.js","sourceRoot":"./","sources":["access/functions/warn-if-public.ts"],"names":[],"mappings":";;AAeA,oCASC;AAvBD,6CAA0C;AAG1C,MAAM,MAAM,GAAG,IAAI,eAAM,CAAC,UAAU,CAAC,CAAC;AAEtC;;;;;;;;GAQG;AACH,SAAgB,YAAY,CACzB,KAAa,EACb,QAA2C;IAE3C,IAAI,QAAQ,CAAC,MAAM,IAAI,CAAC,QAAQ,CAAC,aAAa,EAAE,CAAC;QAC9C,MAAM,CAAC,IAAI,CACR,YAAY,KAAK,oDAAoD,CACvE,CAAC;IACL,CAAC;AACJ,CAAC"}
package/access/index.d.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  export * from './entities';
2
2
  export * from './access.module';
3
+ export * from './constants';
4
+ export * from './decorators';
3
5
  export * from './functions';
4
6
  export * from './services';
5
7
  export * from './interfaces';
package/access/index.js CHANGED
@@ -16,6 +16,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./entities"), exports);
18
18
  __exportStar(require("./access.module"), exports);
19
+ __exportStar(require("./constants"), exports);
20
+ __exportStar(require("./decorators"), exports);
19
21
  __exportStar(require("./functions"), exports);
20
22
  __exportStar(require("./services"), exports);
21
23
  __exportStar(require("./interfaces"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"./","sources":["access/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA2B;AAC3B,kDAAgC;AAChC,8CAA4B;AAC5B,6CAA2B;AAC3B,+CAA6B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"./","sources":["access/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA2B;AAC3B,kDAAgC;AAChC,8CAA4B;AAC5B,+CAA6B;AAC7B,8CAA4B;AAC5B,6CAA2B;AAC3B,+CAA6B"}
@@ -1,2 +1,3 @@
1
1
  export * from './scope-service-registry';
2
2
  export * from './scope-service';
3
+ export * from './resolve-scope-context-id';
@@ -16,4 +16,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./scope-service-registry"), exports);
18
18
  __exportStar(require("./scope-service"), exports);
19
+ __exportStar(require("./resolve-scope-context-id"), exports);
19
20
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"./","sources":["access/interfaces/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2DAAyC;AACzC,kDAAgC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"./","sources":["access/interfaces/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2DAAyC;AACzC,kDAAgC;AAChC,6DAA2C"}
@@ -0,0 +1,21 @@
1
+ import { EntityManager } from "typeorm";
2
+ import { Instantiable } from "@rockster/common";
3
+ export type ScopeActionKind = "query" | "post" | "remove" | "default";
4
+ /** Params injected with @ContextParams() on @ScopeContextIdResolver methods. */
5
+ export type IScopeContextParams = IResolveScopeContextIdParams;
6
+ export interface IResolveScopeContextIdParams {
7
+ contextName: string;
8
+ requestPayload?: unknown;
9
+ actionKind: ScopeActionKind;
10
+ postType?: "create" | "modify";
11
+ idValue?: string;
12
+ entityTarget?: Instantiable;
13
+ entityManager?: EntityManager;
14
+ withId?: boolean;
15
+ /**
16
+ * Per-request store. Resolvers may stash loaded entities here (e.g. the
17
+ * project/account row fetched to resolve the context id) so other resolvers
18
+ * or the handler reuse them instead of hitting the DB again.
19
+ */
20
+ store?: Map<string, unknown>;
21
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=resolve-scope-context-id.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve-scope-context-id.js","sourceRoot":"./","sources":["access/interfaces/resolve-scope-context-id.ts"],"names":[],"mappings":""}
@@ -1,6 +1,21 @@
1
- import { Instantiable } from "@rockster/common";
1
+ import { ExecutorData } from "@rockster/class-injector/interfaces";
2
+ import { Dictionary, Instantiable } from "@rockster/common";
2
3
  import { IScopeService } from "./scope-service";
3
4
  export interface IScopeServiceRegistry {
4
5
  Service: Instantiable<IScopeService<any>>;
6
+ /** When false, scope has no context id (e.g. manager). */
7
+ withId?: boolean;
5
8
  instance?: IScopeService<any>;
9
+ resolvers?: Dictionary<ExecutorData>;
10
+ /** Marks this scope as the hierarchy root (e.g. workspace). */
11
+ root?: boolean;
12
+ /** Context name of the root scope this scope descends from. */
13
+ rootScope?: string;
14
+ /**
15
+ * Key that, held at the ROOT context, grants everything in every descendant
16
+ * scope (platform master). Set on the root scope.
17
+ */
18
+ masterKey?: string;
19
+ /** Key that grants everything WITHIN this context (context admin). */
20
+ adminKey?: string;
6
21
  }
@@ -1,12 +1,11 @@
1
1
  import { IScopeUserMapped } from "@rockster/common/access";
2
- import { IRequestValues } from "@rockster/common";
3
2
  import { GetConditionCallbackResult } from "../../database/interfaces/path";
4
3
  import { SelectQueryBuilder } from "../../database/extensions/select-query-builder";
5
- export interface IScopeService<TCurrentSession> {
4
+ export interface IScopeService<_TCurrentSession = unknown> {
6
5
  joinUser(rootAlias: string, contextId: string, queryBuilder: SelectQueryBuilder<IScopeUserMapped>): GetConditionCallbackResult;
7
- onAction(values: IRequestValues<TCurrentSession>): string | Promise<string>;
8
- onQuery(values: IRequestValues<TCurrentSession>): string | Promise<string>;
9
- onPostCreate(values: IRequestValues<TCurrentSession>): string | Promise<string>;
10
- onPostModify(values: IRequestValues<TCurrentSession>): string | Promise<string>;
11
- onRestful(values: IRequestValues<TCurrentSession>): string | Promise<string>;
6
+ /**
7
+ * Maps a context id to its hierarchy ROOT context id (e.g. account/project →
8
+ * workspace). The root scope returns the same id. Used by the master-key check.
9
+ */
10
+ resolveRootContextId?(contextId: string): Promise<string | undefined>;
12
11
  }
@@ -0,0 +1,5 @@
1
+ import { IScopeAccessProfileKeysUpdate } from "@rockster/common/access";
2
+ export declare class ScopeAccessProfileKeysUpdate implements IScopeAccessProfileKeysUpdate {
3
+ scopeAccessProfileId: string;
4
+ keys: string[];
5
+ }
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.ScopeAccessProfileKeysUpdate = void 0;
13
+ const class_pipe_1 = require("@rockster/class-pipe");
14
+ class ScopeAccessProfileKeysUpdate {
15
+ }
16
+ exports.ScopeAccessProfileKeysUpdate = ScopeAccessProfileKeysUpdate;
17
+ __decorate([
18
+ (0, class_pipe_1.IsRequired)(),
19
+ (0, class_pipe_1.IsString)(),
20
+ __metadata("design:type", String)
21
+ ], ScopeAccessProfileKeysUpdate.prototype, "scopeAccessProfileId", void 0);
22
+ __decorate([
23
+ (0, class_pipe_1.IsRequired)(),
24
+ (0, class_pipe_1.IsArray)(),
25
+ __metadata("design:type", Array)
26
+ ], ScopeAccessProfileKeysUpdate.prototype, "keys", void 0);
27
+ //# sourceMappingURL=scope-access-profile-keys-update.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scope-access-profile-keys-update.js","sourceRoot":"./","sources":["access/models/scope-access-profile-keys-update.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAqE;AAGrE,MAAa,4BAA4B;CASxC;AATD,oEASC;AALE;IAFC,IAAA,uBAAU,GAAE;IACZ,IAAA,qBAAQ,GAAE;;0EACkB;AAI7B;IAFC,IAAA,uBAAU,GAAE;IACZ,IAAA,oBAAO,GAAE;;0DACK"}
@@ -0,0 +1,6 @@
1
+ import { IScopeGroupApplyAccessProfile } from "@rockster/common/access";
2
+ export declare class ScopeGroupApplyAccessProfile implements IScopeGroupApplyAccessProfile {
3
+ groupId: string;
4
+ contextName: string;
5
+ contextId: string;
6
+ }
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.ScopeGroupApplyAccessProfile = void 0;
13
+ const class_pipe_1 = require("@rockster/class-pipe");
14
+ class ScopeGroupApplyAccessProfile {
15
+ }
16
+ exports.ScopeGroupApplyAccessProfile = ScopeGroupApplyAccessProfile;
17
+ __decorate([
18
+ (0, class_pipe_1.IsRequired)(),
19
+ (0, class_pipe_1.IsString)(),
20
+ __metadata("design:type", String)
21
+ ], ScopeGroupApplyAccessProfile.prototype, "groupId", void 0);
22
+ __decorate([
23
+ (0, class_pipe_1.IsRequired)(),
24
+ (0, class_pipe_1.IsString)(),
25
+ __metadata("design:type", String)
26
+ ], ScopeGroupApplyAccessProfile.prototype, "contextName", void 0);
27
+ __decorate([
28
+ (0, class_pipe_1.IsRequired)(),
29
+ (0, class_pipe_1.IsString)(),
30
+ __metadata("design:type", String)
31
+ ], ScopeGroupApplyAccessProfile.prototype, "contextId", void 0);
32
+ //# sourceMappingURL=scope-group-apply-access-profile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scope-group-apply-access-profile.js","sourceRoot":"./","sources":["access/models/scope-group-apply-access-profile.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAA4D;AAG5D,MAAa,4BAA4B;CAaxC;AAbD,oEAaC;AATE;IAFC,IAAA,uBAAU,GAAE;IACZ,IAAA,qBAAQ,GAAE;;6DACK;AAIhB;IAFC,IAAA,uBAAU,GAAE;IACZ,IAAA,qBAAQ,GAAE;;iEACS;AAIpB;IAFC,IAAA,uBAAU,GAAE;IACZ,IAAA,qBAAQ,GAAE;;+DACO"}
@@ -5,4 +5,5 @@ export declare class ScopeUserMapped implements IScopeUserMapped {
5
5
  email: string;
6
6
  imageUrl?: string;
7
7
  active?: boolean;
8
+ isScopeOwner?: boolean;
8
9
  }
@@ -39,4 +39,10 @@ __decorate([
39
39
  (0, class_pipe_1.IsBoolean)(),
40
40
  __metadata("design:type", Boolean)
41
41
  ], ScopeUserMapped.prototype, "active", void 0);
42
+ __decorate([
43
+ (0, class_pipe_1.Expose)(),
44
+ (0, class_pipe_1.IsBoolean)(),
45
+ (0, class_pipe_1.IsOptional)(),
46
+ __metadata("design:type", Boolean)
47
+ ], ScopeUserMapped.prototype, "isScopeOwner", void 0);
42
48
  //# sourceMappingURL=scope-user-mapped.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"scope-user-mapped.js","sourceRoot":"./","sources":["access/models/scope-user-mapped.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAmE;AAGnE,MAAa,eAAe;CAsB3B;AAtBD,0CAsBC;AAjBE;IAFC,IAAA,mBAAM,GAAE;IACR,IAAA,qBAAQ,GAAE;;2CACA;AAIX;IAFC,IAAA,mBAAM,GAAE;IACR,IAAA,qBAAQ,GAAE;;6CACE;AAIb;IAFC,IAAA,mBAAM,GAAE;IACR,IAAA,qBAAQ,GAAE;;8CACG;AAId;IAFC,IAAA,mBAAM,GAAE;IACR,IAAA,qBAAQ,GAAE;;iDACO;AAIlB;IAFC,IAAA,mBAAM,GAAE;IACR,IAAA,sBAAS,GAAE;;+CACK"}
1
+ {"version":3,"file":"scope-user-mapped.js","sourceRoot":"./","sources":["access/models/scope-user-mapped.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAA+E;AAG/E,MAAa,eAAe;CA2B3B;AA3BD,0CA2BC;AAtBE;IAFC,IAAA,mBAAM,GAAE;IACR,IAAA,qBAAQ,GAAE;;2CACA;AAIX;IAFC,IAAA,mBAAM,GAAE;IACR,IAAA,qBAAQ,GAAE;;6CACE;AAIb;IAFC,IAAA,mBAAM,GAAE;IACR,IAAA,qBAAQ,GAAE;;8CACG;AAId;IAFC,IAAA,mBAAM,GAAE;IACR,IAAA,qBAAQ,GAAE;;iDACO;AAIlB;IAFC,IAAA,mBAAM,GAAE;IACR,IAAA,sBAAS,GAAE;;+CACK;AAKjB;IAHC,IAAA,mBAAM,GAAE;IACR,IAAA,sBAAS,GAAE;IACX,IAAA,uBAAU,GAAE;;qDACU"}
@@ -12,7 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.ScopeUser = void 0;
13
13
  const class_pipe_1 = require("@rockster/class-pipe");
14
14
  const scope_group_1 = require("../entities/scope-group");
15
- const scope_key_1 = require("../entities/scope-key");
15
+ const scope_access_1 = require("../entities/scope-access");
16
16
  class ScopeUser {
17
17
  }
18
18
  exports.ScopeUser = ScopeUser;
@@ -38,12 +38,14 @@ __decorate([
38
38
  ], ScopeUser.prototype, "contextId", void 0);
39
39
  __decorate([
40
40
  (0, class_pipe_1.Expose)(),
41
+ (0, class_pipe_1.IsArray)(),
41
42
  (0, class_pipe_1.IsType)(() => scope_group_1.ScopeGroup),
42
43
  __metadata("design:type", Array)
43
44
  ], ScopeUser.prototype, "groups", void 0);
44
45
  __decorate([
45
46
  (0, class_pipe_1.Expose)(),
46
- (0, class_pipe_1.IsType)(() => scope_key_1.ScopeKey),
47
+ (0, class_pipe_1.IsArray)(),
48
+ (0, class_pipe_1.IsType)(() => scope_access_1.ScopeAccess),
47
49
  __metadata("design:type", Array)
48
50
  ], ScopeUser.prototype, "keys", void 0);
49
51
  //# sourceMappingURL=scope-user.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"scope-user.js","sourceRoot":"./","sources":["access/models/scope-user.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAK8B;AAM9B,yDAAqD;AACrD,qDAAiD;AAEjD,MAAa,SAAS;CAyBrB;AAzBD,8BAyBC;AArBE;IAFC,IAAA,mBAAM,GAAE;IACR,IAAA,sBAAS,GAAE;;0CACM;AAIlB;IAFC,IAAA,mBAAM,GAAE;IACR,IAAA,qBAAQ,GAAE;;yCACI;AAIf;IAFC,IAAA,mBAAM,GAAE;IACR,IAAA,qBAAQ,GAAE;;8CACS;AAIpB;IAFC,IAAA,mBAAM,GAAE;IACR,IAAA,qBAAQ,GAAE;;4CACQ;AAInB;IAFC,IAAA,mBAAM,GAAE;IACR,IAAA,mBAAM,EAAC,GAAG,EAAE,CAAC,wBAAU,CAAC;;yCACF;AAIvB;IAFC,IAAA,mBAAM,GAAE;IACR,IAAA,mBAAM,EAAC,GAAG,EAAE,CAAC,oBAAQ,CAAC;;uCACD"}
1
+ {"version":3,"file":"scope-user.js","sourceRoot":"./","sources":["access/models/scope-user.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAM8B;AAM9B,yDAAqD;AAErD,2DAAuD;AAEvD,MAAa,SAAS;CA2BrB;AA3BD,8BA2BC;AAvBE;IAFC,IAAA,mBAAM,GAAE;IACR,IAAA,sBAAS,GAAE;;0CACM;AAIlB;IAFC,IAAA,mBAAM,GAAE;IACR,IAAA,qBAAQ,GAAE;;yCACI;AAIf;IAFC,IAAA,mBAAM,GAAE;IACR,IAAA,qBAAQ,GAAE;;8CACS;AAIpB;IAFC,IAAA,mBAAM,GAAE;IACR,IAAA,qBAAQ,GAAE;;4CACQ;AAKnB;IAHC,IAAA,mBAAM,GAAE;IACR,IAAA,oBAAO,GAAE;IACT,IAAA,mBAAM,EAAC,GAAG,EAAE,CAAC,wBAAU,CAAC;;yCACF;AAKvB;IAHC,IAAA,mBAAM,GAAE;IACR,IAAA,oBAAO,GAAE;IACT,IAAA,mBAAM,EAAC,GAAG,EAAE,CAAC,0BAAW,CAAC;;uCACJ"}
@@ -0,0 +1 @@
1
+ export declare const ScopeAccessProfileQuery: import("../../query/functions/create-query").QueryDecoratorFactory;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ScopeAccessProfileQuery = void 0;
4
+ const create_query_1 = require("../../query/functions/create-query");
5
+ const scope_access_profile_1 = require("../entities/scope-access-profile");
6
+ exports.ScopeAccessProfileQuery = (0, create_query_1.createQuery)({
7
+ alias: "scopeAccessProfile",
8
+ target: () => scope_access_profile_1.ScopeAccessProfile,
9
+ });
10
+ //# sourceMappingURL=scope-access-profile.query.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scope-access-profile.query.js","sourceRoot":"./","sources":["access/queries/scope-access-profile.query.ts"],"names":[],"mappings":";;;AAAA,qEAAiE;AACjE,2EAAsE;AAEzD,QAAA,uBAAuB,GAAG,IAAA,0BAAW,EAAC;IAChD,KAAK,EAAE,oBAAoB;IAC3B,MAAM,EAAE,GAAG,EAAE,CAAC,yCAAkB;CAClC,CAAC,CAAC"}
@@ -2,11 +2,18 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ScopeGroupQuery = void 0;
4
4
  const create_query_1 = require("../../query/functions/create-query");
5
+ const scope_access_profile_1 = require("../entities/scope-access-profile");
5
6
  const scope_group_1 = require("../entities/scope-group");
6
7
  const scope_context_1 = require("../models/scope-context");
7
8
  exports.ScopeGroupQuery = (0, create_query_1.createQuery)({
8
- alias: 'scopeGroup',
9
+ alias: "scopeGroup",
9
10
  target: () => scope_group_1.ScopeGroup,
10
- context: () => scope_context_1.ScopeContext
11
+ context: () => scope_context_1.ScopeContext,
12
+ paths: {
13
+ scopeAccessProfile: (0, create_query_1.joinOne)({
14
+ alias: "scopeAccessProfile",
15
+ target: () => scope_access_profile_1.ScopeAccessProfile,
16
+ }),
17
+ },
11
18
  });
12
19
  //# sourceMappingURL=scope-group.query.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"scope-group.query.js","sourceRoot":"./","sources":["access/queries/scope-group.query.ts"],"names":[],"mappings":";;;AAAA,qEAAiE;AACjE,yDAAqD;AACrD,2DAAuD;AAE1C,QAAA,eAAe,GAAG,IAAA,0BAAW,EAAC;IACxC,KAAK,EAAE,YAAY;IACnB,MAAM,EAAE,GAAG,EAAE,CAAC,wBAAU;IACxB,OAAO,EAAE,GAAG,EAAE,CAAC,4BAAY;CAC7B,CAAC,CAAA"}
1
+ {"version":3,"file":"scope-group.query.js","sourceRoot":"./","sources":["access/queries/scope-group.query.ts"],"names":[],"mappings":";;;AAAA,qEAA0E;AAC1E,2EAAsE;AACtE,yDAAqD;AACrD,2DAAuD;AAE1C,QAAA,eAAe,GAAG,IAAA,0BAAW,EAAC;IACxC,KAAK,EAAE,YAAY;IACnB,MAAM,EAAE,GAAG,EAAE,CAAC,wBAAU;IACxB,OAAO,EAAE,GAAG,EAAE,CAAC,4BAAY;IAC3B,KAAK,EAAE;QACJ,kBAAkB,EAAE,IAAA,sBAAO,EAAC;YACzB,KAAK,EAAE,oBAAoB;YAC3B,MAAM,EAAE,GAAG,EAAE,CAAC,yCAAkB;SAClC,CAAC;KACJ;CACH,CAAC,CAAC"}
@@ -1,4 +1,5 @@
1
1
  export * from './scope-access.service';
2
+ export * from './scope-access-profile.service';
2
3
  export * from './scope-group-user.service';
3
4
  export * from './scope-group.service';
4
5
  export * from './scope-key.service';
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./scope-access.service"), exports);
18
+ __exportStar(require("./scope-access-profile.service"), exports);
18
19
  __exportStar(require("./scope-group-user.service"), exports);
19
20
  __exportStar(require("./scope-group.service"), exports);
20
21
  __exportStar(require("./scope-key.service"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"./","sources":["access/services/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yDAAuC;AACvC,6DAA2C;AAC3C,wDAAsC;AACtC,sDAAoC;AACpC,wDAAsC;AACtC,kDAAgC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"./","sources":["access/services/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yDAAuC;AACvC,iEAA+C;AAC/C,6DAA2C;AAC3C,wDAAsC;AACtC,sDAAoC;AACpC,wDAAsC;AACtC,kDAAgC"}
@@ -0,0 +1,13 @@
1
+ import { IScopeAccessProfile, IScopeAccessProfileKey } from "@rockster/common/access";
2
+ import { RepositoryService } from "../../database/services/repository.service";
3
+ import { Repository } from "../../database/interfaces/repository";
4
+ import { ScopeKey } from "../entities/scope-key";
5
+ export declare class ScopeAccessProfileService extends RepositoryService<IScopeAccessProfile> {
6
+ protected repository: Repository<IScopeAccessProfile>;
7
+ protected profileKeyRepository: Repository<IScopeAccessProfileKey>;
8
+ protected scopeKeyRepository: Repository<ScopeKey>;
9
+ updateKeys(scopeAccessProfileId: string, keys: string[]): Promise<IScopeAccessProfileKey[]>;
10
+ getProfileKeys(scopeAccessProfileId: string): Promise<IScopeAccessProfileKey[]>;
11
+ /** Keys from the profile whose scope_key.context_name matches the given context. */
12
+ getKeysForContext(scopeAccessProfileId: string, contextName: string): Promise<string[]>;
13
+ }
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.ScopeAccessProfileService = void 0;
13
+ const class_injector_1 = require("@rockster/class-injector");
14
+ const repository_service_1 = require("../../database/services/repository.service");
15
+ const inject_repository_decorator_1 = require("../../database/decorators/inject-repository.decorator");
16
+ const scope_access_profile_1 = require("../entities/scope-access-profile");
17
+ const scope_access_profile_key_1 = require("../entities/scope-access-profile-key");
18
+ const scope_key_1 = require("../entities/scope-key");
19
+ const generate_entity_id_1 = require("../../database/functions/generate-entity-id");
20
+ const normalize_scope_keys_1 = require("../functions/normalize-scope-keys");
21
+ let ScopeAccessProfileService = class ScopeAccessProfileService extends repository_service_1.RepositoryService {
22
+ async updateKeys(scopeAccessProfileId, keys) {
23
+ await this.profileKeyRepository.delete({ scopeAccessProfileId });
24
+ const validKeys = (0, normalize_scope_keys_1.normalizeScopeKeys)(keys);
25
+ if (!validKeys.length) {
26
+ return [];
27
+ }
28
+ const rows = validKeys.map((key) => ({
29
+ id: (0, generate_entity_id_1.generateEntityId)(scope_access_profile_key_1.ScopeAccessProfileKey),
30
+ scopeAccessProfileId,
31
+ key,
32
+ }));
33
+ return this.profileKeyRepository.save(rows);
34
+ }
35
+ async getProfileKeys(scopeAccessProfileId) {
36
+ return this.profileKeyRepository.find({
37
+ where: { scopeAccessProfileId },
38
+ });
39
+ }
40
+ /** Keys from the profile whose scope_key.context_name matches the given context. */
41
+ async getKeysForContext(scopeAccessProfileId, contextName) {
42
+ const profileKeys = await this.getProfileKeys(scopeAccessProfileId);
43
+ if (!profileKeys.length) {
44
+ return [];
45
+ }
46
+ const keyNames = profileKeys
47
+ .map((row) => row.key)
48
+ .filter((key) => Boolean(key));
49
+ if (!keyNames.length) {
50
+ return [];
51
+ }
52
+ const scopeKeys = await this.scopeKeyRepository.find({
53
+ where: { contextName },
54
+ });
55
+ const allowed = new Set(scopeKeys.map((row) => row.name));
56
+ return (0, normalize_scope_keys_1.normalizeScopeKeys)(keyNames.filter((key) => allowed.has(key)));
57
+ }
58
+ };
59
+ exports.ScopeAccessProfileService = ScopeAccessProfileService;
60
+ __decorate([
61
+ (0, inject_repository_decorator_1.InjectRepository)(() => scope_access_profile_1.ScopeAccessProfile),
62
+ __metadata("design:type", Object)
63
+ ], ScopeAccessProfileService.prototype, "repository", void 0);
64
+ __decorate([
65
+ (0, inject_repository_decorator_1.InjectRepository)(() => scope_access_profile_key_1.ScopeAccessProfileKey),
66
+ __metadata("design:type", Object)
67
+ ], ScopeAccessProfileService.prototype, "profileKeyRepository", void 0);
68
+ __decorate([
69
+ (0, inject_repository_decorator_1.InjectRepository)(() => scope_key_1.ScopeKey),
70
+ __metadata("design:type", Object)
71
+ ], ScopeAccessProfileService.prototype, "scopeKeyRepository", void 0);
72
+ exports.ScopeAccessProfileService = ScopeAccessProfileService = __decorate([
73
+ (0, class_injector_1.Injectable)()
74
+ ], ScopeAccessProfileService);
75
+ //# sourceMappingURL=scope-access-profile.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scope-access-profile.service.js","sourceRoot":"./","sources":["access/services/scope-access-profile.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6DAAsD;AAKtD,mFAA+E;AAC/E,uGAAyF;AAEzF,2EAAsE;AACtE,mFAA6E;AAC7E,qDAAiD;AACjD,oFAA+E;AAC/E,4EAAuE;AAGhE,IAAM,yBAAyB,GAA/B,MAAM,yBAA0B,SAAQ,sCAAsC;IAWlF,KAAK,CAAC,UAAU,CAAC,oBAA4B,EAAE,IAAc;QAC1D,MAAM,IAAI,CAAC,oBAAoB,CAAC,MAAM,CAAC,EAAE,oBAAoB,EAAE,CAAC,CAAC;QAEjE,MAAM,SAAS,GAAG,IAAA,yCAAkB,EAAC,IAAI,CAAC,CAAC;QAE3C,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC;YACrB,OAAO,EAAE,CAAC;QACb,CAAC;QAED,MAAM,IAAI,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;YAClC,EAAE,EAAE,IAAA,qCAAgB,EAAC,gDAAqB,CAAC;YAC3C,oBAAoB;YACpB,GAAG;SACsB,CAAA,CAAC,CAAC;QAE9B,OAAO,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC/C,CAAC;IAED,KAAK,CAAC,cAAc,CAAC,oBAA4B;QAC9C,OAAO,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC;YACnC,KAAK,EAAE,EAAE,oBAAoB,EAAE;SACjC,CAAC,CAAC;IACN,CAAC;IAED,oFAAoF;IACpF,KAAK,CAAC,iBAAiB,CAAC,oBAA4B,EAAE,WAAmB;QACtE,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,oBAAoB,CAAC,CAAC;QACpE,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC;YACvB,OAAO,EAAc,CAAC;QACzB,CAAC;QAED,MAAM,QAAQ,GAAG,WAAW;aACxB,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC;aACrB,MAAM,CAAC,CAAC,GAAG,EAAiB,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;QAEjD,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;YACpB,OAAO,EAAE,CAAC;QACb,CAAC;QAED,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC;YAClD,KAAK,EAAE,EAAE,WAAW,EAAE;SACxB,CAAC,CAAC;QAEH,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;QAC1D,OAAO,IAAA,yCAAkB,EAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACzE,CAAC;CACH,CAAA;AAzDY,8DAAyB;AAGzB;IADT,IAAA,8CAAgB,EAAC,GAAG,EAAE,CAAC,yCAAkB,CAAC;;6DACW;AAG5C;IADT,IAAA,8CAAgB,EAAC,GAAG,EAAE,CAAC,gDAAqB,CAAC;;uEACqB;AAGzD;IADT,IAAA,8CAAgB,EAAC,GAAG,EAAE,CAAC,oBAAQ,CAAC;;qEACkB;oCATzC,yBAAyB;IADrC,IAAA,2BAAU,GAAE;GACA,yBAAyB,CAyDrC"}
@@ -15,6 +15,7 @@ const repository_service_1 = require("../../database/services/repository.service
15
15
  const inject_repository_decorator_1 = require("../../database/decorators/inject-repository.decorator");
16
16
  const scope_access_1 = require("../entities/scope-access");
17
17
  const generate_entity_id_1 = require("../../database/functions/generate-entity-id");
18
+ const normalize_scope_keys_1 = require("../functions/normalize-scope-keys");
18
19
  let ScopeAccessService = class ScopeAccessService extends repository_service_1.RepositoryService {
19
20
  constructor() {
20
21
  super(...arguments);
@@ -57,7 +58,7 @@ let ScopeAccessService = class ScopeAccessService extends repository_service_1.R
57
58
  }
58
59
  async getKeysWithCtx(contextId, userId) {
59
60
  const rows = await this.repository.query(this.withCtxQuery, [userId, contextId]);
60
- return rows.map(r => r.k);
61
+ return rows.map(row => row.key);
61
62
  }
62
63
  async updateKeys(type, contextName, contextId, targetId, keys) {
63
64
  const keyName = type === 'group' ? 'groupId' : 'userId';
@@ -66,7 +67,8 @@ let ScopeAccessService = class ScopeAccessService extends repository_service_1.R
66
67
  contextId,
67
68
  contextName
68
69
  });
69
- const accessKeys = keys.map(key => ({
70
+ const validKeys = (0, normalize_scope_keys_1.normalizeScopeKeys)(keys);
71
+ const accessKeys = validKeys.map(key => ({
70
72
  id: (0, generate_entity_id_1.generateEntityId)(scope_access_1.ScopeAccess),
71
73
  [keyName]: targetId,
72
74
  contextName: contextName,
@@ -1 +1 @@
1
- {"version":3,"file":"scope-access.service.js","sourceRoot":"./","sources":["access/services/scope-access.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6DAAsD;AACtD,mFAA+E;AAE/E,uGAAyF;AAEzF,2DAAuD;AACvD,oFAA+E;AAGxE,IAAM,kBAAkB,GAAxB,MAAM,kBAAmB,SAAQ,sCAA+B;IAAhE;;QAKM,eAAU,GAAG;;;;;;;;;;;;;;IActB,CAAC;QAEQ,iBAAY,GAAG;;;;;;;;;;;;;;;;IAgBxB,CAAC;IA6CL,CAAC;IA3CE,KAAK,CAAC,cAAc,CAAC,MAAc;QAChC,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,KAAK,CACrC,IAAI,CAAC,UAAU,EACf,CAAC,MAAM,CAAC,CACV,CAAC;QAEF,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAa,CAAC;IACzC,CAAC;IAED,KAAK,CAAC,cAAc,CAAC,SAAiB,EAAE,MAAc;QACnD,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,KAAK,CACrC,IAAI,CAAC,YAAY,EACjB,CAAC,MAAM,EAAE,SAAS,CAAC,CACrB,CAAC;QAEF,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAa,CAAA;IACxC,CAAC;IAED,KAAK,CAAC,UAAU,CACb,IAAsB,EACtB,WAAmB,EACnB,SAAiB,EACjB,QAAgB,EAChB,IAAc;QAEd,MAAM,OAAO,GAAG,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC;QAExD,MAAM,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC;YAC1B,CAAC,OAAO,CAAC,EAAE,QAAQ;YACnB,SAAS;YACT,WAAW;SACb,CAAC,CAAC;QAEH,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YACjC,EAAE,EAAE,IAAA,qCAAgB,EAAC,0BAAW,CAAC;YACjC,CAAC,OAAO,CAAC,EAAE,QAAQ;YACnB,WAAW,EAAE,WAAW;YACxB,SAAS,EAAE,SAAS;YACpB,GAAG,EAAE,GAAG;SACO,CAAA,CAAC,CAAC;QAEpB,MAAM,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAC1C,CAAC;CACH,CAAA;AAlFY,gDAAkB;AAGlB;IADT,IAAA,8CAAgB,EAAC,GAAG,EAAE,CAAC,0BAAW,CAAC;;sDACW;6BAHrC,kBAAkB;IAD9B,IAAA,2BAAU,GAAE;GACA,kBAAkB,CAkF9B"}
1
+ {"version":3,"file":"scope-access.service.js","sourceRoot":"./","sources":["access/services/scope-access.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6DAAsD;AACtD,mFAA+E;AAE/E,uGAAyF;AAEzF,2DAAuD;AACvD,oFAA+E;AAC/E,4EAAuE;AAGhE,IAAM,kBAAkB,GAAxB,MAAM,kBAAmB,SAAQ,sCAA+B;IAAhE;;QAKM,eAAU,GAAG;;;;;;;;;;;;;;IActB,CAAC;QAEQ,iBAAY,GAAG;;;;;;;;;;;;;;;;IAgBxB,CAAC;IA+CL,CAAC;IA7CE,KAAK,CAAC,cAAc,CAAC,MAAc;QAChC,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,KAAK,CACrC,IAAI,CAAC,UAAU,EACf,CAAC,MAAM,CAAC,CACV,CAAC;QAEF,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAa,CAAC;IACzC,CAAC;IAED,KAAK,CAAC,cAAc,CAAC,SAAiB,EAAE,MAAc;QACnD,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,KAAK,CACrC,IAAI,CAAC,YAAY,EACjB,CAAC,MAAM,EAAE,SAAS,CAAC,CACrB,CAAC;QAEF,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAa,CAAA;IAC9C,CAAC;IAED,KAAK,CAAC,UAAU,CACb,IAAsB,EACtB,WAAmB,EACnB,SAAiB,EACjB,QAAgB,EAChB,IAAc;QAEd,MAAM,OAAO,GAAG,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC;QAExD,MAAM,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC;YAC1B,CAAC,OAAO,CAAC,EAAE,QAAQ;YACnB,SAAS;YACT,WAAW;SACb,CAAC,CAAC;QAEH,MAAM,SAAS,GAAG,IAAA,yCAAkB,EAAC,IAAI,CAAC,CAAC;QAE3C,MAAM,UAAU,GAAG,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YACtC,EAAE,EAAE,IAAA,qCAAgB,EAAC,0BAAW,CAAC;YACjC,CAAC,OAAO,CAAC,EAAE,QAAQ;YACnB,WAAW,EAAE,WAAW;YACxB,SAAS,EAAE,SAAS;YACpB,GAAG,EAAE,GAAG;SACO,CAAA,CAAC,CAAC;QAEpB,MAAM,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAC1C,CAAC;CACH,CAAA;AApFY,gDAAkB;AAGlB;IADT,IAAA,8CAAgB,EAAC,GAAG,EAAE,CAAC,0BAAW,CAAC;;sDACW;6BAHrC,kBAAkB;IAD9B,IAAA,2BAAU,GAAE;GACA,kBAAkB,CAoF9B"}
@@ -31,10 +31,10 @@ let ScopeGroupUserService = class ScopeGroupUserService extends repository_servi
31
31
  return this
32
32
  .repository
33
33
  .createQueryBuilder('scopeGroupUser')
34
- .leftJoin(scope_group_1.ScopeGroup, 'scopeGroup')
34
+ .leftJoin(scope_group_1.ScopeGroup, 'scopeGroup', '"scopeGroup".id = "scopeGroupUser".group_id')
35
35
  .where(`"scopeGroup".context_name = '${contextName}'
36
36
  AND "scopeGroupUser".user_id = '${userId}'
37
- ${!contextId ? '' : `"scopeGroup".context_id = '${contextId}'`}`)
37
+ ${!contextId ? '' : `AND "scopeGroup".context_id = '${contextId}'`}`)
38
38
  .getMany();
39
39
  }
40
40
  };
@@ -1 +1 @@
1
- {"version":3,"file":"scope-group-user.service.js","sourceRoot":"./","sources":["access/services/scope-group-user.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6DAAsD;AACtD,mFAA+E;AAE/E,uGAAyF;AAEzF,mEAA8D;AAC9D,oFAA+E;AAC/E,yDAAqD;AAG9C,IAAM,qBAAqB,GAA3B,MAAM,qBAAsB,SAAQ,sCAAkC;IAK1E,KAAK,CAAC,cAAc,CAAC,OAAe,EAAE,MAAc;QACjD,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;QACvE,IAAI,SAAS;YAAE,OAAO,SAAS,CAAC;QAChC,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;YACzB,EAAE,EAAE,IAAA,qCAAgB,EAAC,iCAAc,CAAC;YACpC,OAAO,EAAE,OAAO;YAChB,MAAM,EAAE,MAAM;SAChB,CAAC,CAAC;IACN,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,MAAc,EAAE,WAAmB,EAAE,SAAkB;QACpE,OAAO,IAAI;aACP,UAAU;aACV,kBAAkB,CAAC,gBAAgB,CAAC;aACpC,QAAQ,CACN,wBAAU,EACV,YAAY,CACd;aACA,KAAK,CAAC,gCAAgC,WAAW;8CACb,MAAM;cACtC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,8BAA8B,SAAS,GAAG,EAAE,CAAC;aACnE,OAAO,EAAE,CAAC;IACjB,CAAC;CACH,CAAA;AA5BY,sDAAqB;AAGrB;IADT,IAAA,8CAAgB,EAAC,GAAG,EAAE,CAAC,iCAAc,CAAC;;yDACW;gCAHxC,qBAAqB;IADjC,IAAA,2BAAU,GAAE;GACA,qBAAqB,CA4BjC"}
1
+ {"version":3,"file":"scope-group-user.service.js","sourceRoot":"./","sources":["access/services/scope-group-user.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6DAAsD;AACtD,mFAA+E;AAE/E,uGAAyF;AAEzF,mEAA8D;AAC9D,oFAA+E;AAC/E,yDAAqD;AAG9C,IAAM,qBAAqB,GAA3B,MAAM,qBAAsB,SAAQ,sCAAkC;IAK1E,KAAK,CAAC,cAAc,CAAC,OAAe,EAAE,MAAc;QACjD,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;QACvE,IAAI,SAAS;YAAE,OAAO,SAAS,CAAC;QAChC,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;YACzB,EAAE,EAAE,IAAA,qCAAgB,EAAC,iCAAc,CAAC;YACpC,OAAO,EAAE,OAAO;YAChB,MAAM,EAAE,MAAM;SAChB,CAAC,CAAC;IACN,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,MAAc,EAAE,WAAmB,EAAE,SAAkB;QACpE,OAAO,IAAI;aACP,UAAU;aACV,kBAAkB,CAAC,gBAAgB,CAAC;aACpC,QAAQ,CACN,wBAAU,EACV,YAAY,EACZ,6CAA6C,CAC/C;aACA,KAAK,CAAC,gCAAgC,WAAW;8CACb,MAAM;cACtC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,kCAAkC,SAAS,GAAG,EAAE,CAAC;aACvE,OAAO,EAAE,CAAC;IACjB,CAAC;CACH,CAAA;AA7BY,sDAAqB;AAGrB;IADT,IAAA,8CAAgB,EAAC,GAAG,EAAE,CAAC,iCAAc,CAAC;;yDACW;gCAHxC,qBAAqB;IADjC,IAAA,2BAAU,GAAE;GACA,qBAAqB,CA6BjC"}