@rockster/core 0.0.2 → 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 (501) hide show
  1. package/access/access.module.d.ts +11 -0
  2. package/access/access.module.js +56 -0
  3. package/access/access.module.js.map +1 -0
  4. package/access/constants.d.ts +2 -0
  5. package/access/constants.js +6 -0
  6. package/access/constants.js.map +1 -0
  7. package/access/controllers/controllers.d.ts +7 -0
  8. package/access/controllers/controllers.js +18 -0
  9. package/access/controllers/controllers.js.map +1 -0
  10. package/access/controllers/scope-access-profile.controller.d.ts +17 -0
  11. package/access/controllers/scope-access-profile.controller.js +111 -0
  12. package/access/controllers/scope-access-profile.controller.js.map +1 -0
  13. package/access/controllers/scope-group-user.controller.d.ts +20 -0
  14. package/access/controllers/scope-group-user.controller.js +132 -0
  15. package/access/controllers/scope-group-user.controller.js.map +1 -0
  16. package/access/controllers/scope-group.controller.d.ts +22 -0
  17. package/access/controllers/scope-group.controller.js +177 -0
  18. package/access/controllers/scope-group.controller.js.map +1 -0
  19. package/access/controllers/scope-key.controller.d.ts +7 -0
  20. package/access/controllers/scope-key.controller.js +45 -0
  21. package/access/controllers/scope-key.controller.js.map +1 -0
  22. package/access/controllers/scope-owner.controller.d.ts +9 -0
  23. package/access/controllers/scope-owner.controller.js +80 -0
  24. package/access/controllers/scope-owner.controller.js.map +1 -0
  25. package/access/controllers/scope-user.controller.d.ts +14 -0
  26. package/access/controllers/scope-user.controller.js +109 -0
  27. package/access/controllers/scope-user.controller.js.map +1 -0
  28. package/access/decorators/context-params.decorator.d.ts +2 -0
  29. package/access/decorators/context-params.decorator.js +13 -0
  30. package/access/decorators/context-params.decorator.js.map +1 -0
  31. package/access/decorators/index.d.ts +2 -0
  32. package/access/decorators/index.js +19 -0
  33. package/access/decorators/index.js.map +1 -0
  34. package/access/decorators/scope-context-id-resolver.decorator.d.ts +10 -0
  35. package/access/decorators/scope-context-id-resolver.decorator.js +22 -0
  36. package/access/decorators/scope-context-id-resolver.decorator.js.map +1 -0
  37. package/access/entities/entities.d.ts +8 -0
  38. package/access/entities/entities.js +22 -0
  39. package/access/entities/entities.js.map +1 -0
  40. package/access/entities/index.d.ts +7 -0
  41. package/access/entities/index.js +24 -0
  42. package/access/entities/index.js.map +1 -0
  43. package/access/entities/scope-access-profile-key.d.ts +6 -0
  44. package/access/entities/scope-access-profile-key.js +40 -0
  45. package/access/entities/scope-access-profile-key.js.map +1 -0
  46. package/access/entities/scope-access-profile.d.ts +6 -0
  47. package/access/entities/scope-access-profile.js +37 -0
  48. package/access/entities/scope-access-profile.js.map +1 -0
  49. package/access/entities/scope-access.d.ts +9 -0
  50. package/access/entities/scope-access.js +58 -0
  51. package/access/entities/scope-access.js.map +1 -0
  52. package/access/entities/scope-group-user.d.ts +7 -0
  53. package/access/entities/scope-group-user.js +47 -0
  54. package/access/entities/scope-group-user.js.map +1 -0
  55. package/access/entities/scope-group.d.ts +12 -0
  56. package/access/entities/scope-group.js +72 -0
  57. package/access/entities/scope-group.js.map +1 -0
  58. package/access/entities/scope-key.d.ts +5 -0
  59. package/access/entities/scope-key.js +35 -0
  60. package/access/entities/scope-key.js.map +1 -0
  61. package/access/entities/scope-owner.d.ts +7 -0
  62. package/access/entities/scope-owner.js +45 -0
  63. package/access/entities/scope-owner.js.map +1 -0
  64. package/access/env.d.ts +10 -0
  65. package/access/env.js +10 -0
  66. package/access/env.js.map +1 -0
  67. package/access/functions/assert-context-admin-access.d.ts +15 -0
  68. package/access/functions/assert-context-admin-access.js +62 -0
  69. package/access/functions/assert-context-admin-access.js.map +1 -0
  70. package/access/functions/assert-master-or-owner.d.ts +9 -0
  71. package/access/functions/assert-master-or-owner.js +40 -0
  72. package/access/functions/assert-master-or-owner.js.map +1 -0
  73. package/access/functions/assert-scope-action-access.d.ts +32 -0
  74. package/access/functions/assert-scope-action-access.js +189 -0
  75. package/access/functions/assert-scope-action-access.js.map +1 -0
  76. package/access/functions/build-scope-resolver-initial-data.d.ts +4 -0
  77. package/access/functions/build-scope-resolver-initial-data.js +17 -0
  78. package/access/functions/build-scope-resolver-initial-data.js.map +1 -0
  79. package/access/functions/describe-action-scope.d.ts +9 -0
  80. package/access/functions/describe-action-scope.js +27 -0
  81. package/access/functions/describe-action-scope.js.map +1 -0
  82. package/access/functions/get-context-id-service.d.ts +1 -0
  83. package/access/functions/get-context-id-service.js +8 -0
  84. package/access/functions/get-context-id-service.js.map +1 -0
  85. package/access/functions/get-is-owner.d.ts +1 -0
  86. package/access/functions/get-is-owner.js +8 -0
  87. package/access/functions/get-is-owner.js.map +1 -0
  88. package/access/functions/get-user-keys.d.ts +2 -0
  89. package/access/functions/get-user-keys.js +10 -0
  90. package/access/functions/get-user-keys.js.map +1 -0
  91. package/access/functions/index.d.ts +8 -0
  92. package/access/functions/index.js +25 -0
  93. package/access/functions/index.js.map +1 -0
  94. package/access/functions/init-scope-service-executors.d.ts +3 -0
  95. package/access/functions/init-scope-service-executors.js +38 -0
  96. package/access/functions/init-scope-service-executors.js.map +1 -0
  97. package/access/functions/normalize-scope-keys.d.ts +4 -0
  98. package/access/functions/normalize-scope-keys.js +17 -0
  99. package/access/functions/normalize-scope-keys.js.map +1 -0
  100. package/access/functions/register-scope.d.ts +19 -0
  101. package/access/functions/register-scope.js +94 -0
  102. package/access/functions/register-scope.js.map +1 -0
  103. package/access/functions/resolve-scope-context-id.d.ts +9 -0
  104. package/access/functions/resolve-scope-context-id.js +71 -0
  105. package/access/functions/resolve-scope-context-id.js.map +1 -0
  106. package/access/functions/warn-if-public.d.ts +12 -0
  107. package/access/functions/warn-if-public.js +20 -0
  108. package/access/functions/warn-if-public.js.map +1 -0
  109. package/access/index.d.ts +7 -0
  110. package/access/index.js +24 -0
  111. package/access/index.js.map +1 -0
  112. package/access/interfaces/index.d.ts +3 -0
  113. package/access/interfaces/index.js +20 -0
  114. package/access/interfaces/index.js.map +1 -0
  115. package/access/interfaces/resolve-scope-context-id.d.ts +21 -0
  116. package/access/interfaces/resolve-scope-context-id.js +3 -0
  117. package/access/interfaces/resolve-scope-context-id.js.map +1 -0
  118. package/access/interfaces/scope-service-registry.d.ts +21 -0
  119. package/access/interfaces/scope-service-registry.js +3 -0
  120. package/access/interfaces/scope-service-registry.js.map +1 -0
  121. package/access/interfaces/scope-service.d.ts +11 -0
  122. package/{database/interfaces/protector.js → access/interfaces/scope-service.js} +1 -1
  123. package/access/interfaces/scope-service.js.map +1 -0
  124. package/access/models/scope-access-profile-keys-update.d.ts +5 -0
  125. package/access/models/scope-access-profile-keys-update.js +27 -0
  126. package/access/models/scope-access-profile-keys-update.js.map +1 -0
  127. package/access/models/scope-context.d.ts +4 -0
  128. package/access/models/scope-context.js +27 -0
  129. package/access/models/scope-context.js.map +1 -0
  130. package/access/models/scope-group-apply-access-profile.d.ts +6 -0
  131. package/access/models/scope-group-apply-access-profile.js +32 -0
  132. package/access/models/scope-group-apply-access-profile.js.map +1 -0
  133. package/access/models/scope-keys-update.d.ts +7 -0
  134. package/access/models/scope-keys-update.js +38 -0
  135. package/access/models/scope-keys-update.js.map +1 -0
  136. package/access/models/scope-owner.d.ts +5 -0
  137. package/access/models/scope-owner.js +32 -0
  138. package/access/models/scope-owner.js.map +1 -0
  139. package/access/models/scope-user-mapped.d.ts +9 -0
  140. package/access/models/scope-user-mapped.js +48 -0
  141. package/access/models/scope-user-mapped.js.map +1 -0
  142. package/access/models/scope-user.d.ts +9 -0
  143. package/access/models/scope-user.js +51 -0
  144. package/access/models/scope-user.js.map +1 -0
  145. package/access/queries/scope-access-profile.query.d.ts +1 -0
  146. package/access/queries/scope-access-profile.query.js +10 -0
  147. package/access/queries/scope-access-profile.query.js.map +1 -0
  148. package/access/queries/scope-group-user.query.d.ts +1 -0
  149. package/access/queries/scope-group-user.query.js +26 -0
  150. package/access/queries/scope-group-user.query.js.map +1 -0
  151. package/access/queries/scope-group.query.d.ts +1 -0
  152. package/access/queries/scope-group.query.js +19 -0
  153. package/access/queries/scope-group.query.js.map +1 -0
  154. package/access/services/index.d.ts +7 -0
  155. package/access/services/index.js +24 -0
  156. package/access/services/index.js.map +1 -0
  157. package/access/services/scope-access-profile.service.d.ts +13 -0
  158. package/access/services/scope-access-profile.service.js +75 -0
  159. package/access/services/scope-access-profile.service.js.map +1 -0
  160. package/access/services/scope-access.service.d.ts +11 -0
  161. package/access/services/scope-access.service.js +89 -0
  162. package/access/services/scope-access.service.js.map +1 -0
  163. package/access/services/scope-group-user.service.d.ts +8 -0
  164. package/access/services/scope-group-user.service.js +49 -0
  165. package/access/services/scope-group-user.service.js.map +1 -0
  166. package/access/services/scope-group.service.d.ts +17 -0
  167. package/access/services/scope-group.service.js +75 -0
  168. package/access/services/scope-group.service.js.map +1 -0
  169. package/access/services/scope-key.service.d.ts +9 -0
  170. package/access/services/scope-key.service.js +52 -0
  171. package/access/services/scope-key.service.js.map +1 -0
  172. package/access/services/scope-owner.service.d.ts +10 -0
  173. package/access/services/scope-owner.service.js +60 -0
  174. package/access/services/scope-owner.service.js.map +1 -0
  175. package/access/services/scope-service.d.ts +10 -0
  176. package/access/services/scope-service.js +52 -0
  177. package/access/services/scope-service.js.map +1 -0
  178. package/command/functions/execute-post.js +5 -7
  179. package/command/functions/execute-post.js.map +1 -1
  180. package/command/services/post-action-builder.js +21 -17
  181. package/command/services/post-action-builder.js.map +1 -1
  182. package/command/services/remove-action-builder.js +32 -22
  183. package/command/services/remove-action-builder.js.map +1 -1
  184. package/common/entities/base-entity.js +2 -0
  185. package/common/entities/base-entity.js.map +1 -1
  186. package/common/interfaces/enum/object-type.d.ts +2 -1
  187. package/common/interfaces/enum/object-type.js +1 -0
  188. package/common/interfaces/enum/object-type.js.map +1 -1
  189. package/controllers/constants/controller-transaction.d.ts +2 -0
  190. package/controllers/constants/controller-transaction.js +6 -0
  191. package/controllers/constants/controller-transaction.js.map +1 -0
  192. package/controllers/controller.controller.d.ts +1 -1
  193. package/controllers/controller.controller.js +4 -4
  194. package/controllers/controller.controller.js.map +1 -1
  195. package/controllers/decorators/controller.decorator.js +8 -0
  196. package/controllers/decorators/controller.decorator.js.map +1 -1
  197. package/controllers/decorators/index.d.ts +1 -0
  198. package/controllers/decorators/index.js +1 -0
  199. package/controllers/decorators/index.js.map +1 -1
  200. package/controllers/decorators/transaction.decorator.d.ts +7 -0
  201. package/controllers/decorators/transaction.decorator.js +23 -0
  202. package/controllers/decorators/transaction.decorator.js.map +1 -0
  203. package/controllers/interfaces/controller-object.d.ts +1 -0
  204. package/controllers/interfaces/controller-options.d.ts +1 -0
  205. package/controllers/interfaces/controller-property.d.ts +9 -0
  206. package/controllers/services/default-action-builder.js +14 -0
  207. package/controllers/services/default-action-builder.js.map +1 -1
  208. package/controllers/services/restful-action-builder.js +25 -1
  209. package/controllers/services/restful-action-builder.js.map +1 -1
  210. package/core/contexts/request-context.d.ts +5 -0
  211. package/core/contexts/request-context.js +6 -0
  212. package/core/contexts/request-context.js.map +1 -0
  213. package/core/core.controller.d.ts +1 -0
  214. package/core/core.controller.js +15 -2
  215. package/core/core.controller.js.map +1 -1
  216. package/core/functions/create-interceptor.js +2 -2
  217. package/core/functions/create-interceptor.js.map +1 -1
  218. package/core/functions/resolve-action-transactional.d.ts +3 -0
  219. package/core/functions/resolve-action-transactional.js +10 -0
  220. package/core/functions/resolve-action-transactional.js.map +1 -0
  221. package/core/interfaces/action-def.d.ts +2 -5
  222. package/core/interfaces/action-docs.d.ts +15 -0
  223. package/core/interfaces/action-handle.d.ts +5 -0
  224. package/core/interfaces/action-handle.js +3 -0
  225. package/core/interfaces/action-handle.js.map +1 -0
  226. package/core/interfaces/core-options.d.ts +1 -0
  227. package/core/interfaces/interceptor.d.ts +1 -1
  228. package/core/interfaces/object.d.ts +3 -2
  229. package/core/interfaces/request-context.d.ts +7 -2
  230. package/core/services/request-executor.d.ts +8 -0
  231. package/core/services/request-executor.js +88 -0
  232. package/core/services/request-executor.js.map +1 -1
  233. package/core/services/request-router.js +5 -4
  234. package/core/services/request-router.js.map +1 -1
  235. package/database/database.controller.d.ts +1 -3
  236. package/database/database.controller.js +1 -5
  237. package/database/database.controller.js.map +1 -1
  238. package/database/decorators/entity.decorator.d.ts +3 -1
  239. package/database/decorators/entity.decorator.js +14 -5
  240. package/database/decorators/entity.decorator.js.map +1 -1
  241. package/database/decorators/external-column.decorator.d.ts +17 -0
  242. package/database/decorators/external-column.decorator.js +30 -0
  243. package/database/decorators/external-column.decorator.js.map +1 -0
  244. package/database/decorators/index.d.ts +1 -0
  245. package/database/decorators/index.js +1 -0
  246. package/database/decorators/index.js.map +1 -1
  247. package/database/decorators/protect-entity.decorator.d.ts +1 -0
  248. package/database/decorators/protect-entity.decorator.js +2 -3
  249. package/database/decorators/protect-entity.decorator.js.map +1 -1
  250. package/database/decorators/protected-entity.decorator.d.ts +1 -0
  251. package/database/decorators/protected-entity.decorator.js +2 -16
  252. package/database/decorators/protected-entity.decorator.js.map +1 -1
  253. package/database/decorators/relation.decorator.d.ts +2 -2
  254. package/database/decorators/relation.decorator.js.map +1 -1
  255. package/database/extensions/select-query-builder.d.ts +1 -5
  256. package/database/extensions/select-query-builder.js.map +1 -1
  257. package/database/functions/find-relation.d.ts +2 -1
  258. package/database/functions/find-relation.js +3 -3
  259. package/database/functions/find-relation.js.map +1 -1
  260. package/database/functions/generate-entity-id.d.ts +2 -0
  261. package/database/functions/{generate-id.js → generate-entity-id.js} +3 -3
  262. package/database/functions/generate-entity-id.js.map +1 -0
  263. package/database/functions/get-relations.d.ts +1 -1
  264. package/database/functions/inject-repository-handle.js +4 -3
  265. package/database/functions/inject-repository-handle.js.map +1 -1
  266. package/database/functions/use-transaction.d.ts +1 -0
  267. package/database/functions/use-transaction.js +2 -6
  268. package/database/functions/use-transaction.js.map +1 -1
  269. package/database/interfaces/entity-dto-object.d.ts +7 -0
  270. package/database/interfaces/entity-dto-object.js +3 -0
  271. package/database/interfaces/entity-dto-object.js.map +1 -0
  272. package/database/interfaces/entity-object.d.ts +0 -6
  273. package/database/interfaces/entity-property.d.ts +12 -0
  274. package/database/interfaces/index.d.ts +0 -1
  275. package/database/interfaces/index.js +0 -1
  276. package/database/interfaces/index.js.map +1 -1
  277. package/database/interfaces/path.d.ts +6 -2
  278. package/database/interfaces/repository.d.ts +8 -8
  279. package/database/interfaces/virtual-select.d.ts +4 -0
  280. package/database/interfaces/virtual-select.js +3 -0
  281. package/database/interfaces/virtual-select.js.map +1 -0
  282. package/database/services/repository.service.d.ts +1 -1
  283. package/database/services/repository.service.js +3 -6
  284. package/database/services/repository.service.js.map +1 -1
  285. package/docs/docs.module.js +3 -1
  286. package/docs/docs.module.js.map +1 -1
  287. package/docs/migrations/1747584000000-CreateDocsTables.d.ts +5 -0
  288. package/docs/migrations/1747584000000-CreateDocsTables.js +90 -0
  289. package/docs/migrations/1747584000000-CreateDocsTables.js.map +1 -0
  290. package/docs/migrations/migrations.d.ts +2 -0
  291. package/docs/migrations/migrations.js +8 -0
  292. package/docs/migrations/migrations.js.map +1 -0
  293. package/docs/queries/docs-controller-action.query.d.ts +1 -1
  294. package/docs/queries/docs-controller.query.d.ts +1 -1
  295. package/docs/queries/docs-model.query.d.ts +1 -1
  296. package/docs/queries/docs-model.query.js +1 -1
  297. package/docs/queries/docs-model.query.js.map +1 -1
  298. package/docs/queries/docs-version.query.d.ts +1 -1
  299. package/docs/services/docs-version.service.js +6 -3
  300. package/docs/services/docs-version.service.js.map +1 -1
  301. package/forms/queries/form.query.d.ts +1 -1
  302. package/forms/queries/property.query.d.ts +1 -1
  303. package/global.d.ts +2 -0
  304. package/global.js +2 -1
  305. package/global.js.map +1 -1
  306. package/http/http.controller.d.ts +2 -0
  307. package/http/http.controller.js +3 -2
  308. package/http/http.controller.js.map +1 -1
  309. package/index.d.ts +5 -2
  310. package/index.js +4 -7
  311. package/index.js.map +1 -1
  312. package/jobs/jobs.controller.d.ts +2 -0
  313. package/jobs/jobs.controller.js +22 -16
  314. package/jobs/jobs.controller.js.map +1 -1
  315. package/package.json +70 -69
  316. package/query/functions/add-join.js +8 -16
  317. package/query/functions/add-join.js.map +1 -1
  318. package/query/functions/collect-external-column-owners.d.ts +10 -0
  319. package/query/functions/collect-external-column-owners.js +100 -0
  320. package/query/functions/collect-external-column-owners.js.map +1 -0
  321. package/query/functions/create-query-builder.js +47 -28
  322. package/query/functions/create-query-builder.js.map +1 -1
  323. package/query/functions/create-query-cache-hash.d.ts +16 -0
  324. package/query/functions/create-query-cache-hash.js +70 -0
  325. package/query/functions/create-query-cache-hash.js.map +1 -0
  326. package/query/functions/create-query.d.ts +8 -3
  327. package/query/functions/create-query.js +12 -9
  328. package/query/functions/create-query.js.map +1 -1
  329. package/query/functions/describe-query-filter.js +3 -2
  330. package/query/functions/describe-query-filter.js.map +1 -1
  331. package/query/functions/execute-query.js +89 -9
  332. package/query/functions/execute-query.js.map +1 -1
  333. package/query/functions/expand-select-with-external-dependencies.d.ts +9 -0
  334. package/query/functions/expand-select-with-external-dependencies.js +34 -0
  335. package/query/functions/expand-select-with-external-dependencies.js.map +1 -0
  336. package/query/functions/external-column-owner-path.d.ts +5 -0
  337. package/query/functions/external-column-owner-path.js +18 -0
  338. package/query/functions/external-column-owner-path.js.map +1 -0
  339. package/query/functions/get-entity-object-class.d.ts +2 -0
  340. package/query/functions/get-entity-object-class.js +12 -0
  341. package/query/functions/get-entity-object-class.js.map +1 -0
  342. package/query/functions/get-native-select.js +3 -0
  343. package/query/functions/get-native-select.js.map +1 -1
  344. package/query/functions/load-properties.d.ts +20 -2
  345. package/query/functions/load-properties.js +190 -40
  346. package/query/functions/load-properties.js.map +1 -1
  347. package/query/functions/map-query-property-to-column-name.js +1 -1
  348. package/query/functions/map-query-property-to-column-name.js.map +1 -1
  349. package/query/functions/query-structure-cache.d.ts +24 -0
  350. package/query/functions/query-structure-cache.js +66 -0
  351. package/query/functions/query-structure-cache.js.map +1 -0
  352. package/query/interfaces/query.d.ts +44 -1
  353. package/query/services/query-action-builder.d.ts +4 -1
  354. package/query/services/query-action-builder.js +26 -12
  355. package/query/services/query-action-builder.js.map +1 -1
  356. package/remote-logs/dtos/index.d.ts +2 -0
  357. package/remote-logs/dtos/index.js +19 -0
  358. package/remote-logs/dtos/index.js.map +1 -0
  359. package/remote-logs/dtos/remote-log-hooks.dto.d.ts +72 -0
  360. package/remote-logs/dtos/remote-log-hooks.dto.js +280 -0
  361. package/remote-logs/dtos/remote-log-hooks.dto.js.map +1 -0
  362. package/remote-logs/dtos/remote-log-search.dto.d.ts +34 -0
  363. package/remote-logs/dtos/remote-log-search.dto.js +146 -0
  364. package/remote-logs/dtos/remote-log-search.dto.js.map +1 -0
  365. package/remote-logs/environment.d.ts +4 -0
  366. package/remote-logs/environment.js +5 -0
  367. package/remote-logs/environment.js.map +1 -0
  368. package/remote-logs/index.d.ts +3 -0
  369. package/remote-logs/index.js +20 -0
  370. package/remote-logs/index.js.map +1 -0
  371. package/remote-logs/interfaces/index.d.ts +1 -0
  372. package/remote-logs/interfaces/index.js +18 -0
  373. package/remote-logs/interfaces/index.js.map +1 -0
  374. package/remote-logs/interfaces/remote-logs-module-options.d.ts +8 -0
  375. package/remote-logs/interfaces/remote-logs-module-options.js +3 -0
  376. package/remote-logs/interfaces/remote-logs-module-options.js.map +1 -0
  377. package/remote-logs/remote-logs-hooks.controller.d.ts +60 -0
  378. package/remote-logs/remote-logs-hooks.controller.js +331 -0
  379. package/remote-logs/remote-logs-hooks.controller.js.map +1 -0
  380. package/remote-logs/remote-logs.controller.d.ts +8 -0
  381. package/remote-logs/remote-logs.controller.js +41 -0
  382. package/remote-logs/remote-logs.controller.js.map +1 -0
  383. package/remote-logs/remote-logs.module.d.ts +12 -0
  384. package/remote-logs/remote-logs.module.js +107 -0
  385. package/remote-logs/remote-logs.module.js.map +1 -0
  386. package/remote-logs/services/opensearch.service.d.ts +13 -0
  387. package/remote-logs/services/opensearch.service.js +167 -0
  388. package/remote-logs/services/opensearch.service.js.map +1 -0
  389. package/security/auth.controller.js +4 -4
  390. package/security/auth.controller.js.map +1 -1
  391. package/security/env.js.map +1 -1
  392. package/security/functions/add-protected.d.ts +2 -2
  393. package/security/functions/add-protected.js +8 -5
  394. package/security/functions/add-protected.js.map +1 -1
  395. package/security/functions/create-authentication-interceptor.d.ts +44 -0
  396. package/security/functions/create-authentication-interceptor.js +114 -0
  397. package/security/functions/create-authentication-interceptor.js.map +1 -0
  398. package/security/functions/find-auth-context.d.ts +1 -2
  399. package/security/functions/find-auth-context.js +6 -11
  400. package/security/functions/find-auth-context.js.map +1 -1
  401. package/security/index.d.ts +1 -0
  402. package/security/index.js +1 -0
  403. package/security/index.js.map +1 -1
  404. package/security/interfaces/authorization-schema.d.ts +3 -1
  405. package/security/requests/security.request.js +1 -1
  406. package/security/requests/security.request.js.map +1 -1
  407. package/security/services/authorization.service.d.ts +5 -3
  408. package/security/services/authorization.service.js +56 -37
  409. package/security/services/authorization.service.js.map +1 -1
  410. package/storage/services/routes.service.js +1 -1
  411. package/storage/services/routes.service.js.map +1 -1
  412. package/tasks/constants.d.ts +3 -0
  413. package/tasks/constants.js +2 -1
  414. package/tasks/constants.js.map +1 -1
  415. package/tasks/controllers/task.controller.d.ts +3 -2
  416. package/tasks/controllers/task.controller.js +11 -40
  417. package/tasks/controllers/task.controller.js.map +1 -1
  418. package/tasks/decorators/index.d.ts +1 -0
  419. package/tasks/decorators/index.js +1 -0
  420. package/tasks/decorators/index.js.map +1 -1
  421. package/tasks/decorators/task-payload.decorator.d.ts +1 -0
  422. package/tasks/decorators/task-payload.decorator.js +12 -0
  423. package/tasks/decorators/task-payload.decorator.js.map +1 -0
  424. package/tasks/decorators/task.decorator.js +6 -2
  425. package/tasks/decorators/task.decorator.js.map +1 -1
  426. package/tasks/functions/compile-all-task-post-hooks.d.ts +1 -0
  427. package/tasks/functions/compile-all-task-post-hooks.js +27 -0
  428. package/tasks/functions/compile-all-task-post-hooks.js.map +1 -0
  429. package/tasks/functions/compile-task-hook-handle.d.ts +6 -0
  430. package/tasks/functions/compile-task-hook-handle.js +67 -0
  431. package/tasks/functions/compile-task-hook-handle.js.map +1 -0
  432. package/tasks/functions/create-task-hook.d.ts +9 -0
  433. package/tasks/functions/create-task-hook.js +13 -0
  434. package/tasks/functions/create-task-hook.js.map +1 -0
  435. package/tasks/functions/{create-task-message-receptor.d.ts → create-task-message-post.d.ts} +1 -1
  436. package/tasks/functions/{create-task-message-receptor.js → create-task-message-post.js} +10 -3
  437. package/tasks/functions/create-task-message-post.js.map +1 -0
  438. package/tasks/functions/register-task-post-hook-interceptors.d.ts +3 -0
  439. package/tasks/functions/register-task-post-hook-interceptors.js +86 -0
  440. package/tasks/functions/register-task-post-hook-interceptors.js.map +1 -0
  441. package/tasks/functions/run-task-post-hooks.d.ts +11 -0
  442. package/tasks/functions/run-task-post-hooks.js +18 -0
  443. package/tasks/functions/run-task-post-hooks.js.map +1 -0
  444. package/tasks/functions/task-message-operations.d.ts +18 -0
  445. package/tasks/functions/task-message-operations.js +100 -0
  446. package/tasks/functions/task-message-operations.js.map +1 -0
  447. package/tasks/functions/validate-task-payload.d.ts +2 -0
  448. package/tasks/functions/validate-task-payload.js +19 -0
  449. package/tasks/functions/validate-task-payload.js.map +1 -0
  450. package/tasks/hook-constants.d.ts +2 -0
  451. package/tasks/hook-constants.js +6 -0
  452. package/tasks/hook-constants.js.map +1 -0
  453. package/tasks/index.d.ts +3 -0
  454. package/tasks/index.js +3 -0
  455. package/tasks/index.js.map +1 -1
  456. package/tasks/interfaces/compiled-task-post-hooks.d.ts +17 -0
  457. package/tasks/interfaces/compiled-task-post-hooks.js +3 -0
  458. package/tasks/interfaces/compiled-task-post-hooks.js.map +1 -0
  459. package/tasks/interfaces/index.d.ts +3 -0
  460. package/tasks/interfaces/index.js +3 -0
  461. package/tasks/interfaces/index.js.map +1 -1
  462. package/tasks/interfaces/task-hook.d.ts +16 -0
  463. package/tasks/interfaces/task-hook.js +8 -0
  464. package/tasks/interfaces/task-hook.js.map +1 -0
  465. package/tasks/interfaces/task-object.d.ts +6 -2
  466. package/tasks/interfaces/task-post-hook.d.ts +2 -0
  467. package/tasks/interfaces/task-post-hook.js +3 -0
  468. package/tasks/interfaces/task-post-hook.js.map +1 -0
  469. package/tasks/interfaces/task-post-intercept.d.ts +1 -8
  470. package/tasks/interfaces/task-runner.d.ts +2 -1
  471. package/tasks/interfaces/task-settings.d.ts +7 -0
  472. package/tasks/services/task-runner.service.d.ts +24 -3
  473. package/tasks/services/task-runner.service.js +68 -28
  474. package/tasks/services/task-runner.service.js.map +1 -1
  475. package/translations/controllers/translation.controller.js +12 -9
  476. package/translations/controllers/translation.controller.js.map +1 -1
  477. package/translations/functions/create-translation-values.js +2 -5
  478. package/translations/functions/create-translation-values.js.map +1 -1
  479. package/translations/migrations/1723760669185-CreateTranslationTables.js +3 -3
  480. package/translations/migrations/1723760669185-CreateTranslationTables.js.map +1 -1
  481. package/translations/queries/translation-config.query.d.ts +1 -1
  482. package/translations/queries/translation-values.query.d.ts +1 -1
  483. package/translations/queries/translation-values.query.js +1 -1
  484. package/translations/queries/translation-values.query.js.map +1 -1
  485. package/translations/translations.controller.d.ts +1 -1
  486. package/translations/translations.controller.js +4 -4
  487. package/translations/translations.controller.js.map +1 -1
  488. package/database/functions/generate-id.d.ts +0 -2
  489. package/database/functions/generate-id.js.map +0 -1
  490. package/database/functions/use-protector.d.ts +0 -2
  491. package/database/functions/use-protector.js +0 -11
  492. package/database/functions/use-protector.js.map +0 -1
  493. package/database/interfaces/protector.d.ts +0 -51
  494. package/database/interfaces/protector.js.map +0 -1
  495. package/database/services/protect-builder.d.ts +0 -59
  496. package/database/services/protect-builder.js +0 -524
  497. package/database/services/protect-builder.js.map +0 -1
  498. package/security/functions/add-protect.d.ts +0 -2
  499. package/security/functions/add-protect.js +0 -11
  500. package/security/functions/add-protect.js.map +0 -1
  501. package/tasks/functions/create-task-message-receptor.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scope-access.js","sourceRoot":"./","sources":["access/entities/scope-access.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,mEAA+D;AAC/D,iFAAoE;AACpE,qDAAwD;AACxD,iFAAoE;AACpE,qFAAwE;AACxE,2CAAuC;AACvC,+CAA2C;AAC3C,qCAAgC;AAGzB,IAAM,WAAW,GAAjB,MAAM,WACV,SAAQ,wBAAU;CA6BpB,CAAA;AA9BY,kCAAW;AAQrB;IAHC,IAAA,mBAAM,GAAE;IACR,IAAA,qBAAQ,GAAE;IACV,IAAA,yBAAM,GAAE;;gDACW;AAKpB;IAHC,IAAA,mBAAM,GAAE;IACR,IAAA,qBAAQ,GAAE;IACV,IAAA,yBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;8CACR;AAMnB;IAJC,IAAA,mBAAM,GAAE;IACR,IAAA,qBAAQ,GAAE;IACV,IAAA,eAAK,GAAE;IACP,IAAA,yBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;2CACX;AAKhB;IAHC,IAAA,mBAAM,GAAE;IACR,IAAA,qBAAQ,GAAE;IACV,IAAA,6BAAQ,EAAC,GAAG,EAAE,CAAC,wBAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;4CAC9B;AAKjB;IAHC,IAAA,mBAAM,GAAE;IACR,IAAA,qBAAQ,GAAE;IACV,IAAA,6BAAQ,EAAC,GAAG,EAAE,CAAC,oBAAQ,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;wCAChC;sBA7BH,WAAW;IADvB,IAAA,yBAAM,GAAE;GACI,WAAW,CA8BvB"}
@@ -0,0 +1,7 @@
1
+ import { IScopeGroupUser, IScopeUserMapped } from "@rockster/common/access";
2
+ import { BaseEntity } from "../../common/entities/base-entity";
3
+ export declare class ScopeGroupUser extends BaseEntity implements IScopeGroupUser {
4
+ groupId: string;
5
+ userId: string;
6
+ user?: IScopeUserMapped;
7
+ }
@@ -0,0 +1,47 @@
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.ScopeGroupUser = void 0;
13
+ const base_entity_1 = require("../../common/entities/base-entity");
14
+ const entity_decorator_1 = require("../../database/decorators/entity.decorator");
15
+ const class_pipe_1 = require("@rockster/class-pipe");
16
+ const relation_decorator_1 = require("../../database/decorators/relation.decorator");
17
+ const scope_group_1 = require("./scope-group");
18
+ const column_decorator_1 = require("../../database/decorators/column.decorator");
19
+ const typeorm_1 = require("typeorm");
20
+ const scope_user_mapped_1 = require("../models/scope-user-mapped");
21
+ let ScopeGroupUser = class ScopeGroupUser extends base_entity_1.BaseEntity {
22
+ };
23
+ exports.ScopeGroupUser = ScopeGroupUser;
24
+ __decorate([
25
+ (0, class_pipe_1.Expose)(),
26
+ (0, class_pipe_1.IsRequired)(),
27
+ (0, class_pipe_1.IsString)(),
28
+ (0, relation_decorator_1.Relation)(() => scope_group_1.ScopeGroup),
29
+ __metadata("design:type", String)
30
+ ], ScopeGroupUser.prototype, "groupId", void 0);
31
+ __decorate([
32
+ (0, class_pipe_1.Expose)(),
33
+ (0, class_pipe_1.IsRequired)(),
34
+ (0, class_pipe_1.IsString)(),
35
+ (0, typeorm_1.Index)(),
36
+ (0, column_decorator_1.Column)(),
37
+ __metadata("design:type", String)
38
+ ], ScopeGroupUser.prototype, "userId", void 0);
39
+ __decorate([
40
+ (0, class_pipe_1.Expose)(),
41
+ (0, class_pipe_1.IsType)(() => scope_user_mapped_1.ScopeUserMapped),
42
+ __metadata("design:type", Object)
43
+ ], ScopeGroupUser.prototype, "user", void 0);
44
+ exports.ScopeGroupUser = ScopeGroupUser = __decorate([
45
+ (0, entity_decorator_1.Entity)()
46
+ ], ScopeGroupUser);
47
+ //# sourceMappingURL=scope-group-user.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scope-group-user.js","sourceRoot":"./","sources":["access/entities/scope-group-user.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,mEAA+D;AAC/D,iFAAoE;AACpE,qDAA4E;AAC5E,qFAAwE;AACxE,+CAA2C;AAC3C,iFAAoE;AACpE,qCAAgC;AAChC,mEAA8D;AAGvD,IAAM,cAAc,GAApB,MAAM,cACV,SAAQ,wBAAU;CAqBpB,CAAA;AAtBY,wCAAc;AASxB;IAJC,IAAA,mBAAM,GAAE;IACR,IAAA,uBAAU,GAAE;IACZ,IAAA,qBAAQ,GAAE;IACV,IAAA,6BAAQ,EAAC,GAAG,EAAE,CAAC,wBAAU,CAAC;;+CACX;AAOhB;IALC,IAAA,mBAAM,GAAE;IACR,IAAA,uBAAU,GAAE;IACZ,IAAA,qBAAQ,GAAE;IACV,IAAA,eAAK,GAAE;IACP,IAAA,yBAAM,GAAE;;8CACM;AAKf;IAFC,IAAA,mBAAM,GAAE;IACR,IAAA,mBAAM,EAAC,GAAG,EAAE,CAAC,mCAAe,CAAC;;4CACN;yBArBd,cAAc;IAD1B,IAAA,yBAAM,GAAE;GACI,cAAc,CAsB1B"}
@@ -0,0 +1,12 @@
1
+ import { IScopeAccess, IScopeGroup } from "@rockster/common/access";
2
+ import { BaseEntity } from "../../common/entities/base-entity";
3
+ import { ScopeAccessProfile } from "./scope-access-profile";
4
+ export declare class ScopeGroup extends BaseEntity implements IScopeGroup {
5
+ contextName: string;
6
+ contextId?: string;
7
+ isReadOnly?: boolean;
8
+ name: string;
9
+ scopeAccessProfileId?: string;
10
+ keys?: IScopeAccess[];
11
+ scopeAccessProfile?: ScopeAccessProfile;
12
+ }
@@ -0,0 +1,72 @@
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.ScopeGroup = void 0;
13
+ const base_entity_1 = require("../../common/entities/base-entity");
14
+ const entity_decorator_1 = require("../../database/decorators/entity.decorator");
15
+ const column_decorator_1 = require("../../database/decorators/column.decorator");
16
+ const class_pipe_1 = require("@rockster/class-pipe");
17
+ const relation_decorator_1 = require("../../database/decorators/relation.decorator");
18
+ const scope_access_1 = require("./scope-access");
19
+ const scope_access_profile_1 = require("./scope-access-profile");
20
+ let ScopeGroup = class ScopeGroup extends base_entity_1.BaseEntity {
21
+ };
22
+ exports.ScopeGroup = ScopeGroup;
23
+ __decorate([
24
+ (0, class_pipe_1.Expose)(),
25
+ (0, class_pipe_1.IsRequired)(),
26
+ (0, class_pipe_1.IsString)(),
27
+ (0, column_decorator_1.Column)(),
28
+ __metadata("design:type", String)
29
+ ], ScopeGroup.prototype, "contextName", void 0);
30
+ __decorate([
31
+ (0, class_pipe_1.Expose)(),
32
+ (0, class_pipe_1.IsOptional)(),
33
+ (0, class_pipe_1.IsString)(),
34
+ (0, column_decorator_1.Column)({ nullable: true }),
35
+ __metadata("design:type", String)
36
+ ], ScopeGroup.prototype, "contextId", void 0);
37
+ __decorate([
38
+ (0, class_pipe_1.Expose)(),
39
+ (0, class_pipe_1.IsBoolean)(),
40
+ (0, column_decorator_1.Column)({ nullable: true }),
41
+ __metadata("design:type", Boolean)
42
+ ], ScopeGroup.prototype, "isReadOnly", void 0);
43
+ __decorate([
44
+ (0, class_pipe_1.Expose)(),
45
+ (0, class_pipe_1.IsRequired)(),
46
+ (0, class_pipe_1.IsString)(),
47
+ (0, column_decorator_1.Column)(),
48
+ __metadata("design:type", String)
49
+ ], ScopeGroup.prototype, "name", void 0);
50
+ __decorate([
51
+ (0, class_pipe_1.Expose)(),
52
+ (0, class_pipe_1.IsOptional)(),
53
+ (0, class_pipe_1.IsString)(),
54
+ (0, relation_decorator_1.Relation)(() => scope_access_profile_1.ScopeAccessProfile, { nullable: true }),
55
+ __metadata("design:type", String)
56
+ ], ScopeGroup.prototype, "scopeAccessProfileId", void 0);
57
+ __decorate([
58
+ (0, class_pipe_1.Expose)(),
59
+ (0, class_pipe_1.IsArray)(),
60
+ (0, class_pipe_1.IsType)(() => scope_access_1.ScopeAccess),
61
+ __metadata("design:type", Array)
62
+ ], ScopeGroup.prototype, "keys", void 0);
63
+ __decorate([
64
+ (0, class_pipe_1.Expose)(),
65
+ (0, class_pipe_1.IsOptional)(),
66
+ (0, class_pipe_1.IsType)(() => scope_access_profile_1.ScopeAccessProfile),
67
+ __metadata("design:type", scope_access_profile_1.ScopeAccessProfile)
68
+ ], ScopeGroup.prototype, "scopeAccessProfile", void 0);
69
+ exports.ScopeGroup = ScopeGroup = __decorate([
70
+ (0, entity_decorator_1.Entity)()
71
+ ], ScopeGroup);
72
+ //# sourceMappingURL=scope-group.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scope-group.js","sourceRoot":"./","sources":["access/entities/scope-group.ts"],"names":[],"mappings":";;;;;;;;;;;;AAIA,mEAA+D;AAC/D,iFAAoE;AACpE,iFAAoE;AACpE,qDAQ8B;AAC9B,qFAAwE;AACxE,iDAA6C;AAC7C,iEAA4D;AAGrD,IAAM,UAAU,GAAhB,MAAM,UACV,SAAQ,wBAAU;CA2CpB,CAAA;AA5CY,gCAAU;AASpB;IAJC,IAAA,mBAAM,GAAE;IACR,IAAA,uBAAU,GAAE;IACZ,IAAA,qBAAQ,GAAE;IACV,IAAA,yBAAM,GAAE;;+CACW;AAMpB;IAJC,IAAA,mBAAM,GAAE;IACR,IAAA,uBAAU,GAAE;IACZ,IAAA,qBAAQ,GAAE;IACV,IAAA,yBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;6CACR;AAKnB;IAHC,IAAA,mBAAM,GAAE;IACR,IAAA,sBAAS,GAAE;IACX,IAAA,yBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;8CACN;AAMrB;IAJC,IAAA,mBAAM,GAAE;IACR,IAAA,uBAAU,GAAE;IACZ,IAAA,qBAAQ,GAAE;IACV,IAAA,yBAAM,GAAE;;wCACI;AAMb;IAJC,IAAA,mBAAM,GAAE;IACR,IAAA,uBAAU,GAAE;IACZ,IAAA,qBAAQ,GAAE;IACV,IAAA,6BAAQ,EAAC,GAAG,EAAE,CAAC,yCAAkB,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;wDACzB;AAM9B;IAHC,IAAA,mBAAM,GAAE;IACR,IAAA,oBAAO,GAAE;IACT,IAAA,mBAAM,EAAC,GAAG,EAAE,CAAC,0BAAW,CAAC;;wCACJ;AAKtB;IAHC,IAAA,mBAAM,GAAE;IACR,IAAA,uBAAU,GAAE;IACZ,IAAA,mBAAM,EAAC,GAAG,EAAE,CAAC,yCAAkB,CAAC;8BACZ,yCAAkB;sDAAC;qBA3C9B,UAAU;IADtB,IAAA,yBAAM,GAAE;GACI,UAAU,CA4CtB"}
@@ -0,0 +1,5 @@
1
+ import { IScopeKey } from "@rockster/common/access";
2
+ export declare class ScopeKey implements IScopeKey {
3
+ contextName: string;
4
+ name: string;
5
+ }
@@ -0,0 +1,35 @@
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.ScopeKey = void 0;
13
+ const class_pipe_1 = require("@rockster/class-pipe");
14
+ const entity_decorator_1 = require("../../database/decorators/entity.decorator");
15
+ const column_decorator_1 = require("../../database/decorators/column.decorator");
16
+ const id_decorator_1 = require("../../database/decorators/id.decorator");
17
+ let ScopeKey = class ScopeKey {
18
+ };
19
+ exports.ScopeKey = ScopeKey;
20
+ __decorate([
21
+ (0, class_pipe_1.Expose)(),
22
+ (0, class_pipe_1.IsString)(),
23
+ (0, column_decorator_1.Column)(),
24
+ __metadata("design:type", String)
25
+ ], ScopeKey.prototype, "contextName", void 0);
26
+ __decorate([
27
+ (0, class_pipe_1.Expose)(),
28
+ (0, class_pipe_1.IsString)(),
29
+ (0, id_decorator_1.Id)(),
30
+ __metadata("design:type", String)
31
+ ], ScopeKey.prototype, "name", void 0);
32
+ exports.ScopeKey = ScopeKey = __decorate([
33
+ (0, entity_decorator_1.Entity)()
34
+ ], ScopeKey);
35
+ //# sourceMappingURL=scope-key.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scope-key.js","sourceRoot":"./","sources":["access/entities/scope-key.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAwD;AACxD,iFAAoE;AACpE,iFAAoE;AACpE,yEAA4D;AAIrD,IAAM,QAAQ,GAAd,MAAM,QAAQ;CAYpB,CAAA;AAZY,4BAAQ;AAMlB;IAHC,IAAA,mBAAM,GAAE;IACR,IAAA,qBAAQ,GAAE;IACV,IAAA,yBAAM,GAAE;;6CACW;AAKpB;IAHC,IAAA,mBAAM,GAAE;IACR,IAAA,qBAAQ,GAAE;IACV,IAAA,iBAAE,GAAE;;sCACQ;mBAXH,QAAQ;IADpB,IAAA,yBAAM,GAAE;GACI,QAAQ,CAYpB"}
@@ -0,0 +1,7 @@
1
+ import { IScopeOwner } from "@rockster/common/access";
2
+ import { BaseEntity } from "../../common/entities/base-entity";
3
+ export declare class ScopeOwner extends BaseEntity implements IScopeOwner {
4
+ contextName: string;
5
+ contextId?: string;
6
+ userId: string;
7
+ }
@@ -0,0 +1,45 @@
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.ScopeOwner = void 0;
13
+ const base_entity_1 = require("../../common/entities/base-entity");
14
+ const entity_decorator_1 = require("../../database/decorators/entity.decorator");
15
+ const class_pipe_1 = require("@rockster/class-pipe");
16
+ const column_decorator_1 = require("../../database/decorators/column.decorator");
17
+ const typeorm_1 = require("typeorm");
18
+ let ScopeOwner = class ScopeOwner extends base_entity_1.BaseEntity {
19
+ };
20
+ exports.ScopeOwner = ScopeOwner;
21
+ __decorate([
22
+ (0, class_pipe_1.Expose)(),
23
+ (0, class_pipe_1.IsString)(),
24
+ (0, typeorm_1.Index)(),
25
+ (0, column_decorator_1.Column)(),
26
+ __metadata("design:type", String)
27
+ ], ScopeOwner.prototype, "contextName", void 0);
28
+ __decorate([
29
+ (0, class_pipe_1.Expose)(),
30
+ (0, class_pipe_1.IsString)(),
31
+ (0, typeorm_1.Index)(),
32
+ (0, column_decorator_1.Column)({ nullable: true }),
33
+ __metadata("design:type", String)
34
+ ], ScopeOwner.prototype, "contextId", void 0);
35
+ __decorate([
36
+ (0, class_pipe_1.Expose)(),
37
+ (0, class_pipe_1.IsString)(),
38
+ (0, typeorm_1.Index)(),
39
+ (0, column_decorator_1.Column)(),
40
+ __metadata("design:type", String)
41
+ ], ScopeOwner.prototype, "userId", void 0);
42
+ exports.ScopeOwner = ScopeOwner = __decorate([
43
+ (0, entity_decorator_1.Entity)()
44
+ ], ScopeOwner);
45
+ //# sourceMappingURL=scope-owner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scope-owner.js","sourceRoot":"./","sources":["access/entities/scope-owner.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,mEAA+D;AAC/D,iFAAoE;AACpE,qDAAwD;AACxD,iFAAoE;AACpE,qCAAgC;AAGzB,IAAM,UAAU,GAAhB,MAAM,UACV,SAAQ,wBAAU;CAoBpB,CAAA;AArBY,gCAAU;AAQpB;IAJC,IAAA,mBAAM,GAAE;IACR,IAAA,qBAAQ,GAAE;IACV,IAAA,eAAK,GAAE;IACP,IAAA,yBAAM,GAAE;;+CACW;AAMpB;IAJC,IAAA,mBAAM,GAAE;IACR,IAAA,qBAAQ,GAAE;IACV,IAAA,eAAK,GAAE;IACP,IAAA,yBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;6CACR;AAMnB;IAJC,IAAA,mBAAM,GAAE;IACR,IAAA,qBAAQ,GAAE;IACV,IAAA,eAAK,GAAE;IACP,IAAA,yBAAM,GAAE;;0CACM;qBApBL,UAAU;IADtB,IAAA,yBAAM,GAAE;GACI,UAAU,CAqBtB"}
@@ -0,0 +1,10 @@
1
+ import { IScopeKey } from "@rockster/common/access";
2
+ import { IScopeServiceRegistry } from "./interfaces/scope-service-registry";
3
+ import { ScopeAccessService } from "./services/scope-access.service";
4
+ import { ScopeOwnerService } from "./services/scope-owner.service";
5
+ export declare const env: {
6
+ scopesKeys: Map<string, IScopeKey[]>;
7
+ scopeServiceRegistry: Map<string, IScopeServiceRegistry>;
8
+ scopeAccessService: ScopeAccessService;
9
+ scopeOwnerService: ScopeOwnerService;
10
+ };
package/access/env.js ADDED
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.env = void 0;
4
+ exports.env = {
5
+ scopesKeys: new Map(),
6
+ scopeServiceRegistry: new Map(),
7
+ scopeAccessService: null,
8
+ scopeOwnerService: null
9
+ };
10
+ //# sourceMappingURL=env.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"env.js","sourceRoot":"./","sources":["access/env.ts"],"names":[],"mappings":";;;AAKa,QAAA,GAAG,GAAG;IAChB,UAAU,EAAE,IAAI,GAAG,EAAuB;IAC1C,oBAAoB,EAAE,IAAI,GAAG,EAAiC;IAC9D,kBAAkB,EAAE,IAA0B;IAC9C,iBAAiB,EAAE,IAAyB;CAC9C,CAAA"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Gate for IAM-management actions (the access controllers: scope keys, groups,
3
+ * owners, access profiles). For the given context it requires the caller to be
4
+ * the **owner**, hold the context **admin** key, or hold the platform **master**
5
+ * key at the hierarchy root.
6
+ *
7
+ * Back-compat: a context that was NOT registered with an admin hierarchy
8
+ * (no `root` / `rootScope` / `adminKey` via `registerScope`) is left ungated, so
9
+ * apps that don't use this hierarchy keep their previous behavior.
10
+ */
11
+ export declare function assertContextAdminAccess(options: {
12
+ contextName: string;
13
+ contextId?: string;
14
+ userId?: string;
15
+ }): Promise<void>;
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.assertContextAdminAccess = assertContextAdminAccess;
4
+ const common_1 = require("@rockster/common");
5
+ const env_1 = require("../env");
6
+ const get_is_owner_1 = require("./get-is-owner");
7
+ const get_user_keys_1 = require("./get-user-keys");
8
+ /**
9
+ * Gate for IAM-management actions (the access controllers: scope keys, groups,
10
+ * owners, access profiles). For the given context it requires the caller to be
11
+ * the **owner**, hold the context **admin** key, or hold the platform **master**
12
+ * key at the hierarchy root.
13
+ *
14
+ * Back-compat: a context that was NOT registered with an admin hierarchy
15
+ * (no `root` / `rootScope` / `adminKey` via `registerScope`) is left ungated, so
16
+ * apps that don't use this hierarchy keep their previous behavior.
17
+ */
18
+ async function assertContextAdminAccess(options) {
19
+ const { contextName, contextId, userId } = options;
20
+ const registry = env_1.env.scopeServiceRegistry.get(contextName);
21
+ const hasHierarchy = !!(registry?.adminKey || registry?.root || registry?.rootScope);
22
+ if (!hasHierarchy) {
23
+ return;
24
+ }
25
+ if (!userId) {
26
+ throw new common_1.UnauthorizedError();
27
+ }
28
+ // Owner of the context.
29
+ if (await (0, get_is_owner_1.getIsOwner)(contextName, userId, contextId)) {
30
+ return;
31
+ }
32
+ const userKeys = contextId
33
+ ? await (0, get_user_keys_1.getUserKeys)(userId, contextId)
34
+ : await (0, get_user_keys_1.getUserKeys)(userId);
35
+ // Context admin.
36
+ if (registry?.adminKey && userKeys.includes(registry.adminKey)) {
37
+ return;
38
+ }
39
+ // Platform master at the hierarchy root.
40
+ let rootContextId;
41
+ let masterKey;
42
+ if (registry?.root) {
43
+ rootContextId = contextId;
44
+ masterKey = registry.masterKey;
45
+ }
46
+ else if (registry?.rootScope) {
47
+ masterKey = env_1.env.scopeServiceRegistry.get(registry.rootScope)?.masterKey;
48
+ rootContextId = contextId
49
+ ? await registry.instance?.resolveRootContextId?.(contextId)
50
+ : undefined;
51
+ }
52
+ if (masterKey && rootContextId) {
53
+ const rootKeys = await (0, get_user_keys_1.getUserKeys)(userId, rootContextId);
54
+ if (rootKeys.includes(masterKey)) {
55
+ return;
56
+ }
57
+ }
58
+ throw new common_1.ForbiddenError({
59
+ message: "Requires owner, admin or master access for this context",
60
+ });
61
+ }
62
+ //# sourceMappingURL=assert-context-admin-access.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assert-context-admin-access.js","sourceRoot":"./","sources":["access/functions/assert-context-admin-access.ts"],"names":[],"mappings":";;AAeA,4DAwDC;AAvED,6CAAqE;AACrE,gCAA6B;AAC7B,iDAA4C;AAC5C,mDAA8C;AAE9C;;;;;;;;;GASG;AACI,KAAK,UAAU,wBAAwB,CAAC,OAI9C;IACE,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IACnD,MAAM,QAAQ,GAAG,SAAG,CAAC,oBAAoB,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAE3D,MAAM,YAAY,GAAG,CAAC,CAAC,CACpB,QAAQ,EAAE,QAAQ,IAAI,QAAQ,EAAE,IAAI,IAAI,QAAQ,EAAE,SAAS,CAC7D,CAAC;IACF,IAAI,CAAC,YAAY,EAAE,CAAC;QACjB,OAAO;IACV,CAAC;IAED,IAAI,CAAC,MAAM,EAAE,CAAC;QACX,MAAM,IAAI,0BAAiB,EAAE,CAAC;IACjC,CAAC;IAED,wBAAwB;IACxB,IAAI,MAAM,IAAA,yBAAU,EAAC,WAAW,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,CAAC;QACpD,OAAO;IACV,CAAC;IAED,MAAM,QAAQ,GAAG,SAAS;QACvB,CAAC,CAAC,MAAM,IAAA,2BAAW,EAAC,MAAM,EAAE,SAAS,CAAC;QACtC,CAAC,CAAC,MAAM,IAAA,2BAAW,EAAC,MAAM,CAAC,CAAC;IAE/B,iBAAiB;IACjB,IAAI,QAAQ,EAAE,QAAQ,IAAI,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC9D,OAAO;IACV,CAAC;IAED,yCAAyC;IACzC,IAAI,aAAiC,CAAC;IACtC,IAAI,SAA6B,CAAC;IAClC,IAAI,QAAQ,EAAE,IAAI,EAAE,CAAC;QAClB,aAAa,GAAG,SAAS,CAAC;QAC1B,SAAS,GAAG,QAAQ,CAAC,SAAS,CAAC;IAClC,CAAC;SAAM,IAAI,QAAQ,EAAE,SAAS,EAAE,CAAC;QAC9B,SAAS,GAAG,SAAG,CAAC,oBAAoB,CAAC,GAAG,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,CAAC;QACxE,aAAa,GAAG,SAAS;YACtB,CAAC,CAAC,MAAM,QAAQ,CAAC,QAAQ,EAAE,oBAAoB,EAAE,CAAC,SAAS,CAAC;YAC5D,CAAC,CAAC,SAAS,CAAC;IAClB,CAAC;IAED,IAAI,SAAS,IAAI,aAAa,EAAE,CAAC;QAC9B,MAAM,QAAQ,GAAG,MAAM,IAAA,2BAAW,EAAC,MAAM,EAAE,aAAa,CAAC,CAAC;QAC1D,IAAI,QAAQ,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;YAChC,OAAO;QACV,CAAC;IACJ,CAAC;IAED,MAAM,IAAI,uBAAc,CAAC;QACtB,OAAO,EAAE,yDAAyD;KACpE,CAAC,CAAC;AACN,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Gate for GLOBAL IAM resources that have no context (e.g. access profiles).
3
+ * Allows the platform **master** (holds any registered master key, granted at
4
+ * any context) or any **owner**. Context admins do NOT pass.
5
+ *
6
+ * Back-compat: if no scope registered a master key, the master branch is simply
7
+ * skipped — only owners pass.
8
+ */
9
+ export declare function assertMasterOrOwner(userId?: string): Promise<void>;
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.assertMasterOrOwner = assertMasterOrOwner;
4
+ const common_1 = require("@rockster/common");
5
+ const env_1 = require("../env");
6
+ const get_user_keys_1 = require("./get-user-keys");
7
+ /**
8
+ * Gate for GLOBAL IAM resources that have no context (e.g. access profiles).
9
+ * Allows the platform **master** (holds any registered master key, granted at
10
+ * any context) or any **owner**. Context admins do NOT pass.
11
+ *
12
+ * Back-compat: if no scope registered a master key, the master branch is simply
13
+ * skipped — only owners pass.
14
+ */
15
+ async function assertMasterOrOwner(userId) {
16
+ if (!userId) {
17
+ throw new common_1.UnauthorizedError();
18
+ }
19
+ // Master: holds any registered master key.
20
+ const masterKeys = new Set();
21
+ for (const registry of env_1.env.scopeServiceRegistry.values()) {
22
+ if (registry.masterKey) {
23
+ masterKeys.add(registry.masterKey);
24
+ }
25
+ }
26
+ if (masterKeys.size > 0) {
27
+ const userKeys = await (0, get_user_keys_1.getUserKeys)(userId);
28
+ if (userKeys.some((key) => masterKeys.has(key))) {
29
+ return;
30
+ }
31
+ }
32
+ // Owner of any context.
33
+ if (await env_1.env.scopeOwnerService.getHasAnyOwnership(userId)) {
34
+ return;
35
+ }
36
+ throw new common_1.ForbiddenError({
37
+ message: "Requires master or owner access",
38
+ });
39
+ }
40
+ //# sourceMappingURL=assert-master-or-owner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assert-master-or-owner.js","sourceRoot":"./","sources":["access/functions/assert-master-or-owner.ts"],"names":[],"mappings":";;AAYA,kDA2BC;AAvCD,6CAAqE;AACrE,gCAA6B;AAC7B,mDAA8C;AAE9C;;;;;;;GAOG;AACI,KAAK,UAAU,mBAAmB,CAAC,MAAe;IACtD,IAAI,CAAC,MAAM,EAAE,CAAC;QACX,MAAM,IAAI,0BAAiB,EAAE,CAAC;IACjC,CAAC;IAED,2CAA2C;IAC3C,MAAM,UAAU,GAAG,IAAI,GAAG,EAAU,CAAC;IACrC,KAAK,MAAM,QAAQ,IAAI,SAAG,CAAC,oBAAoB,CAAC,MAAM,EAAE,EAAE,CAAC;QACxD,IAAI,QAAQ,CAAC,SAAS,EAAE,CAAC;YACtB,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;QACtC,CAAC;IACJ,CAAC;IACD,IAAI,UAAU,CAAC,IAAI,GAAG,CAAC,EAAE,CAAC;QACvB,MAAM,QAAQ,GAAG,MAAM,IAAA,2BAAW,EAAC,MAAM,CAAC,CAAC;QAC3C,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;YAC/C,OAAO;QACV,CAAC;IACJ,CAAC;IAED,wBAAwB;IACxB,IAAI,MAAM,SAAG,CAAC,iBAAiB,CAAC,kBAAkB,CAAC,MAAM,CAAC,EAAE,CAAC;QAC1D,OAAO;IACV,CAAC;IAED,MAAM,IAAI,uBAAc,CAAC;QACtB,OAAO,EAAE,iCAAiC;KAC5C,CAAC,CAAC;AACN,CAAC"}
@@ -0,0 +1,32 @@
1
+ import { Dictionary } from "@rockster/common";
2
+ import { PropertyNote } from "@rockster/class-memory";
3
+ import { IControllerProperty } from "../../controllers/interfaces/controller-property";
4
+ import { PendingAction } from "../../core/interfaces/pending-action";
5
+ import { IRequestContext } from "../../core/interfaces/request-context";
6
+ export type ScopeActionKeySlot = "query" | "create" | "modify" | "remove" | "default";
7
+ /**
8
+ * Enforces scope authorization for an action slot.
9
+ *
10
+ * A slot may carry one OR many keys ("a door with several locks"): the user must
11
+ * satisfy EVERY key (AND). Keys may belong to different scope contexts — each
12
+ * key resolves its own context id. Being the owner of a context satisfies that
13
+ * context's keys. Context-id / owner / user-key lookups are memoized within the
14
+ * call so keys sharing a context don't hit the DB twice; resolvers may also
15
+ * cache loaded data on `context.scopeStore` for the handler to reuse.
16
+ *
17
+ * Invoke it either with a `pending` action (default / query / post / remove
18
+ * builders) or with an explicit `requestPayload` (restful @Get/@Post… routes).
19
+ */
20
+ export declare function assertScopeActionAccess(options: {
21
+ property: PropertyNote<IControllerProperty>;
22
+ slot: ScopeActionKeySlot;
23
+ context: IRequestContext;
24
+ /** Action flow: payload + annotations are read from the pending action. */
25
+ pending?: PendingAction;
26
+ /** Restful flow: payload provided explicitly (e.g. merged route params). */
27
+ requestPayload?: unknown;
28
+ annotations?: Dictionary<unknown>;
29
+ postType?: "create" | "modify";
30
+ /** Entity id for modify/remove when it is not the request body itself. */
31
+ entityId?: string;
32
+ }): Promise<void>;
@@ -0,0 +1,189 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.assertScopeActionAccess = assertScopeActionAccess;
4
+ const common_1 = require("@rockster/common");
5
+ const get_is_owner_1 = require("./get-is-owner");
6
+ const get_user_keys_1 = require("./get-user-keys");
7
+ const resolve_scope_context_id_1 = require("./resolve-scope-context-id");
8
+ const env_1 = require("../env");
9
+ function resolveRemoveIdValue(requestPayload) {
10
+ if (requestPayload == null) {
11
+ return undefined;
12
+ }
13
+ if (typeof requestPayload === "string" || typeof requestPayload === "number") {
14
+ return String(requestPayload);
15
+ }
16
+ if (typeof requestPayload === "object") {
17
+ const record = requestPayload;
18
+ const id = record.id ?? record.Id;
19
+ if (id != null && String(id).trim() !== "") {
20
+ return String(id);
21
+ }
22
+ }
23
+ return undefined;
24
+ }
25
+ function slotToActionKind(slot) {
26
+ if (slot === "query") {
27
+ return "query";
28
+ }
29
+ if (slot === "create" || slot === "modify") {
30
+ return "post";
31
+ }
32
+ if (slot === "remove") {
33
+ return "remove";
34
+ }
35
+ return "default";
36
+ }
37
+ /**
38
+ * Enforces scope authorization for an action slot.
39
+ *
40
+ * A slot may carry one OR many keys ("a door with several locks"): the user must
41
+ * satisfy EVERY key (AND). Keys may belong to different scope contexts — each
42
+ * key resolves its own context id. Being the owner of a context satisfies that
43
+ * context's keys. Context-id / owner / user-key lookups are memoized within the
44
+ * call so keys sharing a context don't hit the DB twice; resolvers may also
45
+ * cache loaded data on `context.scopeStore` for the handler to reuse.
46
+ *
47
+ * Invoke it either with a `pending` action (default / query / post / remove
48
+ * builders) or with an explicit `requestPayload` (restful @Get/@Post… routes).
49
+ */
50
+ async function assertScopeActionAccess(options) {
51
+ const { property, slot, context, pending, postType, entityId } = options;
52
+ const keys = property.keys?.get(slot);
53
+ if (!keys || keys.length === 0) {
54
+ return;
55
+ }
56
+ const userId = context.session?.userId;
57
+ if (!userId) {
58
+ throw new common_1.UnauthorizedError();
59
+ }
60
+ const requestPayload = pending
61
+ ? context.request[pending.requestRef]
62
+ : options.requestPayload;
63
+ const annotations = pending?.annotations ?? options.annotations;
64
+ const actionKind = slotToActionKind(slot);
65
+ const idValue = entityId
66
+ ?? (actionKind === "remove"
67
+ ? resolveRemoveIdValue(requestPayload)
68
+ : undefined);
69
+ // Per-request store: resolvers may stash loaded data here so later resolvers
70
+ // (and the handler) reuse it instead of querying the DB again.
71
+ const store = (context.scopeStore ?? (context.scopeStore = new Map()));
72
+ // Per-call memo so several keys on the same context resolve/lookup only once.
73
+ const contextIdCache = new Map();
74
+ const ownerCache = new Map();
75
+ const userKeysCache = new Map();
76
+ const rootContextIdCache = new Map();
77
+ const missing = [];
78
+ for (const key of keys) {
79
+ const resolverCacheKey = `${key.contextName}|${key.resolverHandler ?? ""}`;
80
+ let contextId;
81
+ if (contextIdCache.has(resolverCacheKey)) {
82
+ contextId = contextIdCache.get(resolverCacheKey);
83
+ }
84
+ else {
85
+ contextId = await (0, resolve_scope_context_id_1.resolveScopeContextId)({
86
+ contextName: key.contextName,
87
+ requestPayload,
88
+ actionKind,
89
+ postType,
90
+ idValue,
91
+ entityTarget: property.data,
92
+ entityManager: context.entityManager,
93
+ withId: key.withId,
94
+ resolverHandler: key.resolverHandler,
95
+ requestContext: context,
96
+ pendingAnnotations: annotations,
97
+ store,
98
+ });
99
+ contextIdCache.set(resolverCacheKey, contextId);
100
+ }
101
+ if (key.withId && (contextId == null || contextId.trim() === "")) {
102
+ throw new common_1.ForbiddenError({
103
+ message: `Context id is required for [${key.contextName}]`,
104
+ });
105
+ }
106
+ const ownerCacheKey = `${key.contextName}|${contextId ?? ""}`;
107
+ let isOwner;
108
+ if (ownerCache.has(ownerCacheKey)) {
109
+ isOwner = ownerCache.get(ownerCacheKey);
110
+ }
111
+ else {
112
+ isOwner = await (0, get_is_owner_1.getIsOwner)(key.contextName, userId, contextId);
113
+ ownerCache.set(ownerCacheKey, isOwner);
114
+ }
115
+ if (isOwner) {
116
+ continue;
117
+ }
118
+ const userKeysCacheKey = contextId ?? "";
119
+ let userKeys;
120
+ if (userKeysCache.has(userKeysCacheKey)) {
121
+ userKeys = userKeysCache.get(userKeysCacheKey);
122
+ }
123
+ else {
124
+ userKeys = contextId
125
+ ? await (0, get_user_keys_1.getUserKeys)(userId, contextId)
126
+ : await (0, get_user_keys_1.getUserKeys)(userId);
127
+ userKeysCache.set(userKeysCacheKey, userKeys);
128
+ }
129
+ // Direct grant.
130
+ if (userKeys.includes(key.name)) {
131
+ continue;
132
+ }
133
+ const registry = env_1.env.scopeServiceRegistry.get(key.contextName);
134
+ // Context admin: holds this context's admin key → may do anything here.
135
+ if (registry?.adminKey && userKeys.includes(registry.adminKey)) {
136
+ continue;
137
+ }
138
+ // Platform master: holds the master key at the hierarchy ROOT → may do
139
+ // anything in any descendant scope. The root context is resolved from the
140
+ // same request (the root scope's resolver derives e.g. the workspace from
141
+ // the project/account being acted upon).
142
+ let rootContextId;
143
+ let masterKey;
144
+ if (registry?.root) {
145
+ rootContextId = contextId;
146
+ masterKey = registry.masterKey;
147
+ }
148
+ else if (registry?.rootScope) {
149
+ masterKey = env_1.env.scopeServiceRegistry.get(registry.rootScope)?.masterKey;
150
+ if (rootContextIdCache.has(registry.rootScope)) {
151
+ rootContextId = rootContextIdCache.get(registry.rootScope);
152
+ }
153
+ else {
154
+ rootContextId = await (0, resolve_scope_context_id_1.resolveScopeContextId)({
155
+ contextName: registry.rootScope,
156
+ requestPayload,
157
+ actionKind,
158
+ postType,
159
+ idValue,
160
+ entityTarget: property.data,
161
+ entityManager: context.entityManager,
162
+ withId: true,
163
+ requestContext: context,
164
+ pendingAnnotations: annotations,
165
+ store,
166
+ });
167
+ rootContextIdCache.set(registry.rootScope, rootContextId);
168
+ }
169
+ }
170
+ if (masterKey && rootContextId) {
171
+ let rootKeys = userKeysCache.get(rootContextId);
172
+ if (!rootKeys) {
173
+ rootKeys = await (0, get_user_keys_1.getUserKeys)(userId, rootContextId);
174
+ userKeysCache.set(rootContextId, rootKeys);
175
+ }
176
+ if (rootKeys.includes(masterKey)) {
177
+ continue;
178
+ }
179
+ }
180
+ missing.push(key.name);
181
+ }
182
+ if (missing.length > 0) {
183
+ throw new common_1.ForbiddenError({
184
+ message: "Action require permissions to execute",
185
+ requirements: missing,
186
+ });
187
+ }
188
+ }
189
+ //# sourceMappingURL=assert-scope-action-access.js.map