@decaf-ts/integrations 0.10.5 → 0.11.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 (826) hide show
  1. package/README.md +77 -5
  2. package/dist/integrations.cjs +1 -1
  3. package/dist/integrations.cjs.map +1 -1
  4. package/dist/integrations.js +1 -1
  5. package/dist/integrations.js.map +1 -1
  6. package/docker/dragonfly-compose.yml +19 -0
  7. package/lib/cjs/blob/core/BlobStoreFactory.cjs +0 -4
  8. package/lib/cjs/blob/core/BlobStoreFactory.cjs.map +1 -1
  9. package/lib/cjs/feature-flags/EngineCapabilityFeatureFlag.service.cjs +214 -0
  10. package/lib/cjs/feature-flags/EngineCapabilityFeatureFlag.service.cjs.map +1 -0
  11. package/lib/cjs/feature-flags/index.cjs +1 -0
  12. package/lib/cjs/feature-flags/index.cjs.map +1 -1
  13. package/lib/cjs/index.cjs +3 -3
  14. package/lib/cjs/loader/ObjectLoader.cjs +95 -11
  15. package/lib/cjs/loader/ObjectLoader.cjs.map +1 -1
  16. package/lib/cjs/loader/assets.cjs +160 -0
  17. package/lib/cjs/loader/assets.cjs.map +1 -0
  18. package/lib/cjs/loader/config.cjs +241 -0
  19. package/lib/cjs/loader/config.cjs.map +1 -0
  20. package/lib/cjs/loader/families.cjs +27 -12
  21. package/lib/cjs/loader/families.cjs.map +1 -1
  22. package/lib/cjs/loader/index.cjs +3 -0
  23. package/lib/cjs/loader/index.cjs.map +1 -1
  24. package/lib/cjs/loader/nest.cjs +331 -0
  25. package/lib/cjs/loader/nest.cjs.map +1 -0
  26. package/lib/cjs/redis/RedisContextLock.cjs +185 -0
  27. package/lib/cjs/redis/RedisContextLock.cjs.map +1 -0
  28. package/lib/cjs/redis/RedisDispatch.cjs +132 -0
  29. package/lib/cjs/redis/RedisDispatch.cjs.map +1 -0
  30. package/lib/cjs/redis/RedisPaginator.cjs +95 -0
  31. package/lib/cjs/redis/RedisPaginator.cjs.map +1 -0
  32. package/lib/cjs/redis/RedisStatement.cjs +433 -0
  33. package/lib/cjs/redis/RedisStatement.cjs.map +1 -0
  34. package/lib/cjs/redis/adapter.cjs +709 -0
  35. package/lib/cjs/redis/adapter.cjs.map +1 -0
  36. package/lib/cjs/redis/constants.cjs +31 -0
  37. package/lib/cjs/redis/constants.cjs.map +1 -0
  38. package/lib/cjs/redis/handlers.cjs +27 -0
  39. package/lib/cjs/redis/handlers.cjs.map +1 -0
  40. package/lib/cjs/redis/index.cjs +36 -0
  41. package/lib/cjs/redis/index.cjs.map +1 -0
  42. package/lib/cjs/redis/serialization.cjs +63 -0
  43. package/lib/cjs/redis/serialization.cjs.map +1 -0
  44. package/lib/cjs/redis/types.cjs.map +1 -0
  45. package/lib/esm/blob/core/BlobStoreFactory.js +0 -4
  46. package/lib/esm/blob/core/BlobStoreFactory.js.map +1 -1
  47. package/lib/esm/feature-flags/EngineCapabilityFeatureFlag.service.js +203 -0
  48. package/lib/esm/feature-flags/EngineCapabilityFeatureFlag.service.js.map +1 -0
  49. package/lib/esm/feature-flags/index.js +1 -0
  50. package/lib/esm/feature-flags/index.js.map +1 -1
  51. package/lib/esm/index.js +3 -3
  52. package/lib/esm/loader/ObjectLoader.js +94 -11
  53. package/lib/esm/loader/ObjectLoader.js.map +1 -1
  54. package/lib/esm/loader/assets.js +155 -0
  55. package/lib/esm/loader/assets.js.map +1 -0
  56. package/lib/esm/loader/config.js +202 -0
  57. package/lib/esm/loader/config.js.map +1 -0
  58. package/lib/esm/loader/families.js +25 -10
  59. package/lib/esm/loader/families.js.map +1 -1
  60. package/lib/esm/loader/index.js +3 -0
  61. package/lib/esm/loader/index.js.map +1 -1
  62. package/lib/esm/loader/nest.js +292 -0
  63. package/lib/esm/loader/nest.js.map +1 -0
  64. package/lib/esm/redis/RedisContextLock.js +180 -0
  65. package/lib/esm/redis/RedisContextLock.js.map +1 -0
  66. package/lib/esm/redis/RedisDispatch.js +127 -0
  67. package/lib/esm/redis/RedisDispatch.js.map +1 -0
  68. package/lib/esm/redis/RedisPaginator.js +90 -0
  69. package/lib/esm/redis/RedisPaginator.js.map +1 -0
  70. package/lib/esm/redis/RedisStatement.js +428 -0
  71. package/lib/esm/redis/RedisStatement.js.map +1 -0
  72. package/lib/esm/redis/adapter.js +704 -0
  73. package/lib/esm/redis/adapter.js.map +1 -0
  74. package/lib/esm/redis/constants.js +27 -0
  75. package/lib/esm/redis/constants.js.map +1 -0
  76. package/lib/esm/redis/handlers.js +23 -0
  77. package/lib/esm/redis/handlers.js.map +1 -0
  78. package/lib/esm/redis/index.js +19 -0
  79. package/lib/esm/redis/index.js.map +1 -0
  80. package/lib/esm/redis/serialization.js +57 -0
  81. package/lib/esm/redis/serialization.js.map +1 -0
  82. package/lib/esm/{graph/engine → redis}/types.js.map +1 -1
  83. package/lib/types/blob/core/BlobTypes.d.cts +1 -14
  84. package/lib/types/blob/core/BlobTypes.d.mts +1 -14
  85. package/lib/types/feature-flags/EngineCapabilityFeatureFlag.service.d.cts +116 -0
  86. package/lib/types/feature-flags/EngineCapabilityFeatureFlag.service.d.mts +116 -0
  87. package/lib/types/feature-flags/index.d.cts +1 -0
  88. package/lib/types/feature-flags/index.d.mts +1 -0
  89. package/lib/types/index.d.cts +2 -2
  90. package/lib/types/index.d.mts +2 -2
  91. package/lib/types/loader/ObjectLoader.d.cts +46 -2
  92. package/lib/types/loader/ObjectLoader.d.mts +46 -2
  93. package/lib/types/loader/assets.d.cts +43 -0
  94. package/lib/types/loader/assets.d.mts +43 -0
  95. package/lib/types/loader/config.d.cts +84 -0
  96. package/lib/types/loader/config.d.mts +84 -0
  97. package/lib/types/loader/families.d.cts +19 -7
  98. package/lib/types/loader/families.d.mts +19 -7
  99. package/lib/types/loader/index.d.cts +3 -0
  100. package/lib/types/loader/index.d.mts +3 -0
  101. package/lib/types/loader/nest.d.cts +102 -0
  102. package/lib/types/loader/nest.d.mts +102 -0
  103. package/lib/types/loader/types.d.cts +27 -1
  104. package/lib/types/loader/types.d.mts +27 -1
  105. package/lib/types/redis/RedisContextLock.d.cts +106 -0
  106. package/lib/types/redis/RedisContextLock.d.mts +106 -0
  107. package/lib/types/redis/RedisDispatch.d.cts +56 -0
  108. package/lib/types/redis/RedisDispatch.d.mts +56 -0
  109. package/lib/types/redis/RedisPaginator.d.cts +58 -0
  110. package/lib/types/redis/RedisPaginator.d.mts +58 -0
  111. package/lib/types/redis/RedisStatement.d.cts +175 -0
  112. package/lib/types/redis/RedisStatement.d.mts +175 -0
  113. package/lib/types/redis/adapter.d.cts +288 -0
  114. package/lib/types/redis/adapter.d.mts +288 -0
  115. package/lib/types/redis/constants.d.cts +26 -0
  116. package/lib/types/redis/constants.d.mts +26 -0
  117. package/lib/types/redis/handlers.d.cts +20 -0
  118. package/lib/types/redis/handlers.d.mts +20 -0
  119. package/lib/types/redis/index.d.cts +17 -0
  120. package/lib/types/redis/index.d.mts +17 -0
  121. package/lib/types/redis/serialization.d.cts +35 -0
  122. package/lib/types/redis/serialization.d.mts +35 -0
  123. package/lib/types/redis/types.d.cts +72 -0
  124. package/lib/types/redis/types.d.mts +72 -0
  125. package/package.json +17 -33
  126. package/lib/cjs/blob/ipfs/IpfsBlobEnvironment.cjs +0 -30
  127. package/lib/cjs/blob/ipfs/IpfsBlobEnvironment.cjs.map +0 -1
  128. package/lib/cjs/blob/ipfs/IpfsBlobStoreService.cjs +0 -248
  129. package/lib/cjs/blob/ipfs/IpfsBlobStoreService.cjs.map +0 -1
  130. package/lib/cjs/blob/ipfs/IpfsKeyIndex.cjs +0 -27
  131. package/lib/cjs/blob/ipfs/IpfsKeyIndex.cjs.map +0 -1
  132. package/lib/cjs/blob/ipfs/LocalJsonIpfsKeyIndex.cjs +0 -35
  133. package/lib/cjs/blob/ipfs/LocalJsonIpfsKeyIndex.cjs.map +0 -1
  134. package/lib/cjs/blob/ipfs/MemoryIpfsKeyIndex.cjs +0 -45
  135. package/lib/cjs/blob/ipfs/MemoryIpfsKeyIndex.cjs.map +0 -1
  136. package/lib/cjs/blob/ipfs/PostgresIpfsKeyIndex.cjs +0 -35
  137. package/lib/cjs/blob/ipfs/PostgresIpfsKeyIndex.cjs.map +0 -1
  138. package/lib/cjs/blob/ipfs/index.cjs +0 -29
  139. package/lib/cjs/blob/ipfs/index.cjs.map +0 -1
  140. package/lib/cjs/graph/engine/catalog/GraphBuiltInRegistrations.cjs +0 -100
  141. package/lib/cjs/graph/engine/catalog/GraphBuiltInRegistrations.cjs.map +0 -1
  142. package/lib/cjs/graph/engine/catalog/GraphCatalogueErrors.cjs +0 -29
  143. package/lib/cjs/graph/engine/catalog/GraphCatalogueErrors.cjs.map +0 -1
  144. package/lib/cjs/graph/engine/catalog/GraphNodeCatalogue.cjs +0 -270
  145. package/lib/cjs/graph/engine/catalog/GraphNodeCatalogue.cjs.map +0 -1
  146. package/lib/cjs/graph/engine/catalog/GraphNodeManifestResolver.cjs +0 -169
  147. package/lib/cjs/graph/engine/catalog/GraphNodeManifestResolver.cjs.map +0 -1
  148. package/lib/cjs/graph/engine/catalog/GraphNodeMethodRegistry.cjs +0 -64
  149. package/lib/cjs/graph/engine/catalog/GraphNodeMethodRegistry.cjs.map +0 -1
  150. package/lib/cjs/graph/engine/catalog/GraphNodeRegistration.cjs +0 -17
  151. package/lib/cjs/graph/engine/catalog/GraphNodeRegistration.cjs.map +0 -1
  152. package/lib/cjs/graph/engine/catalog/index.cjs +0 -24
  153. package/lib/cjs/graph/engine/catalog/index.cjs.map +0 -1
  154. package/lib/cjs/graph/engine/constants.cjs +0 -58
  155. package/lib/cjs/graph/engine/constants.cjs.map +0 -1
  156. package/lib/cjs/graph/engine/decorators.cjs +0 -4
  157. package/lib/cjs/graph/engine/decorators.cjs.map +0 -1
  158. package/lib/cjs/graph/engine/errors/GraphBreakSignal.cjs +0 -37
  159. package/lib/cjs/graph/engine/errors/GraphBreakSignal.cjs.map +0 -1
  160. package/lib/cjs/graph/engine/errors/GraphCycleError.cjs +0 -20
  161. package/lib/cjs/graph/engine/errors/GraphCycleError.cjs.map +0 -1
  162. package/lib/cjs/graph/engine/errors/GraphExecutionError.cjs +0 -28
  163. package/lib/cjs/graph/engine/errors/GraphExecutionError.cjs.map +0 -1
  164. package/lib/cjs/graph/engine/errors/GraphInputError.cjs +0 -20
  165. package/lib/cjs/graph/engine/errors/GraphInputError.cjs.map +0 -1
  166. package/lib/cjs/graph/engine/errors/GraphLoopLimitError.cjs +0 -20
  167. package/lib/cjs/graph/engine/errors/GraphLoopLimitError.cjs.map +0 -1
  168. package/lib/cjs/graph/engine/errors/GraphPinningError.cjs +0 -20
  169. package/lib/cjs/graph/engine/errors/GraphPinningError.cjs.map +0 -1
  170. package/lib/cjs/graph/engine/errors/GraphPortError.cjs +0 -20
  171. package/lib/cjs/graph/engine/errors/GraphPortError.cjs.map +0 -1
  172. package/lib/cjs/graph/engine/errors/GraphRunCancelledError.cjs +0 -18
  173. package/lib/cjs/graph/engine/errors/GraphRunCancelledError.cjs.map +0 -1
  174. package/lib/cjs/graph/engine/errors/GraphStoreError.cjs +0 -20
  175. package/lib/cjs/graph/engine/errors/GraphStoreError.cjs.map +0 -1
  176. package/lib/cjs/graph/engine/errors/GraphTopologyError.cjs +0 -20
  177. package/lib/cjs/graph/engine/errors/GraphTopologyError.cjs.map +0 -1
  178. package/lib/cjs/graph/engine/errors/index.cjs +0 -33
  179. package/lib/cjs/graph/engine/errors/index.cjs.map +0 -1
  180. package/lib/cjs/graph/engine/events/GraphExecutionEventEmitter.cjs +0 -40
  181. package/lib/cjs/graph/engine/events/GraphExecutionEventEmitter.cjs.map +0 -1
  182. package/lib/cjs/graph/engine/events/GraphExecutionEventFactory.cjs +0 -37
  183. package/lib/cjs/graph/engine/events/GraphExecutionEventFactory.cjs.map +0 -1
  184. package/lib/cjs/graph/engine/events/GraphExecutionObserver.cjs +0 -4
  185. package/lib/cjs/graph/engine/events/GraphExecutionObserver.cjs.map +0 -1
  186. package/lib/cjs/graph/engine/events/index.cjs +0 -26
  187. package/lib/cjs/graph/engine/events/index.cjs.map +0 -1
  188. package/lib/cjs/graph/engine/execution/BreakGraphNodeExecutor.cjs +0 -24
  189. package/lib/cjs/graph/engine/execution/BreakGraphNodeExecutor.cjs.map +0 -1
  190. package/lib/cjs/graph/engine/execution/CodeGraphNodeExecutor.cjs +0 -103
  191. package/lib/cjs/graph/engine/execution/CodeGraphNodeExecutor.cjs.map +0 -1
  192. package/lib/cjs/graph/engine/execution/CodeSandboxEvaluator.cjs +0 -4
  193. package/lib/cjs/graph/engine/execution/CodeSandboxEvaluator.cjs.map +0 -1
  194. package/lib/cjs/graph/engine/execution/GraphExecutionContext.cjs +0 -112
  195. package/lib/cjs/graph/engine/execution/GraphExecutionContext.cjs.map +0 -1
  196. package/lib/cjs/graph/engine/execution/GraphExecutionEngine.cjs +0 -789
  197. package/lib/cjs/graph/engine/execution/GraphExecutionEngine.cjs.map +0 -1
  198. package/lib/cjs/graph/engine/execution/GraphExecutionFrame.cjs +0 -32
  199. package/lib/cjs/graph/engine/execution/GraphExecutionFrame.cjs.map +0 -1
  200. package/lib/cjs/graph/engine/execution/GraphExecutionResult.cjs +0 -30
  201. package/lib/cjs/graph/engine/execution/GraphExecutionResult.cjs.map +0 -1
  202. package/lib/cjs/graph/engine/execution/GraphNodeExecutor.cjs +0 -4
  203. package/lib/cjs/graph/engine/execution/GraphNodeExecutor.cjs.map +0 -1
  204. package/lib/cjs/graph/engine/execution/IsolatedVmCodeSandboxEvaluator.cjs +0 -481
  205. package/lib/cjs/graph/engine/execution/IsolatedVmCodeSandboxEvaluator.cjs.map +0 -1
  206. package/lib/cjs/graph/engine/execution/LogGraphNodeExecutor.cjs +0 -47
  207. package/lib/cjs/graph/engine/execution/LogGraphNodeExecutor.cjs.map +0 -1
  208. package/lib/cjs/graph/engine/execution/SwitchGraphNodeExecutor.cjs +0 -121
  209. package/lib/cjs/graph/engine/execution/SwitchGraphNodeExecutor.cjs.map +0 -1
  210. package/lib/cjs/graph/engine/execution/index.cjs +0 -34
  211. package/lib/cjs/graph/engine/execution/index.cjs.map +0 -1
  212. package/lib/cjs/graph/engine/index.cjs +0 -86
  213. package/lib/cjs/graph/engine/index.cjs.map +0 -1
  214. package/lib/cjs/graph/engine/loops/ConditionExpressionEvaluator.cjs +0 -87
  215. package/lib/cjs/graph/engine/loops/ConditionExpressionEvaluator.cjs.map +0 -1
  216. package/lib/cjs/graph/engine/loops/ForeachGraphNodeExecutor.cjs +0 -146
  217. package/lib/cjs/graph/engine/loops/ForeachGraphNodeExecutor.cjs.map +0 -1
  218. package/lib/cjs/graph/engine/loops/GraphConditionEvaluator.cjs +0 -85
  219. package/lib/cjs/graph/engine/loops/GraphConditionEvaluator.cjs.map +0 -1
  220. package/lib/cjs/graph/engine/loops/GraphLoopExecutionContext.cjs +0 -16
  221. package/lib/cjs/graph/engine/loops/GraphLoopExecutionContext.cjs.map +0 -1
  222. package/lib/cjs/graph/engine/loops/UntilGraphNodeExecutor.cjs +0 -102
  223. package/lib/cjs/graph/engine/loops/UntilGraphNodeExecutor.cjs.map +0 -1
  224. package/lib/cjs/graph/engine/loops/WhileGraphNodeExecutor.cjs +0 -103
  225. package/lib/cjs/graph/engine/loops/WhileGraphNodeExecutor.cjs.map +0 -1
  226. package/lib/cjs/graph/engine/loops/index.cjs +0 -29
  227. package/lib/cjs/graph/engine/loops/index.cjs.map +0 -1
  228. package/lib/cjs/graph/engine/pinning/GraphPinningDependencyResolver.cjs +0 -28
  229. package/lib/cjs/graph/engine/pinning/GraphPinningDependencyResolver.cjs.map +0 -1
  230. package/lib/cjs/graph/engine/pinning/GraphPinningMetadata.cjs +0 -20
  231. package/lib/cjs/graph/engine/pinning/GraphPinningMetadata.cjs.map +0 -1
  232. package/lib/cjs/graph/engine/pinning/GraphPinningPolicy.cjs +0 -34
  233. package/lib/cjs/graph/engine/pinning/GraphPinningPolicy.cjs.map +0 -1
  234. package/lib/cjs/graph/engine/pinning/GraphPinningService.cjs +0 -220
  235. package/lib/cjs/graph/engine/pinning/GraphPinningService.cjs.map +0 -1
  236. package/lib/cjs/graph/engine/pinning/index.cjs +0 -27
  237. package/lib/cjs/graph/engine/pinning/index.cjs.map +0 -1
  238. package/lib/cjs/graph/engine/planning/GraphExecutionPlan.cjs +0 -4
  239. package/lib/cjs/graph/engine/planning/GraphExecutionPlan.cjs.map +0 -1
  240. package/lib/cjs/graph/engine/planning/GraphExecutionPlanEdge.cjs +0 -4
  241. package/lib/cjs/graph/engine/planning/GraphExecutionPlanEdge.cjs.map +0 -1
  242. package/lib/cjs/graph/engine/planning/GraphExecutionPlanLayer.cjs +0 -4
  243. package/lib/cjs/graph/engine/planning/GraphExecutionPlanLayer.cjs.map +0 -1
  244. package/lib/cjs/graph/engine/planning/GraphExecutionPlanNode.cjs +0 -4
  245. package/lib/cjs/graph/engine/planning/GraphExecutionPlanNode.cjs.map +0 -1
  246. package/lib/cjs/graph/engine/planning/GraphExecutionPlanner.cjs +0 -188
  247. package/lib/cjs/graph/engine/planning/GraphExecutionPlanner.cjs.map +0 -1
  248. package/lib/cjs/graph/engine/planning/GraphTopology.cjs +0 -57
  249. package/lib/cjs/graph/engine/planning/GraphTopology.cjs.map +0 -1
  250. package/lib/cjs/graph/engine/planning/index.cjs +0 -29
  251. package/lib/cjs/graph/engine/planning/index.cjs.map +0 -1
  252. package/lib/cjs/graph/engine/registry/GraphNodeExecutorRegistry.cjs +0 -57
  253. package/lib/cjs/graph/engine/registry/GraphNodeExecutorRegistry.cjs.map +0 -1
  254. package/lib/cjs/graph/engine/registry/GraphNodeExecutorResolver.cjs +0 -27
  255. package/lib/cjs/graph/engine/registry/GraphNodeExecutorResolver.cjs.map +0 -1
  256. package/lib/cjs/graph/engine/registry/index.cjs +0 -25
  257. package/lib/cjs/graph/engine/registry/index.cjs.map +0 -1
  258. package/lib/cjs/graph/engine/runs/GraphRunEventPublisher.cjs +0 -69
  259. package/lib/cjs/graph/engine/runs/GraphRunEventPublisher.cjs.map +0 -1
  260. package/lib/cjs/graph/engine/runs/GraphRunExecutor.cjs +0 -291
  261. package/lib/cjs/graph/engine/runs/GraphRunExecutor.cjs.map +0 -1
  262. package/lib/cjs/graph/engine/runs/GraphRunFingerprint.cjs +0 -29
  263. package/lib/cjs/graph/engine/runs/GraphRunFingerprint.cjs.map +0 -1
  264. package/lib/cjs/graph/engine/runs/GraphRunService.cjs +0 -259
  265. package/lib/cjs/graph/engine/runs/GraphRunService.cjs.map +0 -1
  266. package/lib/cjs/graph/engine/runs/InMemoryGraphRunEventStore.cjs +0 -69
  267. package/lib/cjs/graph/engine/runs/InMemoryGraphRunEventStore.cjs.map +0 -1
  268. package/lib/cjs/graph/engine/runs/InMemoryGraphRunStore.cjs +0 -26
  269. package/lib/cjs/graph/engine/runs/InMemoryGraphRunStore.cjs.map +0 -1
  270. package/lib/cjs/graph/engine/runs/index.cjs +0 -26
  271. package/lib/cjs/graph/engine/runs/index.cjs.map +0 -1
  272. package/lib/cjs/graph/engine/runs/ownership.cjs +0 -34
  273. package/lib/cjs/graph/engine/runs/ownership.cjs.map +0 -1
  274. package/lib/cjs/graph/engine/runs/types.cjs.map +0 -1
  275. package/lib/cjs/graph/engine/snapshots/GraphExecutionSnapshotMapper.cjs +0 -53
  276. package/lib/cjs/graph/engine/snapshots/GraphExecutionSnapshotMapper.cjs.map +0 -1
  277. package/lib/cjs/graph/engine/snapshots/index.cjs +0 -24
  278. package/lib/cjs/graph/engine/snapshots/index.cjs.map +0 -1
  279. package/lib/cjs/graph/engine/store/GraphCachedValue.cjs +0 -4
  280. package/lib/cjs/graph/engine/store/GraphCachedValue.cjs.map +0 -1
  281. package/lib/cjs/graph/engine/store/GraphValueKey.cjs +0 -4
  282. package/lib/cjs/graph/engine/store/GraphValueKey.cjs.map +0 -1
  283. package/lib/cjs/graph/engine/store/GraphValueStore.cjs +0 -76
  284. package/lib/cjs/graph/engine/store/GraphValueStore.cjs.map +0 -1
  285. package/lib/cjs/graph/engine/store/GraphValueStoreAdapter.cjs +0 -4
  286. package/lib/cjs/graph/engine/store/GraphValueStoreAdapter.cjs.map +0 -1
  287. package/lib/cjs/graph/engine/store/InMemoryGraphValueStoreAdapter.cjs +0 -69
  288. package/lib/cjs/graph/engine/store/InMemoryGraphValueStoreAdapter.cjs.map +0 -1
  289. package/lib/cjs/graph/engine/store/index.cjs +0 -28
  290. package/lib/cjs/graph/engine/store/index.cjs.map +0 -1
  291. package/lib/cjs/graph/engine/types.cjs +0 -4
  292. package/lib/cjs/graph/engine/types.cjs.map +0 -1
  293. package/lib/cjs/graph/engine/validation/GraphConnectionPolicyValidator.cjs +0 -142
  294. package/lib/cjs/graph/engine/validation/GraphConnectionPolicyValidator.cjs.map +0 -1
  295. package/lib/cjs/graph/engine/validation/GraphCredentialReferenceValidator.cjs +0 -160
  296. package/lib/cjs/graph/engine/validation/GraphCredentialReferenceValidator.cjs.map +0 -1
  297. package/lib/cjs/graph/engine/validation/GraphDefinitionValidator.cjs +0 -29
  298. package/lib/cjs/graph/engine/validation/GraphDefinitionValidator.cjs.map +0 -1
  299. package/lib/cjs/graph/engine/validation/GraphEdgeInstanceValidator.cjs +0 -166
  300. package/lib/cjs/graph/engine/validation/GraphEdgeInstanceValidator.cjs.map +0 -1
  301. package/lib/cjs/graph/engine/validation/GraphNodeInstanceValidator.cjs +0 -86
  302. package/lib/cjs/graph/engine/validation/GraphNodeInstanceValidator.cjs.map +0 -1
  303. package/lib/cjs/graph/engine/validation/GraphParameterValidator.cjs +0 -423
  304. package/lib/cjs/graph/engine/validation/GraphParameterValidator.cjs.map +0 -1
  305. package/lib/cjs/graph/engine/validation/GraphPortSchemaResolver.cjs +0 -58
  306. package/lib/cjs/graph/engine/validation/GraphPortSchemaResolver.cjs.map +0 -1
  307. package/lib/cjs/graph/engine/validation/GraphResolvedWorkflow.cjs +0 -4
  308. package/lib/cjs/graph/engine/validation/GraphResolvedWorkflow.cjs.map +0 -1
  309. package/lib/cjs/graph/engine/validation/GraphValidationErrors.cjs +0 -50
  310. package/lib/cjs/graph/engine/validation/GraphValidationErrors.cjs.map +0 -1
  311. package/lib/cjs/graph/engine/validation/GraphValidationIssue.cjs +0 -4
  312. package/lib/cjs/graph/engine/validation/GraphValidationIssue.cjs.map +0 -1
  313. package/lib/cjs/graph/engine/validation/GraphValueValidator.cjs +0 -52
  314. package/lib/cjs/graph/engine/validation/GraphValueValidator.cjs.map +0 -1
  315. package/lib/cjs/graph/engine/validation/GraphWorkflowDocumentValidator.cjs +0 -478
  316. package/lib/cjs/graph/engine/validation/GraphWorkflowDocumentValidator.cjs.map +0 -1
  317. package/lib/cjs/graph/engine/validation/index.cjs +0 -37
  318. package/lib/cjs/graph/engine/validation/index.cjs.map +0 -1
  319. package/lib/cjs/graph/index.cjs +0 -30
  320. package/lib/cjs/graph/index.cjs.map +0 -1
  321. package/lib/cjs/graph/log/GraphRunLogger.cjs +0 -145
  322. package/lib/cjs/graph/log/GraphRunLogger.cjs.map +0 -1
  323. package/lib/cjs/graph/log/LogParameters.cjs +0 -73
  324. package/lib/cjs/graph/log/LogParameters.cjs.map +0 -1
  325. package/lib/cjs/nest/graph/GraphExecutionController.cjs +0 -266
  326. package/lib/cjs/nest/graph/GraphExecutionController.cjs.map +0 -1
  327. package/lib/cjs/nest/graph/GraphExecutionModule.cjs +0 -178
  328. package/lib/cjs/nest/graph/GraphExecutionModule.cjs.map +0 -1
  329. package/lib/cjs/nest/graph/GraphExecutionResultModel.cjs +0 -75
  330. package/lib/cjs/nest/graph/GraphExecutionResultModel.cjs.map +0 -1
  331. package/lib/cjs/nest/graph/GraphExecutorRegistryFactory.cjs +0 -102
  332. package/lib/cjs/nest/graph/GraphExecutorRegistryFactory.cjs.map +0 -1
  333. package/lib/cjs/nest/graph/GraphNodeCatalogueController.cjs +0 -270
  334. package/lib/cjs/nest/graph/GraphNodeCatalogueController.cjs.map +0 -1
  335. package/lib/cjs/nest/graph/GraphResultService.cjs +0 -69
  336. package/lib/cjs/nest/graph/GraphResultService.cjs.map +0 -1
  337. package/lib/cjs/nest/graph/GraphRunController.cjs +0 -279
  338. package/lib/cjs/nest/graph/GraphRunController.cjs.map +0 -1
  339. package/lib/cjs/nest/graph/GraphRunModel.cjs +0 -83
  340. package/lib/cjs/nest/graph/GraphRunModel.cjs.map +0 -1
  341. package/lib/cjs/nest/graph/GraphRunModelService.cjs +0 -121
  342. package/lib/cjs/nest/graph/GraphRunModelService.cjs.map +0 -1
  343. package/lib/cjs/nest/graph/GraphWorkflowBoundaryValidation.cjs +0 -169
  344. package/lib/cjs/nest/graph/GraphWorkflowBoundaryValidation.cjs.map +0 -1
  345. package/lib/cjs/nest/graph/GraphWorkflowController.cjs +0 -162
  346. package/lib/cjs/nest/graph/GraphWorkflowController.cjs.map +0 -1
  347. package/lib/cjs/nest/graph/GraphWorkflowDocumentLimits.cjs +0 -12
  348. package/lib/cjs/nest/graph/GraphWorkflowDocumentLimits.cjs.map +0 -1
  349. package/lib/cjs/nest/graph/GraphWorkflowErrors.cjs +0 -23
  350. package/lib/cjs/nest/graph/GraphWorkflowErrors.cjs.map +0 -1
  351. package/lib/cjs/nest/graph/GraphWorkflowModel.cjs +0 -66
  352. package/lib/cjs/nest/graph/GraphWorkflowModel.cjs.map +0 -1
  353. package/lib/cjs/nest/graph/GraphWorkflowService.cjs +0 -265
  354. package/lib/cjs/nest/graph/GraphWorkflowService.cjs.map +0 -1
  355. package/lib/cjs/nest/graph/index.cjs +0 -33
  356. package/lib/cjs/nest/graph/index.cjs.map +0 -1
  357. package/lib/cjs/nest/graph/main.cjs +0 -47
  358. package/lib/cjs/nest/graph/main.cjs.map +0 -1
  359. package/lib/esm/blob/ipfs/IpfsBlobEnvironment.js +0 -26
  360. package/lib/esm/blob/ipfs/IpfsBlobEnvironment.js.map +0 -1
  361. package/lib/esm/blob/ipfs/IpfsBlobStoreService.js +0 -240
  362. package/lib/esm/blob/ipfs/IpfsBlobStoreService.js.map +0 -1
  363. package/lib/esm/blob/ipfs/IpfsKeyIndex.js +0 -23
  364. package/lib/esm/blob/ipfs/IpfsKeyIndex.js.map +0 -1
  365. package/lib/esm/blob/ipfs/LocalJsonIpfsKeyIndex.js +0 -30
  366. package/lib/esm/blob/ipfs/LocalJsonIpfsKeyIndex.js.map +0 -1
  367. package/lib/esm/blob/ipfs/MemoryIpfsKeyIndex.js +0 -40
  368. package/lib/esm/blob/ipfs/MemoryIpfsKeyIndex.js.map +0 -1
  369. package/lib/esm/blob/ipfs/PostgresIpfsKeyIndex.js +0 -30
  370. package/lib/esm/blob/ipfs/PostgresIpfsKeyIndex.js.map +0 -1
  371. package/lib/esm/blob/ipfs/index.js +0 -12
  372. package/lib/esm/blob/ipfs/index.js.map +0 -1
  373. package/lib/esm/graph/engine/catalog/GraphBuiltInRegistrations.js +0 -95
  374. package/lib/esm/graph/engine/catalog/GraphBuiltInRegistrations.js.map +0 -1
  375. package/lib/esm/graph/engine/catalog/GraphCatalogueErrors.js +0 -22
  376. package/lib/esm/graph/engine/catalog/GraphCatalogueErrors.js.map +0 -1
  377. package/lib/esm/graph/engine/catalog/GraphNodeCatalogue.js +0 -265
  378. package/lib/esm/graph/engine/catalog/GraphNodeCatalogue.js.map +0 -1
  379. package/lib/esm/graph/engine/catalog/GraphNodeManifestResolver.js +0 -162
  380. package/lib/esm/graph/engine/catalog/GraphNodeManifestResolver.js.map +0 -1
  381. package/lib/esm/graph/engine/catalog/GraphNodeMethodRegistry.js +0 -59
  382. package/lib/esm/graph/engine/catalog/GraphNodeMethodRegistry.js.map +0 -1
  383. package/lib/esm/graph/engine/catalog/GraphNodeRegistration.js +0 -12
  384. package/lib/esm/graph/engine/catalog/GraphNodeRegistration.js.map +0 -1
  385. package/lib/esm/graph/engine/catalog/index.js +0 -7
  386. package/lib/esm/graph/engine/catalog/index.js.map +0 -1
  387. package/lib/esm/graph/engine/constants.js +0 -62
  388. package/lib/esm/graph/engine/constants.js.map +0 -1
  389. package/lib/esm/graph/engine/decorators.js +0 -2
  390. package/lib/esm/graph/engine/decorators.js.map +0 -1
  391. package/lib/esm/graph/engine/errors/GraphBreakSignal.js +0 -32
  392. package/lib/esm/graph/engine/errors/GraphBreakSignal.js.map +0 -1
  393. package/lib/esm/graph/engine/errors/GraphCycleError.js +0 -15
  394. package/lib/esm/graph/engine/errors/GraphCycleError.js.map +0 -1
  395. package/lib/esm/graph/engine/errors/GraphExecutionError.js +0 -23
  396. package/lib/esm/graph/engine/errors/GraphExecutionError.js.map +0 -1
  397. package/lib/esm/graph/engine/errors/GraphInputError.js +0 -15
  398. package/lib/esm/graph/engine/errors/GraphInputError.js.map +0 -1
  399. package/lib/esm/graph/engine/errors/GraphLoopLimitError.js +0 -15
  400. package/lib/esm/graph/engine/errors/GraphLoopLimitError.js.map +0 -1
  401. package/lib/esm/graph/engine/errors/GraphPinningError.js +0 -15
  402. package/lib/esm/graph/engine/errors/GraphPinningError.js.map +0 -1
  403. package/lib/esm/graph/engine/errors/GraphPortError.js +0 -15
  404. package/lib/esm/graph/engine/errors/GraphPortError.js.map +0 -1
  405. package/lib/esm/graph/engine/errors/GraphRunCancelledError.js +0 -13
  406. package/lib/esm/graph/engine/errors/GraphRunCancelledError.js.map +0 -1
  407. package/lib/esm/graph/engine/errors/GraphStoreError.js +0 -15
  408. package/lib/esm/graph/engine/errors/GraphStoreError.js.map +0 -1
  409. package/lib/esm/graph/engine/errors/GraphTopologyError.js +0 -15
  410. package/lib/esm/graph/engine/errors/GraphTopologyError.js.map +0 -1
  411. package/lib/esm/graph/engine/errors/index.js +0 -16
  412. package/lib/esm/graph/engine/errors/index.js.map +0 -1
  413. package/lib/esm/graph/engine/events/GraphExecutionEventEmitter.js +0 -35
  414. package/lib/esm/graph/engine/events/GraphExecutionEventEmitter.js.map +0 -1
  415. package/lib/esm/graph/engine/events/GraphExecutionEventFactory.js +0 -32
  416. package/lib/esm/graph/engine/events/GraphExecutionEventFactory.js.map +0 -1
  417. package/lib/esm/graph/engine/events/GraphExecutionObserver.js +0 -2
  418. package/lib/esm/graph/engine/events/GraphExecutionObserver.js.map +0 -1
  419. package/lib/esm/graph/engine/events/index.js +0 -9
  420. package/lib/esm/graph/engine/events/index.js.map +0 -1
  421. package/lib/esm/graph/engine/execution/BreakGraphNodeExecutor.js +0 -19
  422. package/lib/esm/graph/engine/execution/BreakGraphNodeExecutor.js.map +0 -1
  423. package/lib/esm/graph/engine/execution/CodeGraphNodeExecutor.js +0 -98
  424. package/lib/esm/graph/engine/execution/CodeGraphNodeExecutor.js.map +0 -1
  425. package/lib/esm/graph/engine/execution/CodeSandboxEvaluator.js +0 -18
  426. package/lib/esm/graph/engine/execution/CodeSandboxEvaluator.js.map +0 -1
  427. package/lib/esm/graph/engine/execution/GraphExecutionContext.js +0 -107
  428. package/lib/esm/graph/engine/execution/GraphExecutionContext.js.map +0 -1
  429. package/lib/esm/graph/engine/execution/GraphExecutionEngine.js +0 -784
  430. package/lib/esm/graph/engine/execution/GraphExecutionEngine.js.map +0 -1
  431. package/lib/esm/graph/engine/execution/GraphExecutionFrame.js +0 -27
  432. package/lib/esm/graph/engine/execution/GraphExecutionFrame.js.map +0 -1
  433. package/lib/esm/graph/engine/execution/GraphExecutionResult.js +0 -26
  434. package/lib/esm/graph/engine/execution/GraphExecutionResult.js.map +0 -1
  435. package/lib/esm/graph/engine/execution/GraphNodeExecutor.js +0 -2
  436. package/lib/esm/graph/engine/execution/GraphNodeExecutor.js.map +0 -1
  437. package/lib/esm/graph/engine/execution/IsolatedVmCodeSandboxEvaluator.js +0 -440
  438. package/lib/esm/graph/engine/execution/IsolatedVmCodeSandboxEvaluator.js.map +0 -1
  439. package/lib/esm/graph/engine/execution/LogGraphNodeExecutor.js +0 -42
  440. package/lib/esm/graph/engine/execution/LogGraphNodeExecutor.js.map +0 -1
  441. package/lib/esm/graph/engine/execution/SwitchGraphNodeExecutor.js +0 -116
  442. package/lib/esm/graph/engine/execution/SwitchGraphNodeExecutor.js.map +0 -1
  443. package/lib/esm/graph/engine/execution/index.js +0 -17
  444. package/lib/esm/graph/engine/execution/index.js.map +0 -1
  445. package/lib/esm/graph/engine/index.js +0 -69
  446. package/lib/esm/graph/engine/index.js.map +0 -1
  447. package/lib/esm/graph/engine/loops/ConditionExpressionEvaluator.js +0 -82
  448. package/lib/esm/graph/engine/loops/ConditionExpressionEvaluator.js.map +0 -1
  449. package/lib/esm/graph/engine/loops/ForeachGraphNodeExecutor.js +0 -141
  450. package/lib/esm/graph/engine/loops/ForeachGraphNodeExecutor.js.map +0 -1
  451. package/lib/esm/graph/engine/loops/GraphConditionEvaluator.js +0 -80
  452. package/lib/esm/graph/engine/loops/GraphConditionEvaluator.js.map +0 -1
  453. package/lib/esm/graph/engine/loops/GraphLoopExecutionContext.js +0 -11
  454. package/lib/esm/graph/engine/loops/GraphLoopExecutionContext.js.map +0 -1
  455. package/lib/esm/graph/engine/loops/UntilGraphNodeExecutor.js +0 -97
  456. package/lib/esm/graph/engine/loops/UntilGraphNodeExecutor.js.map +0 -1
  457. package/lib/esm/graph/engine/loops/WhileGraphNodeExecutor.js +0 -98
  458. package/lib/esm/graph/engine/loops/WhileGraphNodeExecutor.js.map +0 -1
  459. package/lib/esm/graph/engine/loops/index.js +0 -12
  460. package/lib/esm/graph/engine/loops/index.js.map +0 -1
  461. package/lib/esm/graph/engine/pinning/GraphPinningDependencyResolver.js +0 -23
  462. package/lib/esm/graph/engine/pinning/GraphPinningDependencyResolver.js.map +0 -1
  463. package/lib/esm/graph/engine/pinning/GraphPinningMetadata.js +0 -15
  464. package/lib/esm/graph/engine/pinning/GraphPinningMetadata.js.map +0 -1
  465. package/lib/esm/graph/engine/pinning/GraphPinningPolicy.js +0 -29
  466. package/lib/esm/graph/engine/pinning/GraphPinningPolicy.js.map +0 -1
  467. package/lib/esm/graph/engine/pinning/GraphPinningService.js +0 -215
  468. package/lib/esm/graph/engine/pinning/GraphPinningService.js.map +0 -1
  469. package/lib/esm/graph/engine/pinning/index.js +0 -10
  470. package/lib/esm/graph/engine/pinning/index.js.map +0 -1
  471. package/lib/esm/graph/engine/planning/GraphExecutionPlan.js +0 -2
  472. package/lib/esm/graph/engine/planning/GraphExecutionPlan.js.map +0 -1
  473. package/lib/esm/graph/engine/planning/GraphExecutionPlanEdge.js +0 -9
  474. package/lib/esm/graph/engine/planning/GraphExecutionPlanEdge.js.map +0 -1
  475. package/lib/esm/graph/engine/planning/GraphExecutionPlanLayer.js +0 -2
  476. package/lib/esm/graph/engine/planning/GraphExecutionPlanLayer.js.map +0 -1
  477. package/lib/esm/graph/engine/planning/GraphExecutionPlanNode.js +0 -2
  478. package/lib/esm/graph/engine/planning/GraphExecutionPlanNode.js.map +0 -1
  479. package/lib/esm/graph/engine/planning/GraphExecutionPlanner.js +0 -183
  480. package/lib/esm/graph/engine/planning/GraphExecutionPlanner.js.map +0 -1
  481. package/lib/esm/graph/engine/planning/GraphTopology.js +0 -52
  482. package/lib/esm/graph/engine/planning/GraphTopology.js.map +0 -1
  483. package/lib/esm/graph/engine/planning/index.js +0 -12
  484. package/lib/esm/graph/engine/planning/index.js.map +0 -1
  485. package/lib/esm/graph/engine/registry/GraphNodeExecutorRegistry.js +0 -52
  486. package/lib/esm/graph/engine/registry/GraphNodeExecutorRegistry.js.map +0 -1
  487. package/lib/esm/graph/engine/registry/GraphNodeExecutorResolver.js +0 -22
  488. package/lib/esm/graph/engine/registry/GraphNodeExecutorResolver.js.map +0 -1
  489. package/lib/esm/graph/engine/registry/index.js +0 -8
  490. package/lib/esm/graph/engine/registry/index.js.map +0 -1
  491. package/lib/esm/graph/engine/runs/GraphRunEventPublisher.js +0 -64
  492. package/lib/esm/graph/engine/runs/GraphRunEventPublisher.js.map +0 -1
  493. package/lib/esm/graph/engine/runs/GraphRunExecutor.js +0 -286
  494. package/lib/esm/graph/engine/runs/GraphRunExecutor.js.map +0 -1
  495. package/lib/esm/graph/engine/runs/GraphRunFingerprint.js +0 -25
  496. package/lib/esm/graph/engine/runs/GraphRunFingerprint.js.map +0 -1
  497. package/lib/esm/graph/engine/runs/GraphRunService.js +0 -254
  498. package/lib/esm/graph/engine/runs/GraphRunService.js.map +0 -1
  499. package/lib/esm/graph/engine/runs/InMemoryGraphRunEventStore.js +0 -64
  500. package/lib/esm/graph/engine/runs/InMemoryGraphRunEventStore.js.map +0 -1
  501. package/lib/esm/graph/engine/runs/InMemoryGraphRunStore.js +0 -21
  502. package/lib/esm/graph/engine/runs/InMemoryGraphRunStore.js.map +0 -1
  503. package/lib/esm/graph/engine/runs/index.js +0 -9
  504. package/lib/esm/graph/engine/runs/index.js.map +0 -1
  505. package/lib/esm/graph/engine/runs/ownership.js +0 -30
  506. package/lib/esm/graph/engine/runs/ownership.js.map +0 -1
  507. package/lib/esm/graph/engine/runs/types.js.map +0 -1
  508. package/lib/esm/graph/engine/snapshots/GraphExecutionSnapshotMapper.js +0 -48
  509. package/lib/esm/graph/engine/snapshots/GraphExecutionSnapshotMapper.js.map +0 -1
  510. package/lib/esm/graph/engine/snapshots/index.js +0 -7
  511. package/lib/esm/graph/engine/snapshots/index.js.map +0 -1
  512. package/lib/esm/graph/engine/store/GraphCachedValue.js +0 -2
  513. package/lib/esm/graph/engine/store/GraphCachedValue.js.map +0 -1
  514. package/lib/esm/graph/engine/store/GraphValueKey.js +0 -7
  515. package/lib/esm/graph/engine/store/GraphValueKey.js.map +0 -1
  516. package/lib/esm/graph/engine/store/GraphValueStore.js +0 -71
  517. package/lib/esm/graph/engine/store/GraphValueStore.js.map +0 -1
  518. package/lib/esm/graph/engine/store/GraphValueStoreAdapter.js +0 -2
  519. package/lib/esm/graph/engine/store/GraphValueStoreAdapter.js.map +0 -1
  520. package/lib/esm/graph/engine/store/InMemoryGraphValueStoreAdapter.js +0 -64
  521. package/lib/esm/graph/engine/store/InMemoryGraphValueStoreAdapter.js.map +0 -1
  522. package/lib/esm/graph/engine/store/index.js +0 -11
  523. package/lib/esm/graph/engine/store/index.js.map +0 -1
  524. package/lib/esm/graph/engine/types.js +0 -2
  525. package/lib/esm/graph/engine/validation/GraphConnectionPolicyValidator.js +0 -137
  526. package/lib/esm/graph/engine/validation/GraphConnectionPolicyValidator.js.map +0 -1
  527. package/lib/esm/graph/engine/validation/GraphCredentialReferenceValidator.js +0 -155
  528. package/lib/esm/graph/engine/validation/GraphCredentialReferenceValidator.js.map +0 -1
  529. package/lib/esm/graph/engine/validation/GraphDefinitionValidator.js +0 -24
  530. package/lib/esm/graph/engine/validation/GraphDefinitionValidator.js.map +0 -1
  531. package/lib/esm/graph/engine/validation/GraphEdgeInstanceValidator.js +0 -161
  532. package/lib/esm/graph/engine/validation/GraphEdgeInstanceValidator.js.map +0 -1
  533. package/lib/esm/graph/engine/validation/GraphNodeInstanceValidator.js +0 -81
  534. package/lib/esm/graph/engine/validation/GraphNodeInstanceValidator.js.map +0 -1
  535. package/lib/esm/graph/engine/validation/GraphParameterValidator.js +0 -416
  536. package/lib/esm/graph/engine/validation/GraphParameterValidator.js.map +0 -1
  537. package/lib/esm/graph/engine/validation/GraphPortSchemaResolver.js +0 -53
  538. package/lib/esm/graph/engine/validation/GraphPortSchemaResolver.js.map +0 -1
  539. package/lib/esm/graph/engine/validation/GraphResolvedWorkflow.js +0 -2
  540. package/lib/esm/graph/engine/validation/GraphResolvedWorkflow.js.map +0 -1
  541. package/lib/esm/graph/engine/validation/GraphValidationErrors.js +0 -43
  542. package/lib/esm/graph/engine/validation/GraphValidationErrors.js.map +0 -1
  543. package/lib/esm/graph/engine/validation/GraphValidationIssue.js +0 -2
  544. package/lib/esm/graph/engine/validation/GraphValidationIssue.js.map +0 -1
  545. package/lib/esm/graph/engine/validation/GraphValueValidator.js +0 -47
  546. package/lib/esm/graph/engine/validation/GraphValueValidator.js.map +0 -1
  547. package/lib/esm/graph/engine/validation/GraphWorkflowDocumentValidator.js +0 -472
  548. package/lib/esm/graph/engine/validation/GraphWorkflowDocumentValidator.js.map +0 -1
  549. package/lib/esm/graph/engine/validation/index.js +0 -20
  550. package/lib/esm/graph/engine/validation/index.js.map +0 -1
  551. package/lib/esm/graph/index.js +0 -13
  552. package/lib/esm/graph/index.js.map +0 -1
  553. package/lib/esm/graph/log/GraphRunLogger.js +0 -140
  554. package/lib/esm/graph/log/GraphRunLogger.js.map +0 -1
  555. package/lib/esm/graph/log/LogParameters.js +0 -69
  556. package/lib/esm/graph/log/LogParameters.js.map +0 -1
  557. package/lib/esm/nest/graph/GraphExecutionController.js +0 -257
  558. package/lib/esm/nest/graph/GraphExecutionController.js.map +0 -1
  559. package/lib/esm/nest/graph/GraphExecutionModule.js +0 -137
  560. package/lib/esm/nest/graph/GraphExecutionModule.js.map +0 -1
  561. package/lib/esm/nest/graph/GraphExecutionResultModel.js +0 -66
  562. package/lib/esm/nest/graph/GraphExecutionResultModel.js.map +0 -1
  563. package/lib/esm/nest/graph/GraphExecutorRegistryFactory.js +0 -95
  564. package/lib/esm/nest/graph/GraphExecutorRegistryFactory.js.map +0 -1
  565. package/lib/esm/nest/graph/GraphNodeCatalogueController.js +0 -261
  566. package/lib/esm/nest/graph/GraphNodeCatalogueController.js.map +0 -1
  567. package/lib/esm/nest/graph/GraphResultService.js +0 -60
  568. package/lib/esm/nest/graph/GraphResultService.js.map +0 -1
  569. package/lib/esm/nest/graph/GraphRunController.js +0 -270
  570. package/lib/esm/nest/graph/GraphRunController.js.map +0 -1
  571. package/lib/esm/nest/graph/GraphRunModel.js +0 -74
  572. package/lib/esm/nest/graph/GraphRunModel.js.map +0 -1
  573. package/lib/esm/nest/graph/GraphRunModelService.js +0 -112
  574. package/lib/esm/nest/graph/GraphRunModelService.js.map +0 -1
  575. package/lib/esm/nest/graph/GraphWorkflowBoundaryValidation.js +0 -164
  576. package/lib/esm/nest/graph/GraphWorkflowBoundaryValidation.js.map +0 -1
  577. package/lib/esm/nest/graph/GraphWorkflowController.js +0 -153
  578. package/lib/esm/nest/graph/GraphWorkflowController.js.map +0 -1
  579. package/lib/esm/nest/graph/GraphWorkflowDocumentLimits.js +0 -8
  580. package/lib/esm/nest/graph/GraphWorkflowDocumentLimits.js.map +0 -1
  581. package/lib/esm/nest/graph/GraphWorkflowErrors.js +0 -18
  582. package/lib/esm/nest/graph/GraphWorkflowErrors.js.map +0 -1
  583. package/lib/esm/nest/graph/GraphWorkflowModel.js +0 -57
  584. package/lib/esm/nest/graph/GraphWorkflowModel.js.map +0 -1
  585. package/lib/esm/nest/graph/GraphWorkflowService.js +0 -255
  586. package/lib/esm/nest/graph/GraphWorkflowService.js.map +0 -1
  587. package/lib/esm/nest/graph/index.js +0 -16
  588. package/lib/esm/nest/graph/index.js.map +0 -1
  589. package/lib/esm/nest/graph/main.js +0 -44
  590. package/lib/esm/nest/graph/main.js.map +0 -1
  591. package/lib/types/blob/ipfs/IpfsBlobEnvironment.d.cts +0 -24
  592. package/lib/types/blob/ipfs/IpfsBlobEnvironment.d.mts +0 -24
  593. package/lib/types/blob/ipfs/IpfsBlobStoreService.d.cts +0 -61
  594. package/lib/types/blob/ipfs/IpfsBlobStoreService.d.mts +0 -61
  595. package/lib/types/blob/ipfs/IpfsKeyIndex.d.cts +0 -9
  596. package/lib/types/blob/ipfs/IpfsKeyIndex.d.mts +0 -9
  597. package/lib/types/blob/ipfs/LocalJsonIpfsKeyIndex.d.cts +0 -11
  598. package/lib/types/blob/ipfs/LocalJsonIpfsKeyIndex.d.mts +0 -11
  599. package/lib/types/blob/ipfs/MemoryIpfsKeyIndex.d.cts +0 -15
  600. package/lib/types/blob/ipfs/MemoryIpfsKeyIndex.d.mts +0 -15
  601. package/lib/types/blob/ipfs/PostgresIpfsKeyIndex.d.cts +0 -11
  602. package/lib/types/blob/ipfs/PostgresIpfsKeyIndex.d.mts +0 -11
  603. package/lib/types/blob/ipfs/index.d.cts +0 -11
  604. package/lib/types/blob/ipfs/index.d.mts +0 -11
  605. package/lib/types/graph/engine/catalog/GraphBuiltInRegistrations.d.cts +0 -17
  606. package/lib/types/graph/engine/catalog/GraphBuiltInRegistrations.d.mts +0 -17
  607. package/lib/types/graph/engine/catalog/GraphCatalogueErrors.d.cts +0 -13
  608. package/lib/types/graph/engine/catalog/GraphCatalogueErrors.d.mts +0 -13
  609. package/lib/types/graph/engine/catalog/GraphNodeCatalogue.d.cts +0 -71
  610. package/lib/types/graph/engine/catalog/GraphNodeCatalogue.d.mts +0 -71
  611. package/lib/types/graph/engine/catalog/GraphNodeManifestResolver.d.cts +0 -42
  612. package/lib/types/graph/engine/catalog/GraphNodeManifestResolver.d.mts +0 -42
  613. package/lib/types/graph/engine/catalog/GraphNodeMethodRegistry.d.cts +0 -22
  614. package/lib/types/graph/engine/catalog/GraphNodeMethodRegistry.d.mts +0 -22
  615. package/lib/types/graph/engine/catalog/GraphNodeRegistration.d.cts +0 -68
  616. package/lib/types/graph/engine/catalog/GraphNodeRegistration.d.mts +0 -68
  617. package/lib/types/graph/engine/catalog/index.d.cts +0 -6
  618. package/lib/types/graph/engine/catalog/index.d.mts +0 -6
  619. package/lib/types/graph/engine/constants.d.cts +0 -59
  620. package/lib/types/graph/engine/constants.d.mts +0 -59
  621. package/lib/types/graph/engine/decorators.d.cts +0 -6
  622. package/lib/types/graph/engine/decorators.d.mts +0 -6
  623. package/lib/types/graph/engine/errors/GraphBreakSignal.d.cts +0 -28
  624. package/lib/types/graph/engine/errors/GraphBreakSignal.d.mts +0 -28
  625. package/lib/types/graph/engine/errors/GraphCycleError.d.cts +0 -12
  626. package/lib/types/graph/engine/errors/GraphCycleError.d.mts +0 -12
  627. package/lib/types/graph/engine/errors/GraphExecutionError.d.cts +0 -19
  628. package/lib/types/graph/engine/errors/GraphExecutionError.d.mts +0 -19
  629. package/lib/types/graph/engine/errors/GraphInputError.d.cts +0 -12
  630. package/lib/types/graph/engine/errors/GraphInputError.d.mts +0 -12
  631. package/lib/types/graph/engine/errors/GraphLoopLimitError.d.cts +0 -12
  632. package/lib/types/graph/engine/errors/GraphLoopLimitError.d.mts +0 -12
  633. package/lib/types/graph/engine/errors/GraphPinningError.d.cts +0 -12
  634. package/lib/types/graph/engine/errors/GraphPinningError.d.mts +0 -12
  635. package/lib/types/graph/engine/errors/GraphPortError.d.cts +0 -12
  636. package/lib/types/graph/engine/errors/GraphPortError.d.mts +0 -12
  637. package/lib/types/graph/engine/errors/GraphRunCancelledError.d.cts +0 -9
  638. package/lib/types/graph/engine/errors/GraphRunCancelledError.d.mts +0 -9
  639. package/lib/types/graph/engine/errors/GraphStoreError.d.cts +0 -12
  640. package/lib/types/graph/engine/errors/GraphStoreError.d.mts +0 -12
  641. package/lib/types/graph/engine/errors/GraphTopologyError.d.cts +0 -12
  642. package/lib/types/graph/engine/errors/GraphTopologyError.d.mts +0 -12
  643. package/lib/types/graph/engine/errors/index.d.cts +0 -15
  644. package/lib/types/graph/engine/errors/index.d.mts +0 -15
  645. package/lib/types/graph/engine/events/GraphExecutionEventEmitter.d.cts +0 -26
  646. package/lib/types/graph/engine/events/GraphExecutionEventEmitter.d.mts +0 -26
  647. package/lib/types/graph/engine/events/GraphExecutionEventFactory.d.cts +0 -25
  648. package/lib/types/graph/engine/events/GraphExecutionEventFactory.d.mts +0 -25
  649. package/lib/types/graph/engine/events/GraphExecutionObserver.d.cts +0 -17
  650. package/lib/types/graph/engine/events/GraphExecutionObserver.d.mts +0 -17
  651. package/lib/types/graph/engine/events/index.d.cts +0 -8
  652. package/lib/types/graph/engine/events/index.d.mts +0 -8
  653. package/lib/types/graph/engine/execution/BreakGraphNodeExecutor.d.cts +0 -22
  654. package/lib/types/graph/engine/execution/BreakGraphNodeExecutor.d.mts +0 -22
  655. package/lib/types/graph/engine/execution/CodeGraphNodeExecutor.d.cts +0 -65
  656. package/lib/types/graph/engine/execution/CodeGraphNodeExecutor.d.mts +0 -65
  657. package/lib/types/graph/engine/execution/CodeSandboxEvaluator.d.cts +0 -76
  658. package/lib/types/graph/engine/execution/CodeSandboxEvaluator.d.mts +0 -76
  659. package/lib/types/graph/engine/execution/GraphExecutionContext.d.cts +0 -74
  660. package/lib/types/graph/engine/execution/GraphExecutionContext.d.mts +0 -74
  661. package/lib/types/graph/engine/execution/GraphExecutionEngine.d.cts +0 -251
  662. package/lib/types/graph/engine/execution/GraphExecutionEngine.d.mts +0 -251
  663. package/lib/types/graph/engine/execution/GraphExecutionFrame.d.cts +0 -30
  664. package/lib/types/graph/engine/execution/GraphExecutionFrame.d.mts +0 -30
  665. package/lib/types/graph/engine/execution/GraphExecutionResult.d.cts +0 -13
  666. package/lib/types/graph/engine/execution/GraphExecutionResult.d.mts +0 -13
  667. package/lib/types/graph/engine/execution/GraphNodeExecutor.d.cts +0 -31
  668. package/lib/types/graph/engine/execution/GraphNodeExecutor.d.mts +0 -31
  669. package/lib/types/graph/engine/execution/IsolatedVmCodeSandboxEvaluator.d.cts +0 -63
  670. package/lib/types/graph/engine/execution/IsolatedVmCodeSandboxEvaluator.d.mts +0 -63
  671. package/lib/types/graph/engine/execution/LogGraphNodeExecutor.d.cts +0 -25
  672. package/lib/types/graph/engine/execution/LogGraphNodeExecutor.d.mts +0 -25
  673. package/lib/types/graph/engine/execution/SwitchGraphNodeExecutor.d.cts +0 -43
  674. package/lib/types/graph/engine/execution/SwitchGraphNodeExecutor.d.mts +0 -43
  675. package/lib/types/graph/engine/execution/index.d.cts +0 -16
  676. package/lib/types/graph/engine/execution/index.d.mts +0 -16
  677. package/lib/types/graph/engine/index.d.cts +0 -63
  678. package/lib/types/graph/engine/index.d.mts +0 -63
  679. package/lib/types/graph/engine/loops/ConditionExpressionEvaluator.d.cts +0 -36
  680. package/lib/types/graph/engine/loops/ConditionExpressionEvaluator.d.mts +0 -36
  681. package/lib/types/graph/engine/loops/ForeachGraphNodeExecutor.d.cts +0 -35
  682. package/lib/types/graph/engine/loops/ForeachGraphNodeExecutor.d.mts +0 -35
  683. package/lib/types/graph/engine/loops/GraphConditionEvaluator.d.cts +0 -40
  684. package/lib/types/graph/engine/loops/GraphConditionEvaluator.d.mts +0 -40
  685. package/lib/types/graph/engine/loops/GraphLoopExecutionContext.d.cts +0 -15
  686. package/lib/types/graph/engine/loops/GraphLoopExecutionContext.d.mts +0 -15
  687. package/lib/types/graph/engine/loops/UntilGraphNodeExecutor.d.cts +0 -22
  688. package/lib/types/graph/engine/loops/UntilGraphNodeExecutor.d.mts +0 -22
  689. package/lib/types/graph/engine/loops/WhileGraphNodeExecutor.d.cts +0 -26
  690. package/lib/types/graph/engine/loops/WhileGraphNodeExecutor.d.mts +0 -26
  691. package/lib/types/graph/engine/loops/index.d.cts +0 -11
  692. package/lib/types/graph/engine/loops/index.d.mts +0 -11
  693. package/lib/types/graph/engine/pinning/GraphPinningDependencyResolver.d.cts +0 -21
  694. package/lib/types/graph/engine/pinning/GraphPinningDependencyResolver.d.mts +0 -21
  695. package/lib/types/graph/engine/pinning/GraphPinningMetadata.d.cts +0 -14
  696. package/lib/types/graph/engine/pinning/GraphPinningMetadata.d.mts +0 -14
  697. package/lib/types/graph/engine/pinning/GraphPinningPolicy.d.cts +0 -20
  698. package/lib/types/graph/engine/pinning/GraphPinningPolicy.d.mts +0 -20
  699. package/lib/types/graph/engine/pinning/GraphPinningService.d.cts +0 -70
  700. package/lib/types/graph/engine/pinning/GraphPinningService.d.mts +0 -70
  701. package/lib/types/graph/engine/pinning/index.d.cts +0 -9
  702. package/lib/types/graph/engine/pinning/index.d.mts +0 -9
  703. package/lib/types/graph/engine/planning/GraphExecutionPlan.d.cts +0 -25
  704. package/lib/types/graph/engine/planning/GraphExecutionPlan.d.mts +0 -25
  705. package/lib/types/graph/engine/planning/GraphExecutionPlanEdge.d.cts +0 -26
  706. package/lib/types/graph/engine/planning/GraphExecutionPlanEdge.d.mts +0 -26
  707. package/lib/types/graph/engine/planning/GraphExecutionPlanLayer.d.cts +0 -13
  708. package/lib/types/graph/engine/planning/GraphExecutionPlanLayer.d.mts +0 -13
  709. package/lib/types/graph/engine/planning/GraphExecutionPlanNode.d.cts +0 -28
  710. package/lib/types/graph/engine/planning/GraphExecutionPlanNode.d.mts +0 -28
  711. package/lib/types/graph/engine/planning/GraphExecutionPlanner.d.cts +0 -48
  712. package/lib/types/graph/engine/planning/GraphExecutionPlanner.d.mts +0 -48
  713. package/lib/types/graph/engine/planning/GraphTopology.d.cts +0 -23
  714. package/lib/types/graph/engine/planning/GraphTopology.d.mts +0 -23
  715. package/lib/types/graph/engine/planning/index.d.cts +0 -11
  716. package/lib/types/graph/engine/planning/index.d.mts +0 -11
  717. package/lib/types/graph/engine/registry/GraphNodeExecutorRegistry.d.cts +0 -39
  718. package/lib/types/graph/engine/registry/GraphNodeExecutorRegistry.d.mts +0 -39
  719. package/lib/types/graph/engine/registry/GraphNodeExecutorResolver.d.cts +0 -21
  720. package/lib/types/graph/engine/registry/GraphNodeExecutorResolver.d.mts +0 -21
  721. package/lib/types/graph/engine/registry/index.d.cts +0 -7
  722. package/lib/types/graph/engine/registry/index.d.mts +0 -7
  723. package/lib/types/graph/engine/runs/GraphRunEventPublisher.d.cts +0 -26
  724. package/lib/types/graph/engine/runs/GraphRunEventPublisher.d.mts +0 -26
  725. package/lib/types/graph/engine/runs/GraphRunExecutor.d.cts +0 -75
  726. package/lib/types/graph/engine/runs/GraphRunExecutor.d.mts +0 -75
  727. package/lib/types/graph/engine/runs/GraphRunFingerprint.d.cts +0 -8
  728. package/lib/types/graph/engine/runs/GraphRunFingerprint.d.mts +0 -8
  729. package/lib/types/graph/engine/runs/GraphRunService.d.cts +0 -93
  730. package/lib/types/graph/engine/runs/GraphRunService.d.mts +0 -93
  731. package/lib/types/graph/engine/runs/InMemoryGraphRunEventStore.d.cts +0 -28
  732. package/lib/types/graph/engine/runs/InMemoryGraphRunEventStore.d.mts +0 -28
  733. package/lib/types/graph/engine/runs/InMemoryGraphRunStore.d.cts +0 -12
  734. package/lib/types/graph/engine/runs/InMemoryGraphRunStore.d.mts +0 -12
  735. package/lib/types/graph/engine/runs/index.d.cts +0 -8
  736. package/lib/types/graph/engine/runs/index.d.mts +0 -8
  737. package/lib/types/graph/engine/runs/ownership.d.cts +0 -25
  738. package/lib/types/graph/engine/runs/ownership.d.mts +0 -25
  739. package/lib/types/graph/engine/runs/types.d.cts +0 -83
  740. package/lib/types/graph/engine/runs/types.d.mts +0 -83
  741. package/lib/types/graph/engine/snapshots/GraphExecutionSnapshotMapper.d.cts +0 -10
  742. package/lib/types/graph/engine/snapshots/GraphExecutionSnapshotMapper.d.mts +0 -10
  743. package/lib/types/graph/engine/snapshots/index.d.cts +0 -6
  744. package/lib/types/graph/engine/snapshots/index.d.mts +0 -6
  745. package/lib/types/graph/engine/store/GraphCachedValue.d.cts +0 -20
  746. package/lib/types/graph/engine/store/GraphCachedValue.d.mts +0 -20
  747. package/lib/types/graph/engine/store/GraphValueKey.d.cts +0 -18
  748. package/lib/types/graph/engine/store/GraphValueKey.d.mts +0 -18
  749. package/lib/types/graph/engine/store/GraphValueStore.d.cts +0 -41
  750. package/lib/types/graph/engine/store/GraphValueStore.d.mts +0 -41
  751. package/lib/types/graph/engine/store/GraphValueStoreAdapter.d.cts +0 -32
  752. package/lib/types/graph/engine/store/GraphValueStoreAdapter.d.mts +0 -32
  753. package/lib/types/graph/engine/store/InMemoryGraphValueStoreAdapter.d.cts +0 -33
  754. package/lib/types/graph/engine/store/InMemoryGraphValueStoreAdapter.d.mts +0 -33
  755. package/lib/types/graph/engine/store/index.d.cts +0 -10
  756. package/lib/types/graph/engine/store/index.d.mts +0 -10
  757. package/lib/types/graph/engine/types.d.cts +0 -208
  758. package/lib/types/graph/engine/types.d.mts +0 -208
  759. package/lib/types/graph/engine/validation/GraphConnectionPolicyValidator.d.cts +0 -32
  760. package/lib/types/graph/engine/validation/GraphConnectionPolicyValidator.d.mts +0 -32
  761. package/lib/types/graph/engine/validation/GraphCredentialReferenceValidator.d.cts +0 -62
  762. package/lib/types/graph/engine/validation/GraphCredentialReferenceValidator.d.mts +0 -62
  763. package/lib/types/graph/engine/validation/GraphDefinitionValidator.d.cts +0 -23
  764. package/lib/types/graph/engine/validation/GraphDefinitionValidator.d.mts +0 -23
  765. package/lib/types/graph/engine/validation/GraphEdgeInstanceValidator.d.cts +0 -32
  766. package/lib/types/graph/engine/validation/GraphEdgeInstanceValidator.d.mts +0 -32
  767. package/lib/types/graph/engine/validation/GraphNodeInstanceValidator.d.cts +0 -37
  768. package/lib/types/graph/engine/validation/GraphNodeInstanceValidator.d.mts +0 -37
  769. package/lib/types/graph/engine/validation/GraphParameterValidator.d.cts +0 -92
  770. package/lib/types/graph/engine/validation/GraphParameterValidator.d.mts +0 -92
  771. package/lib/types/graph/engine/validation/GraphPortSchemaResolver.d.cts +0 -39
  772. package/lib/types/graph/engine/validation/GraphPortSchemaResolver.d.mts +0 -39
  773. package/lib/types/graph/engine/validation/GraphResolvedWorkflow.d.cts +0 -66
  774. package/lib/types/graph/engine/validation/GraphResolvedWorkflow.d.mts +0 -66
  775. package/lib/types/graph/engine/validation/GraphValidationErrors.d.cts +0 -34
  776. package/lib/types/graph/engine/validation/GraphValidationErrors.d.mts +0 -34
  777. package/lib/types/graph/engine/validation/GraphValidationIssue.d.cts +0 -39
  778. package/lib/types/graph/engine/validation/GraphValidationIssue.d.mts +0 -39
  779. package/lib/types/graph/engine/validation/GraphValueValidator.d.cts +0 -27
  780. package/lib/types/graph/engine/validation/GraphValueValidator.d.mts +0 -27
  781. package/lib/types/graph/engine/validation/GraphWorkflowDocumentValidator.d.cts +0 -162
  782. package/lib/types/graph/engine/validation/GraphWorkflowDocumentValidator.d.mts +0 -162
  783. package/lib/types/graph/engine/validation/index.d.cts +0 -19
  784. package/lib/types/graph/engine/validation/index.d.mts +0 -19
  785. package/lib/types/graph/index.d.cts +0 -12
  786. package/lib/types/graph/index.d.mts +0 -12
  787. package/lib/types/graph/log/GraphRunLogger.d.cts +0 -76
  788. package/lib/types/graph/log/GraphRunLogger.d.mts +0 -76
  789. package/lib/types/graph/log/LogParameters.d.cts +0 -7
  790. package/lib/types/graph/log/LogParameters.d.mts +0 -7
  791. package/lib/types/nest/graph/GraphExecutionController.d.cts +0 -110
  792. package/lib/types/nest/graph/GraphExecutionController.d.mts +0 -110
  793. package/lib/types/nest/graph/GraphExecutionModule.d.cts +0 -83
  794. package/lib/types/nest/graph/GraphExecutionModule.d.mts +0 -83
  795. package/lib/types/nest/graph/GraphExecutionResultModel.d.cts +0 -24
  796. package/lib/types/nest/graph/GraphExecutionResultModel.d.mts +0 -24
  797. package/lib/types/nest/graph/GraphExecutorRegistryFactory.d.cts +0 -66
  798. package/lib/types/nest/graph/GraphExecutorRegistryFactory.d.mts +0 -66
  799. package/lib/types/nest/graph/GraphNodeCatalogueController.d.cts +0 -70
  800. package/lib/types/nest/graph/GraphNodeCatalogueController.d.mts +0 -70
  801. package/lib/types/nest/graph/GraphResultService.d.cts +0 -20
  802. package/lib/types/nest/graph/GraphResultService.d.mts +0 -20
  803. package/lib/types/nest/graph/GraphRunController.d.cts +0 -87
  804. package/lib/types/nest/graph/GraphRunController.d.mts +0 -87
  805. package/lib/types/nest/graph/GraphRunModel.d.cts +0 -22
  806. package/lib/types/nest/graph/GraphRunModel.d.mts +0 -22
  807. package/lib/types/nest/graph/GraphRunModelService.d.cts +0 -21
  808. package/lib/types/nest/graph/GraphRunModelService.d.mts +0 -21
  809. package/lib/types/nest/graph/GraphWorkflowBoundaryValidation.d.cts +0 -28
  810. package/lib/types/nest/graph/GraphWorkflowBoundaryValidation.d.mts +0 -28
  811. package/lib/types/nest/graph/GraphWorkflowController.d.cts +0 -62
  812. package/lib/types/nest/graph/GraphWorkflowController.d.mts +0 -62
  813. package/lib/types/nest/graph/GraphWorkflowDocumentLimits.d.cts +0 -33
  814. package/lib/types/nest/graph/GraphWorkflowDocumentLimits.d.mts +0 -33
  815. package/lib/types/nest/graph/GraphWorkflowErrors.d.cts +0 -13
  816. package/lib/types/nest/graph/GraphWorkflowErrors.d.mts +0 -13
  817. package/lib/types/nest/graph/GraphWorkflowModel.d.cts +0 -24
  818. package/lib/types/nest/graph/GraphWorkflowModel.d.mts +0 -24
  819. package/lib/types/nest/graph/GraphWorkflowService.d.cts +0 -54
  820. package/lib/types/nest/graph/GraphWorkflowService.d.mts +0 -54
  821. package/lib/types/nest/graph/index.d.cts +0 -15
  822. package/lib/types/nest/graph/index.d.mts +0 -15
  823. package/lib/types/nest/graph/main.d.cts +0 -1
  824. package/lib/types/nest/graph/main.d.mts +0 -1
  825. /package/lib/cjs/{graph/engine/runs → redis}/types.cjs +0 -0
  826. /package/lib/esm/{graph/engine/runs → redis}/types.js +0 -0
@@ -1,2 +1,2 @@
1
- import{exec as e}from"child_process";import{LogLevel as t,LoggedEnvironment as i}from"@decaf-ts/logging";import{InternalError as r,NotFoundError as n}from"@decaf-ts/db-decorators";import{Cascade as s,ModelService as o,pk as a,uuid as d,manyToOne as p,column as c,createdAt as y,updatedAt as l,table as u,unique as g,oneToMany as h,transactional as m,AuthorizationError as f,BaseModel as v,repository as w,service as b,Repository as S,Condition as A}from"@decaf-ts/core";export{AuthorizationError,transactional}from"@decaf-ts/core";import{Model as O,required as I,type as _,option as j,model as U}from"@decaf-ts/decorator-validation";import{__decorate as P,__metadata as K}from"tslib";import{Metadata as k,metadata as F,methodMetadata as R,propMetadata as T}from"@decaf-ts/decoration";async function x(i,n,s,o=t.info){return s.debug("Executing: "+i),new Promise((t,a)=>{const d=e(i,n),p=[],c=[];d.stdout?.on("data",e=>{p.push(e),s[o](e.trim())}),d.stderr?.on("data",e=>{c.push(e),s.debug(e.trim())}),d.on("close",e=>{0===e?(s.silly("Command completed successfully"),t({stdout:p.join("\n"),stderr:c.join("\n")})):(s.critical(`Command failed with code ${e}:\n ${c.join("\n")}`),a(new r(`Command failed with code ${e}: ${c.join("\n")}`)))}),d.on("error",e=>{s.critical("Command execution error",e),a(e)})})}var B,D,C,G,E,N,$,L;(e=>{e.Pooled="pooled",e.Bridge="bridge",e.Silo="silo"})(B||(B={})),(e=>{e.Invited="invited",e.Active="active",e.Suspended="suspended",e.Removed="removed"})(D||(D={})),(e=>{e.User="user",e.Group="group",e.ServiceAccount="service_account",e.Agent="agent",e.ApiKey="api_key"})(C||(C={})),(e=>{e.Tenant="tenant",e.OrgUnit="org_unit",e.Resource="resource"})(G||(G={})),(e=>{e.Admin="admin",e.ContentRead="content_read",e.ContentWrite="content_write",e.Memory="memory",e.Graph="graph",e.Vector="vector",e.Export="export",e.Billing="billing",e.Audit="audit",e.Security="security",e.Data="data",e.Automation="automation"})(E||(E={})),(e=>{e.Private="private",e.ResourceAcl="resource_acl",e.OrgUnit="org_unit",e.OrgSubtree="org_subtree",e.Tenant="tenant"})(N||(N={})),(e=>{e.Postgres="postgres",e.Arango="arango",e.Qdrant="qdrant",e.ObjectStorage="object_storage"})($||($={})),(e=>{e.Shared="shared",e.Dedicated="dedicated"})(L||(L={}));const z=Object.values(B),M=Object.values(D),q=Object.values(C),W=Object.values(G),V=Object.values(E),Z=Object.values(N),Q=Object.values($),J=Object.values(L),H={update:s.NONE,delete:s.NONE,nullable:!1},X={update:s.NONE,delete:s.NONE,nullable:!0},Y={update:s.CASCADE,delete:s.CASCADE,nullable:!1},ee={update:s.CASCADE,delete:s.NONE,nullable:!1};function te(e){return{tenantId:e.tenantId,principalId:e.principalId,permissionKey:e.permissionKey,allowedOrgUnitIds:[...e.allowedOrgUnitIds],allowedResourceIds:[...e.allowedResourceIds]}}function ie(e){return{must:[{key:"tenant_id",match:{value:e.tenantId}},{should:[{key:"org_unit_id",match:{any:e.allowedOrgUnitIds}},{key:"protected_resource_id",match:{any:e.allowedResourceIds}},{key:"owner_principal_id",match:{value:e.principalId}}]}]}}function re(e,t){return`${e}:${t}`}function ne(){return new Date}function se(e){return e??[]}function oe(e,t){return ue(e)===t}function ae(e,t){return!!t&&ue(e)===t}function de(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"item"}function pe(e,t,i){const r=e??new Date;return!(t&&t>r||i&&r>i)}function ce(e){const t={},i={};for(const r of e.permissions){const e=re(r.scopeKind,r.scopeId);t[e]=t[e]??[],t[e].push(r.permissionKey),r.scopeKind===G.OrgUnit&&(i[r.permissionKey]=i[r.permissionKey]??[],i[r.permissionKey].push(r.scopeId))}return{tenantId:e.tenantId,principalId:e.principalId,permissionsByScope:t,allowedOrgUnitIdsByPermission:i,resourceGrants:e.grants.map(e=>({resourceId:e.resourceId,permissionKey:e.permissionKey}))}}class ye extends o{constructor(e){super(e)}newModel(e,t){return Object.assign(new e,t)}async create(e,...t){return this.repo.create(Object.assign({},e),...t)}async createOne(e,...t){return this.create(e,...t)}async getById(e,...t){return this.repo.read(e,...t)}async updateOne(e,t,...i){const r=await this.repo.read(e,...i);return this.repo.update(Object.assign(r,t),...i)}async deleteById(e,...t){await this.repo.delete(e,...t)}async findOneBy(e,t,...i){return this.repo.findOneBy(e,t,...i)}async findManyBy(e,t,...i){return this.repo.select().where({[e]:t}).execute(...i)}async listAll(...e){return this.repo.select().execute(...e)}}function le(){return crypto.randomUUID()}function ue(e){return"string"==typeof e?e:e.id}class ge extends O{constructor(e){super(e)}}let he=class extends ge{constructor(e){super(e)}};P([a({type:String}),d(),K("design:type",String)],he.prototype,"id",void 0),P([p(()=>Ke,Y,!1,void 0,"fk_tenant_memberships_tenant"),I(),K("design:type",Object)],he.prototype,"tenant",void 0),P([p(()=>me,Y,!1,void 0,"fk_tenant_memberships_user"),I(),K("design:type",Object)],he.prototype,"user",void 0),P([I(),_(String),j(M),c(),K("design:type",String)],he.prototype,"status",void 0),P([y(),K("design:type",Date)],he.prototype,"createdAt",void 0),P([l(),K("design:type",Date)],he.prototype,"updatedAt",void 0),he=P([u("tenant_memberships"),U(),K("design:paramtypes",[Object])],he);let me=class extends ge{constructor(e){super(e)}};P([a({type:String}),d(),K("design:type",String)],me.prototype,"id",void 0),P([g(),_(String),c(),K("design:type",String)],me.prototype,"email",void 0),P([g(),_(String),c(),K("design:type",String)],me.prototype,"phone",void 0),P([I(),_(String),c(),K("design:type",String)],me.prototype,"displayName",void 0),P([h(()=>he,H,!1),K("design:type",Array)],me.prototype,"tenantMemberships",void 0),P([h(()=>fe,H,!1),K("design:type",Array)],me.prototype,"orgUnitMemberships",void 0),P([y(),K("design:type",Date)],me.prototype,"createdAt",void 0),P([l(),K("design:type",Date)],me.prototype,"updatedAt",void 0),me=P([u("users"),U(),K("design:paramtypes",[Object])],me);let fe=class extends ge{constructor(e){super(e)}};P([a({type:String}),d(),K("design:type",String)],fe.prototype,"id",void 0),P([p(()=>Ke,Y,!1,void 0,"fk_org_memberships_tenant"),I(),K("design:type",Object)],fe.prototype,"tenant",void 0),P([p(()=>Ue,Y,!1,void 0,"fk_org_memberships_org_unit"),I(),K("design:type",Object)],fe.prototype,"orgUnit",void 0),P([p(()=>me,H,!1,void 0,"fk_org_memberships_user"),I(),K("design:type",Object)],fe.prototype,"user",void 0),P([I(),_(String),j(M),c(),K("design:type",String)],fe.prototype,"status",void 0),P([y(),K("design:type",Date)],fe.prototype,"createdAt",void 0),P([l(),K("design:type",Date)],fe.prototype,"updatedAt",void 0),fe=P([u("org_unit_memberships"),U(),K("design:paramtypes",[Object])],fe);let ve=class extends ge{constructor(e){super(e)}};P([a({type:String}),d(),K("design:type",String)],ve.prototype,"id",void 0),P([p(()=>Ke,Y,!1,void 0,"fk_org_closure_tenant"),I(),K("design:type",Object)],ve.prototype,"tenant",void 0),P([p(()=>Ue,Y,!1,void 0,"fk_org_closure_ancestor"),I(),K("design:type",Object)],ve.prototype,"ancestor",void 0),P([p(()=>Ue,Y,!1,void 0,"fk_org_closure_descendant"),I(),K("design:type",Object)],ve.prototype,"descendant",void 0),P([I(),_(Number),c(),K("design:type",Number)],ve.prototype,"depth",void 0),P([y(),K("design:type",Date)],ve.prototype,"createdAt",void 0),ve=P([u("org_unit_closure"),U(),K("design:paramtypes",[Object])],ve);let we=class extends ge{constructor(e){super(e)}};P([a({type:String}),d(),K("design:type",String)],we.prototype,"id",void 0),P([g(),I(),_(String),c(),K("design:type",String)],we.prototype,"key",void 0),P([I(),_(String),j(V),c(),K("design:type",String)],we.prototype,"category",void 0),P([_(String),c(),K("design:type",String)],we.prototype,"description",void 0),P([h(()=>be,H,!1),K("design:type",Array)],we.prototype,"rolePermissions",void 0),we=P([u("permissions"),U(),K("design:paramtypes",[Object])],we);let be=class extends ge{constructor(e){super(e)}};P([a({type:String}),d(),K("design:type",String)],be.prototype,"id",void 0),P([p(()=>Se,Y,!1,void 0,"fk_role_permissions_role"),I(),K("design:type",Object)],be.prototype,"role",void 0),P([p(()=>we,Y,!1,void 0,"fk_role_permissions_permission"),I(),K("design:type",Object)],be.prototype,"permission",void 0),P([y(),K("design:type",Date)],be.prototype,"createdAt",void 0),be=P([u("role_permissions"),U(),K("design:paramtypes",[Object])],be);let Se=class extends ge{constructor(e){super(e)}};P([a({type:String}),d(),K("design:type",String)],Se.prototype,"id",void 0),P([p(()=>Ke,X,!1,void 0,"fk_roles_tenant"),K("design:type",Object)],Se.prototype,"tenant",void 0),P([I(),_(String),c(),K("design:type",String)],Se.prototype,"key",void 0),P([I(),_(String),c(),K("design:type",String)],Se.prototype,"name",void 0),P([_(String),c(),K("design:type",String)],Se.prototype,"description",void 0),P([_(Object),c(),K("design:type",Object)],Se.prototype,"metadata",void 0),P([h(()=>be,H,!1),K("design:type",Array)],Se.prototype,"rolePermissions",void 0),P([h(()=>Ae,H,!1),K("design:type",Array)],Se.prototype,"assignments",void 0),P([y(),K("design:type",Date)],Se.prototype,"createdAt",void 0),P([l(),K("design:type",Date)],Se.prototype,"updatedAt",void 0),Se=P([u("roles"),U(),K("design:paramtypes",[Object])],Se);let Ae=class extends ge{constructor(e){super(e)}};P([a({type:String}),d(),K("design:type",String)],Ae.prototype,"id",void 0),P([p(()=>Ke,Y,!1,void 0,"fk_role_assignments_tenant"),I(),K("design:type",Object)],Ae.prototype,"tenant",void 0),P([p(()=>Ie,Y,!1,void 0,"fk_role_assignments_principal"),I(),K("design:type",Object)],Ae.prototype,"principal",void 0),P([p(()=>Se,H,!1,void 0,"fk_role_assignments_role"),I(),K("design:type",Object)],Ae.prototype,"role",void 0),P([I(),_(String),j(W),c(),K("design:type",String)],Ae.prototype,"scopeKind",void 0),P([I(),_(String),c(),K("design:type",String)],Ae.prototype,"scopeId",void 0),P([I(),_(Boolean),c(),K("design:type",Boolean)],Ae.prototype,"inheritDown",void 0),P([c(),K("design:type",Date)],Ae.prototype,"startsAt",void 0),P([c(),K("design:type",Date)],Ae.prototype,"expiresAt",void 0),P([_(Object),c(),K("design:type",Object)],Ae.prototype,"conditions",void 0),P([y(),K("design:type",Date)],Ae.prototype,"createdAt",void 0),P([l(),K("design:type",Date)],Ae.prototype,"updatedAt",void 0),Ae=P([u("role_assignments"),U(),K("design:paramtypes",[Object])],Ae);let Oe=class extends ge{constructor(e){super(e)}};P([a({type:String}),d(),K("design:type",String)],Oe.prototype,"id",void 0),P([p(()=>Ke,Y,!1,void 0,"fk_resource_grants_tenant"),I(),K("design:type",Object)],Oe.prototype,"tenant",void 0),P([p(()=>_e,Y,!1,void 0,"fk_resource_grants_resource"),I(),K("design:type",Object)],Oe.prototype,"resource",void 0),P([p(()=>Ie,Y,!1,void 0,"fk_resource_grants_principal"),I(),K("design:type",Object)],Oe.prototype,"principal",void 0),P([I(),_(String),c(),K("design:type",String)],Oe.prototype,"permissionKey",void 0),P([c(),K("design:type",Date)],Oe.prototype,"startsAt",void 0),P([c(),K("design:type",Date)],Oe.prototype,"expiresAt",void 0),P([_(Object),c(),K("design:type",Object)],Oe.prototype,"conditions",void 0),P([p(()=>Ie,H,!1,void 0,"fk_resource_grants_created_by"),K("design:type",Object)],Oe.prototype,"createdBy",void 0),P([y(),K("design:type",Date)],Oe.prototype,"createdAt",void 0),P([l(),K("design:type",Date)],Oe.prototype,"updatedAt",void 0),Oe=P([u("resource_grants"),U(),K("design:paramtypes",[Object])],Oe);let Ie=class extends ge{constructor(e){super(e)}};P([a({type:String}),d(),K("design:type",String)],Ie.prototype,"id",void 0),P([p(()=>Ke,H,!1,void 0,"fk_principals_tenant"),I(),K("design:type",Object)],Ie.prototype,"tenant",void 0),P([I(),_(String),j(q),c(),K("design:type",String)],Ie.prototype,"kind",void 0),P([I(),_(String),c(),K("design:type",String)],Ie.prototype,"subjectId",void 0),P([h(()=>Ae,H,!1),K("design:type",Array)],Ie.prototype,"roleAssignments",void 0),P([h(()=>Oe,H,!1),K("design:type",Array)],Ie.prototype,"resourceGrants",void 0),P([y(),K("design:type",Date)],Ie.prototype,"createdAt",void 0),P([l(),K("design:type",Date)],Ie.prototype,"updatedAt",void 0),Ie=P([u("principals"),U(),K("design:paramtypes",[Object])],Ie);let _e=class extends ge{constructor(e){super(e)}};P([a({type:String}),d(),K("design:type",String)],_e.prototype,"id",void 0),P([p(()=>Ke,H,!1,void 0,"fk_protected_resources_tenant"),I(),K("design:type",Object)],_e.prototype,"tenant",void 0),P([p(()=>Ue,H,!1,void 0,"fk_protected_resources_org_unit"),I(),K("design:type",Object)],_e.prototype,"orgUnit",void 0),P([I(),_(String),c(),K("design:type",String)],_e.prototype,"resourceType",void 0),P([I(),_(String),c(),K("design:type",String)],_e.prototype,"resourceId",void 0),P([I(),_(String),j(Z),c(),K("design:type",String)],_e.prototype,"visibility",void 0),P([p(()=>Ie,X,!1,void 0,"fk_protected_resources_owner"),K("design:type",Object)],_e.prototype,"owner",void 0),P([_(String),c(),K("design:type",String)],_e.prototype,"sensitivity",void 0),P([_(Object),c(),K("design:type",Object)],_e.prototype,"metadata",void 0),P([h(()=>Oe,H,!1),K("design:type",Array)],_e.prototype,"grants",void 0),P([y(),K("design:type",Date)],_e.prototype,"createdAt",void 0),P([l(),K("design:type",Date)],_e.prototype,"updatedAt",void 0),_e=P([u("protected_resources"),U(),K("design:paramtypes",[Object])],_e);let je=class extends ge{constructor(e){super(e)}};P([a({type:String}),d(),K("design:type",String)],je.prototype,"id",void 0),P([p(()=>Ke,Y,!1,void 0,"fk_inheritance_blocks_tenant"),I(),K("design:type",Object)],je.prototype,"tenant",void 0),P([p(()=>Ue,Y,!1,void 0,"fk_inheritance_blocks_org_unit"),I(),K("design:type",Object)],je.prototype,"orgUnit",void 0),P([p(()=>Ue,X,!1,void 0,"fk_inheritance_blocks_blocked_ancestor"),K("design:type",Object)],je.prototype,"blockedFromAncestor",void 0),P([I(),_(String),j(V),c(),K("design:type",String)],je.prototype,"permissionCategory",void 0),P([_(String),c(),K("design:type",String)],je.prototype,"reason",void 0),P([y(),K("design:type",Date)],je.prototype,"createdAt",void 0),P([l(),K("design:type",Date)],je.prototype,"updatedAt",void 0),je=P([u("inheritance_blocks"),U(),K("design:paramtypes",[Object])],je);let Ue=class extends ge{constructor(e){super(e)}};P([a({type:String}),d(),K("design:type",String)],Ue.prototype,"id",void 0),P([p(()=>Ke,H,!1,void 0,"fk_org_units_tenant"),I(),K("design:type",Object)],Ue.prototype,"tenant",void 0),P([p(()=>Ue,H,!1,void 0,"fk_org_units_parent"),K("design:type",Object)],Ue.prototype,"parent",void 0),P([h(()=>Ue,H,!1),K("design:type",Array)],Ue.prototype,"children",void 0),P([I(),_(String),c(),K("design:type",String)],Ue.prototype,"name",void 0),P([I(),_(String),c(),K("design:type",String)],Ue.prototype,"path",void 0),P([_(Object),c(),K("design:type",Object)],Ue.prototype,"metadata",void 0),P([h(()=>fe,H,!1),K("design:type",Array)],Ue.prototype,"memberships",void 0),P([h(()=>_e,H,!1),K("design:type",Array)],Ue.prototype,"resources",void 0),P([h(()=>je,H,!1),K("design:type",Array)],Ue.prototype,"inheritanceBlocks",void 0),P([h(()=>ve,H,!1),K("design:type",Array)],Ue.prototype,"ancestorLinks",void 0),P([h(()=>ve,H,!1),K("design:type",Array)],Ue.prototype,"descendantLinks",void 0),P([y(),K("design:type",Date)],Ue.prototype,"createdAt",void 0),P([l(),K("design:type",Date)],Ue.prototype,"updatedAt",void 0),Ue=P([u("org_units"),U(),K("design:paramtypes",[Object])],Ue);let Pe=class extends ge{constructor(e){super(e)}};P([a({type:String}),d(),K("design:type",String)],Pe.prototype,"id",void 0),P([p(()=>Ke,Y,!1,void 0,"fk_storage_bindings_tenant"),I(),K("design:type",Object)],Pe.prototype,"tenant",void 0),P([I(),_(String),j(Q),c(),K("design:type",String)],Pe.prototype,"storageKind",void 0),P([I(),_(String),j(J),c(),K("design:type",String)],Pe.prototype,"bindingKind",void 0),P([I(),_(String),c(),K("design:type",String)],Pe.prototype,"bindingKey",void 0),P([I(),_(String),c(),K("design:type",String)],Pe.prototype,"region",void 0),P([_(Object),c(),K("design:type",Object)],Pe.prototype,"config",void 0),P([y(),K("design:type",Date)],Pe.prototype,"createdAt",void 0),P([l(),K("design:type",Date)],Pe.prototype,"updatedAt",void 0),Pe=P([u("storage_bindings"),U(),K("design:paramtypes",[Object])],Pe);let Ke=class extends ge{constructor(e){super(e)}};P([a({type:String}),d(),K("design:type",String)],Ke.prototype,"id",void 0),P([g(),I(),_(String),c(),K("design:type",String)],Ke.prototype,"slug",void 0),P([I(),_(String),c(),K("design:type",String)],Ke.prototype,"name",void 0),P([I(),_(String),j(z),c(),K("design:type",String)],Ke.prototype,"isolationTier",void 0),P([h(()=>Ue,H,!1),K("design:type",Array)],Ke.prototype,"orgUnits",void 0),P([h(()=>he,H,!1),K("design:type",Array)],Ke.prototype,"memberships",void 0),P([h(()=>Ie,H,!1),K("design:type",Array)],Ke.prototype,"principals",void 0),P([h(()=>Pe,H,!1),K("design:type",Array)],Ke.prototype,"storageBindings",void 0),P([y(),K("design:type",Date)],Ke.prototype,"createdAt",void 0),P([l(),K("design:type",Date)],Ke.prototype,"updatedAt",void 0),Ke=P([u("tenants"),U(),K("design:paramtypes",[Object])],Ke);let ke=class extends ge{constructor(e){super(e)}};P([a({type:String}),d(),K("design:type",String)],ke.prototype,"id",void 0),P([p(()=>Ke,Y,!1,void 0,"fk_tenant_profiles_tenant"),I(),K("design:type",Object)],ke.prototype,"tenant",void 0),P([I(),_(String),c(),K("design:type",String)],ke.prototype,"profileKey",void 0),P([_(Object),c(),K("design:type",Object)],ke.prototype,"metadata",void 0),P([y(),K("design:type",Date)],ke.prototype,"createdAt",void 0),P([l(),K("design:type",Date)],ke.prototype,"updatedAt",void 0),ke=P([u("tenant_profiles"),U(),K("design:paramtypes",[Object])],ke);let Fe=class extends ge{constructor(e){super(e)}};P([a({type:String}),d(),K("design:type",String)],Fe.prototype,"id",void 0),P([p(()=>Ue,Y,!1,void 0,"fk_org_unit_profiles_org_unit"),I(),K("design:type",Object)],Fe.prototype,"orgUnit",void 0),P([I(),_(String),c(),K("design:type",String)],Fe.prototype,"profileKey",void 0),P([_(Object),c(),K("design:type",Object)],Fe.prototype,"metadata",void 0),P([y(),K("design:type",Date)],Fe.prototype,"createdAt",void 0),P([l(),K("design:type",Date)],Fe.prototype,"updatedAt",void 0),Fe=P([u("org_unit_profiles"),U(),K("design:paramtypes",[Object])],Fe);let Re=class extends ge{constructor(e){super(e)}};P([a({type:String}),d(),K("design:type",String)],Re.prototype,"id",void 0),P([p(()=>Ke,Y,!1,void 0,"fk_group_memberships_tenant"),I(),K("design:type",Object)],Re.prototype,"tenant",void 0),P([p(()=>Te,Y,!1,void 0,"fk_group_memberships_group"),I(),K("design:type",Object)],Re.prototype,"group",void 0),P([p(()=>Ie,Y,!1,void 0,"fk_group_memberships_principal"),I(),K("design:type",Object)],Re.prototype,"principal",void 0),P([_(Object),c(),K("design:type",Object)],Re.prototype,"metadata",void 0),P([y(),K("design:type",Date)],Re.prototype,"createdAt",void 0),Re=P([u("group_memberships"),U(),K("design:paramtypes",[Object])],Re);let Te=class extends ge{constructor(e){super(e)}};P([a({type:String}),d(),K("design:type",String)],Te.prototype,"id",void 0),P([p(()=>Ke,H,!1,void 0,"fk_groups_tenant"),I(),K("design:type",Object)],Te.prototype,"tenant",void 0),P([p(()=>Ue,X,!1,void 0,"fk_groups_org_unit"),K("design:type",Object)],Te.prototype,"orgUnit",void 0),P([I(),_(String),c(),K("design:type",String)],Te.prototype,"name",void 0),P([_(Object),c(),K("design:type",Object)],Te.prototype,"metadata",void 0),P([h(()=>Re,H,!1),K("design:type",Array)],Te.prototype,"members",void 0),P([y(),K("design:type",Date)],Te.prototype,"createdAt",void 0),P([l(),K("design:type",Date)],Te.prototype,"updatedAt",void 0),Te=P([u("groups"),U(),K("design:paramtypes",[Object])],Te);let xe=class extends ge{constructor(e){super(e)}};P([a({type:String}),d(),K("design:type",String)],xe.prototype,"id",void 0),P([p(()=>Ke,Y,!1,void 0,"fk_effective_permissions_tenant"),I(),K("design:type",Object)],xe.prototype,"tenant",void 0),P([p(()=>Ie,Y,!1,void 0,"fk_effective_permissions_principal"),I(),K("design:type",Object)],xe.prototype,"principal",void 0),P([I(),_(String),c(),K("design:type",String)],xe.prototype,"permissionKey",void 0),P([I(),_(String),j(W),c(),K("design:type",String)],xe.prototype,"scopeKind",void 0),P([I(),_(String),c(),K("design:type",String)],xe.prototype,"scopeId",void 0),P([I(),_(String),c(),K("design:type",String)],xe.prototype,"sourceKind",void 0),P([I(),_(String),c(),K("design:type",String)],xe.prototype,"sourceId",void 0),P([c(),K("design:type",Date)],xe.prototype,"startsAt",void 0),P([c(),K("design:type",Date)],xe.prototype,"expiresAt",void 0),P([y(),K("design:type",Date)],xe.prototype,"createdAt",void 0),xe=P([u("effective_permissions"),U(),K("design:paramtypes",[Object])],xe);class Be extends ye{constructor(){super(ke)}async createProfile(e,t,i,...r){return this.create({tenant:e,profileKey:t,metadata:i},...r)}async listForTenant(e,...t){return(await this.listAll(...t)).filter(t=>oe(t.tenant,e))}async deleteForTenant(e,...t){for(const i of await this.listForTenant(e,...t))await this.deleteById(i.id,...t)}}class De extends ye{constructor(){super(Fe)}async createProfile(e,t,i,...r){return this.create({orgUnit:e,profileKey:t,metadata:i},...r)}async listForOrgUnit(e,...t){return(await this.listAll(...t)).filter(t=>ae(t.orgUnit,e))}}class Ce extends ye{constructor(){super(ve)}async listAncestors(e,t,...i){return(await this.listAll(...i)).filter(i=>oe(i.tenant,e)&&ae(i.descendant,t)).sort((e,t)=>e.depth-t.depth)}async listDescendants(e,t,...i){return(await this.listAll(...i)).filter(i=>oe(i.tenant,e)&&ae(i.ancestor,t)).sort((e,t)=>e.depth-t.depth)}async isAncestorOf(e,t,i,...r){return(await this.listAncestors(e,i,...r)).some(e=>ae(e.ancestor,t))}async createSelfLink(e,t,...i){return this.create({tenant:e,ancestor:t,descendant:t,depth:0},...i)}async insertAncestorLinksForNewChild(e,t,i,...r){const n=await this.listAncestors(e,t,...r);for(const t of n)await this.create({tenant:e,ancestor:t.ancestor,descendant:i,depth:t.depth+1},...r)}async deleteLinksForSubtree(e,t,...i){const r=await this.listDescendants(e,t,...i),n=new Set([t,...r.map(e=>ue(e.descendant))]),s=new Set([t,...r.map(e=>ue(e.ancestor))]),o=(await this.listAll(...i)).filter(t=>oe(t.tenant,e)&&(n.has(ue(t.descendant))||s.has(ue(t.ancestor))));for(const e of o)await this.deleteById(e.id,...i)}}class Ge extends ye{constructor(){super(je)}async blockCategory(e,t,i,r,n,...s){return this.create({tenant:e,orgUnit:t,blockedFromAncestor:r,permissionCategory:i,reason:n},...s)}async unblockCategory(e,...t){await this.deleteById(e,...t)}async listForOrgUnit(e,t,...i){return(await this.listAll(...i)).filter(i=>oe(i.tenant,e)&&ae(i.orgUnit,t))}async categoryBlockedForAncestor(e,t,i,r,...n){return(await this.listForOrgUnit(e,t,...n)).some(e=>e.permissionCategory===r&&(!e.blockedFromAncestor||ae(e.blockedFromAncestor,i)))}}class Ee extends ye{constructor(){super(Ke)}async createTenant(e,...t){return this.create({slug:e.slug,name:e.name,isolationTier:e.isolationTier??B.Pooled},...t)}async getBySlug(e,...t){return this.findOneBy("slug",e,...t)}async renameTenant(e,t,...i){return this.updateOne(e,{name:t},...i)}async changeSlug(e,t,...i){return this.updateOne(e,{slug:t},...i)}async setIsolationTier(e,t,...i){return this.updateOne(e,{isolationTier:t},...i)}async deleteTenantControlled(e,...t){await this.deleteById(e,...t)}}async function Ne(e,t,...i){for(const r of t)await e.deleteById(r.id,...i)}class $e extends ye{constructor(){super(Ue)}orgUnitPath(e,t){const i=de(t);return e?`${e.replace(/\/+$/,"")}/${i}`:"/"+i}async createProfileIfNeeded(e,t,i,...r){t&&await(new De).createProfile(e,t,i,...r)}async createRoot(e,t,i,r,n,...s){const o=await this.create({tenant:e,name:t,path:this.orgUnitPath(void 0,t),metadata:i},...s);return await this.createProfileIfNeeded(o.id,r,n,...s),await(new Ce).createSelfLink(e,o.id,...s),o}async createChild(e,...t){const i=e.parentOrgUnitId?await this.getById(e.parentOrgUnitId,...t):void 0,r=await this.create({tenant:e.tenantId,parent:i?.id??e.parentOrgUnitId,name:e.name,path:this.orgUnitPath(i?.path,e.name),metadata:e.metadata},...t);await this.createProfileIfNeeded(r.id,e.profileKey,e.profileMetadata,...t);const n=new Ce;return await n.createSelfLink(e.tenantId,r.id,...t),e.parentOrgUnitId&&await n.insertAncestorLinksForNewChild(e.tenantId,e.parentOrgUnitId,r.id,...t),r}async listChildren(e,...t){return(await this.listAll(...t)).filter(t=>ae(t.parent,e))}async listTenantOrgUnits(e,...t){return(await this.listAll(...t)).filter(t=>oe(t.tenant,e))}async listDescendantOrgUnits(e,t,i=!1,...r){const n=await(new Ce).listDescendants(e,t,...r),s=new Set(n.map(e=>ue(e.descendant)));return i&&s.add(t),(await this.listTenantOrgUnits(e,...r)).filter(e=>s.has(e.id))}async listAncestorOrgUnits(e,t,i=!1,...r){const n=await(new Ce).listAncestors(e,t,...r),s=new Set(n.map(e=>ue(e.ancestor)));return i&&s.add(t),(await this.listTenantOrgUnits(e,...r)).filter(e=>s.has(e.id))}async renameOrgUnit(e,t,...i){const r=await this.getById(e,...i);return this.updateOne(e,{name:t,path:this.orgUnitPath(r.path.includes("/")?r.path.replace(/\/[^/]+$/,""):void 0,t)},...i)}async moveOrgUnit(e,t,i,...r){const n=await this.getById(i,...r),s=await this.getById(t,...r),o=await this.updateOne(t,{parent:n.id,path:this.orgUnitPath(n.path,s.name)},...r);return await this.rebuildTenantClosure(e,...r),o}async rebuildTenantClosure(e,...t){const i=new Ce,r=await i.listAll(...t);await Ne(i,r.filter(t=>oe(t.tenant,e)),...t);const n=(await this.listTenantOrgUnits(e,...t)).sort((e,t)=>e.path.split("/").filter(Boolean).length-t.path.split("/").filter(Boolean).length);for(const r of n)await i.createSelfLink(e,r.id,...t),r.parent&&await i.insertAncestorLinksForNewChild(e,ue(r.parent),r.id,...t)}async deleteOrgUnitTree(e,t,...i){const r=new Ce,n=await this.listDescendantOrgUnits(e,t,!0,...i),s=new Set(n.map(e=>e.id)),o=(await this.listTenantOrgUnits(e,...i)).filter(e=>s.has(e.id));await Ne(this,o,...i),await r.deleteLinksForSubtree(e,t,...i)}}P([m(),K("design:type",Function),K("design:paramtypes",[String,String,Object,String,Object,Object]),K("design:returntype",Promise)],$e.prototype,"createRoot",null),P([m(),K("design:type",Function),K("design:paramtypes",[Object,Object]),K("design:returntype",Promise)],$e.prototype,"createChild",null),P([m(),K("design:type",Function),K("design:paramtypes",[String,String,String,Object]),K("design:returntype",Promise)],$e.prototype,"moveOrgUnit",null),P([m(),K("design:type",Function),K("design:paramtypes",[String,Object]),K("design:returntype",Promise)],$e.prototype,"rebuildTenantClosure",null),P([m(),K("design:type",Function),K("design:paramtypes",[String,String,Object]),K("design:returntype",Promise)],$e.prototype,"deleteOrgUnitTree",null);class Le extends ye{constructor(){super(me)}async createUser(e,...t){return this.create({email:e.email,phone:e.phone,displayName:e.displayName},...t)}async getByEmail(e,...t){return(await this.listAll(...t)).find(t=>t.email===e)}async updateDisplayName(e,t,...i){return this.updateOne(e,{displayName:t},...i)}async updateEmail(e,t,...i){return this.updateOne(e,{email:t},...i)}async updatePhone(e,t,...i){return this.updateOne(e,{phone:t},...i)}}class ze extends ye{constructor(){super(Ie)}async createPrincipal(e,t,i,...r){return this.create({tenant:e,kind:t,subjectId:i},...r)}async getForSubject(e,t,i,...r){return(await this.listAll(...r)).find(r=>oe(r.tenant,e)&&r.kind===t&&r.subjectId===i)}async getOrCreateForSubject(e,t,i,...r){return await this.getForSubject(e,t,i,...r)??await this.createPrincipal(e,t,i,...r)}async getUserPrincipal(e,t,...i){return this.getOrCreateForSubject(e,C.User,t,...i)}async getGroupPrincipal(e,t,...i){return this.getOrCreateForSubject(e,C.Group,t,...i)}}class Me extends ye{constructor(){super(he)}async addUserToTenant(e,t,i=D.Active,...r){return this.create({tenant:e,user:t,status:i},...r)}async setStatus(e,t,...i){return this.updateOne(e,{status:t},...i)}async listUserTenants(e,...t){return(await this.listAll(...t)).filter(t=>ae(t.user,e))}async listTenantUsers(e,...t){return(await this.listAll(...t)).filter(t=>oe(t.tenant,e))}async removeUserFromTenant(e,...t){await this.deleteById(e,...t)}}class qe extends ye{constructor(){super(fe)}async addUserToOrgUnit(e,t,i,r=D.Active,...n){return this.create({tenant:e,orgUnit:t,user:i,status:r},...n)}async setStatus(e,t,...i){return this.updateOne(e,{status:t},...i)}async listUserOrgUnits(e,...t){return(await this.listAll(...t)).filter(t=>ae(t.user,e))}async listOrgUnitUsers(e,...t){return(await this.listAll(...t)).filter(t=>ae(t.orgUnit,e))}async removeUserFromOrgUnit(e,...t){await this.deleteById(e,...t)}}class We extends ye{constructor(){super(Te)}async createGroup(e,t,i,r,...n){return this.create({tenant:e,orgUnit:i,name:t,metadata:r},...n)}async renameGroup(e,t,...i){return this.updateOne(e,{name:t},...i)}async moveGroupToOrgUnit(e,t,...i){return this.updateOne(e,{orgUnit:t},...i)}async listTenantGroups(e,...t){return(await this.listAll(...t)).filter(t=>oe(t.tenant,e))}}class Ve extends ye{constructor(){super(Re)}async addPrincipalToGroup(e,t,i,r,...n){return this.create({tenant:e,group:t,principal:i,metadata:r},...n)}async listGroupMembers(e,...t){return(await this.listAll(...t)).filter(t=>ae(t.group,e))}async listPrincipalGroups(e,...t){return(await this.listAll(...t)).filter(t=>ae(t.principal,e))}async removePrincipalFromGroup(e,...t){await this.deleteById(e,...t)}async resolveGroupPrincipalIdsForPrincipal(e,...t){const i=new ze,r=await this.listPrincipalGroups(e,...t);return await Promise.all(r.map(async e=>{const r=ue(e.tenant),n=ue(e.group);return(await i.getGroupPrincipal(r,n,...t)).id}))}}class Ze extends ye{constructor(){super(we)}async createPermission(e,...t){return this.create({key:e.key,category:e.category,description:e.description},...t)}async getByKey(e,...t){return(await this.listAll(...t)).find(t=>t.key===e)}async listByCategory(e,...t){return(await this.listAll(...t)).filter(t=>t.category===e)}async updateDescription(e,t,...i){return this.updateOne(e,{description:t},...i)}}class Qe extends ye{constructor(){super(Se)}async createRole(e,...t){return this.create({tenant:e.tenantId,key:e.key,name:e.name,description:e.description,metadata:e.metadata},...t)}async getSystemRoleByKey(e,...t){const i=(await this.listAll(...t)).find(t=>!t.tenant&&t.key===e);if(!i)throw Error(`Role "${e}" not found`);return i}async getTenantRoleByKey(e,t,...i){const r=(await this.listAll(...i)).find(i=>oe(i.tenant,e)&&i.key===t);if(!r)throw Error(`Role "${t}" not found for tenant ${e}`);return r}async renameRole(e,t,...i){return this.updateOne(e,{name:t},...i)}async updateRoleMetadata(e,t,...i){return this.updateOne(e,{metadata:t},...i)}async listTenantRoles(e,t=!1,...i){return(await this.listAll(...i)).filter(i=>t&&!i.tenant||oe(i.tenant,e))}}class Je extends ye{constructor(){super(be)}async addPermissionToRole(e,t,...i){return this.create({role:e,permission:t},...i)}async addPermissionKeyToRole(e,t,...i){const r=await(new Ze).getByKey(t,...i);return this.addPermissionToRole(e,r.id,...i)}async removePermissionFromRole(e,...t){await this.deleteById(e,...t)}async listRolePermissions(e,...t){return(await this.listAll(...t)).filter(t=>ae(t.role,e))}async listPermissionRoles(e,...t){return(await this.listAll(...t)).filter(t=>ae(t.permission,e))}async replaceRolePermissions(e,t,...i){const r=await this.listRolePermissions(e,...i);return await(async(e,t,...i)=>{for(const r of t)await e.deleteById(r.id,...i)})(this,r,...i),Promise.all(t.map(t=>this.addPermissionToRole(e,t,...i)))}async createRoleWithPermissions(e,t,...i){const r=await(new Qe).createRole(e,...i);for(const e of t)await this.addPermissionKeyToRole(r.id,e,...i);return r}}class He extends ye{constructor(){super(Ae)}async assignRole(e,...t){return this.create({tenant:e.tenantId,principal:e.principalId,role:e.roleId,scopeKind:e.scopeKind,scopeId:e.scopeId,inheritDown:e.inheritDown??!1,startsAt:e.startsAt,expiresAt:e.expiresAt,conditions:e.conditions},...t)}async revokeAssignment(e,...t){await this.deleteById(e,...t)}async listPrincipalAssignments(e,t,...i){return(await this.listAll(...i)).filter(i=>oe(i.tenant,e)&&ae(i.principal,t))}async listRoleAssignments(e,...t){return(await this.listAll(...t)).filter(t=>ae(t.role,e))}async listTenantAssignments(e,...t){return(await this.listAll(...t)).filter(t=>oe(t.tenant,e))}async updateAssignmentWindow(e,t,i,...r){return this.updateOne(e,{startsAt:t,expiresAt:i},...r)}}class Xe extends ye{constructor(){super(xe)}async listForPrincipal(e,t,...i){return(await this.listAll(...i)).filter(i=>oe(i.tenant,e)&&ae(i.principal,t))}async listForScope(e,t,i,...r){return(await this.listAll(...r)).filter(r=>oe(r.tenant,e)&&r.scopeKind===t&&r.scopeId===i)}async hasPermission(e,t,i,r,n,s,...o){return(await this.listForPrincipal(e,t,...o)).some(e=>!(e.permissionKey!==i||e.scopeKind!==r||e.scopeId!==n||e.startsAt&&s&&e.startsAt>s||e.expiresAt&&s&&e.expiresAt<s))}async deleteForPrincipal(e,t,...i){for(const r of await this.listForPrincipal(e,t,...i))await this.deleteById(r.id,...i)}async deleteForTenant(e,...t){for(const i of(await this.listAll(...t)).filter(t=>oe(t.tenant,e)))await this.deleteById(i.id,...t)}async rebuildForPrincipal(e,t,...i){await this.deleteForPrincipal(e,t,...i);const r=new He,n=new Je,s=new Ze,o=new Ve,a=new ze,d=new Ce,p=new Ge,c=[],y=await r.listPrincipalAssignments(e,t,...i),l=await o.listPrincipalGroups(t,...i),u=[...y,...(await Promise.all(l.map(async t=>{const n=await a.getGroupPrincipal(ue(t.tenant),ue(t.group),...i);return r.listPrincipalAssignments(e,n.id,...i)}))).flat()];for(const r of u){const o=await n.listRolePermissions(ue(r.role),...i),a=await Promise.all(o.map(async e=>s.findOneBy("id",ue(e.permission),...i)));for(const n of a){if(!n)continue;const s=r.scopeKind,o=r.scopeId,a=[];if(s===G.Tenant)a.push({scopeKind:s,scopeId:e});else if(s===G.Resource)a.push({scopeKind:s,scopeId:o});else if(s!==G.OrgUnit||r.inheritDown){if(s===G.OrgUnit&&r.inheritDown){const t=await d.listDescendants(e,o,...i);a.push(...t.map(e=>({scopeKind:s,scopeId:ue(e.descendant)})))}}else a.push({scopeKind:s,scopeId:o});for(const d of a)s===G.OrgUnit&&r.inheritDown&&d.scopeId!==o&&await p.categoryBlockedForAncestor(e,d.scopeId,o,n.category,...i)||c.push({id:"",tenantId:e,principalId:t,permissionKey:n.key,scopeKind:d.scopeKind,scopeId:d.scopeId,sourceKind:"role_assignment",sourceId:r.id,startsAt:r.startsAt,expiresAt:r.expiresAt})}}return await Promise.all(c.map(e=>this.create({tenant:e.tenantId,principal:e.principalId,permissionKey:e.permissionKey,scopeKind:e.scopeKind,scopeId:e.scopeId,sourceKind:e.sourceKind,sourceId:e.sourceId,startsAt:e.startsAt,expiresAt:e.expiresAt},...i)))}async rebuildForTenant(e,...t){const i=(await(new ze).listAll(...t)).filter(t=>oe(t.tenant,e));for(const r of i)await this.rebuildForPrincipal(e,r.id,...t)}}P([m(),K("design:type",Function),K("design:paramtypes",[String,String,Object]),K("design:returntype",Promise)],Xe.prototype,"rebuildForPrincipal",null),P([m(),K("design:type",Function),K("design:paramtypes",[String,Object]),K("design:returntype",Promise)],Xe.prototype,"rebuildForTenant",null);class Ye extends ye{constructor(){super(_e)}async registerResource(e,...t){return this.create({tenant:e.tenantId,orgUnit:e.orgUnitId,resourceType:e.resourceType,resourceId:e.resourceId,visibility:e.visibility,owner:e.ownerPrincipalId,sensitivity:e.sensitivity,metadata:e.metadata},...t)}async getByDomainResource(e,t,i,...r){return(await this.listAll(...r)).find(r=>oe(r.tenant,e)&&r.resourceType===t&&r.resourceId===i)}async moveResourceToOrgUnit(e,t,...i){return this.updateOne(e,{orgUnit:t},...i)}async setVisibility(e,t,...i){return this.updateOne(e,{visibility:t},...i)}async transferOwnership(e,t,...i){return this.updateOne(e,{owner:t},...i)}async listOrgUnitResources(e,...t){return(await this.listAll(...t)).filter(t=>ae(t.orgUnit,e))}async listTenantResources(e,...t){return(await this.listAll(...t)).filter(t=>oe(t.tenant,e))}}class et extends ye{constructor(){super(Oe)}async grantResource(e,...t){return this.create({tenant:e.tenantId,resource:e.resourceId,principal:e.principalId,permissionKey:e.permissionKey,startsAt:e.startsAt,expiresAt:e.expiresAt,conditions:e.conditions,createdBy:e.createdByPrincipalId},...t)}async revokeGrant(e,...t){await this.deleteById(e,...t)}async listResourceGrants(e,...t){return(await this.listAll(...t)).filter(t=>ae(t.resource,e))}async listPrincipalGrants(e,t,...i){return(await this.listAll(...i)).filter(i=>oe(i.tenant,e)&&ae(i.principal,t))}async hasGrant(e,t,i,r,n,...s){return(await this.listPrincipalGrants(e,t,...s)).some(e=>ae(e.resource,i)&&e.permissionKey===r&&(!e.startsAt||!n||e.startsAt<=n)&&(!e.expiresAt||!n||e.expiresAt>=n))}async deleteAllForResource(e,...t){for(const i of await this.listResourceGrants(e,...t))await this.deleteById(i.id,...t)}}class tt{async unregisterResource(e,...t){await(new et).deleteAllForResource(e,...t),await(new Ye).deleteById(e,...t)}async resolveResourceScope(e,...t){const i=await(new Ye).getById(e,...t);return{tenantId:ue(i.tenant),orgUnitId:ue(i.orgUnit),visibility:i.visibility,ownerPrincipalId:i.owner?ue(i.owner):void 0}}}class it extends ye{constructor(){super(Pe)}async createBinding(e,...t){return this.create({tenant:e.tenantId,storageKind:e.storageKind,bindingKind:e.bindingKind,bindingKey:e.bindingKey,region:e.region,config:e.config},...t)}async listTenantBindings(e,...t){return(await this.listAll(...t)).filter(t=>ue(t.tenant)===e)}async getBinding(e,t,...i){return(await this.listTenantBindings(e,...i)).find(e=>e.storageKind===t)}async setBindingConfig(e,t,...i){return this.updateOne(e,{config:t},...i)}async promoteToDedicated(e,t,i,r,...n){return this.updateOne(e,{bindingKind:L.Dedicated,bindingKey:t,region:i,config:r},...n)}async setShared(e,t,i,r,...n){return this.updateOne(e,{bindingKind:L.Shared,bindingKey:t,region:i,config:r},...n)}}class rt{constructor(){this.tenantService=new Ee,this.tenantProfileService=new Be,this.orgUnitService=new $e,this.orgUnitProfileService=new De,this.userService=new Le,this.membershipService=new Me,this.principalService=new ze,this.permissionService=new Ze,this.roleService=new Qe,this.rolePermissionService=new Je,this.roleAssignmentService=new He,this.effectivePermissionService=new Xe}async bootstrapTenantFromTemplate(e,...t){const i=await this.tenantService.createTenant(e.tenant,...t);e.tenant.profileKey&&await this.tenantProfileService.createProfile(i.id,e.tenant.profileKey,e.tenant.profileMetadata,...t);const r=async(e,n)=>{const s=void 0===e?await this.orgUnitService.createRoot(i.id,n.name,n.metadata,n.profileKey,n.metadata,...t):await this.orgUnitService.createChild({tenantId:i.id,parentOrgUnitId:e,name:n.name,metadata:n.metadata,profileKey:n.profileKey,profileMetadata:n.metadata},...t);for(const e of n.children??[])await r(s.id,e);return s},n=await r(void 0,e.rootOrgUnit),s=await this.userService.createUser(e.ownerUser,...t);await this.membershipService.addUserToTenant(i.id,s.id,D.Active,...t);const o=await this.principalService.getUserPrincipal(i.id,s.id,...t);for(const i of e.permissions)await this.permissionService.createPermission(i,...t);for(const r of e.roles){const e=await this.roleService.createRole({tenantId:i.id,key:r.key,name:r.name,description:r.description},...t);for(const i of r.permissionKeys)await this.rolePermissionService.addPermissionKeyToRole(e.id,i,...t)}const a=await this.roleService.getTenantRoleByKey(i.id,e.ownerRoleKey,...t);return await this.roleAssignmentService.assignRole({tenantId:i.id,principalId:o.id,roleId:a.id,scopeKind:G.OrgUnit,scopeId:n.id,inheritDown:!0},...t),await this.effectivePermissionService.rebuildForPrincipal(i.id,o.id,...t),{tenantId:i.id,rootOrgUnitId:n.id,ownerUserId:s.id,ownerPrincipalId:o.id}}}P([m(),K("design:type",Function),K("design:paramtypes",[Object,Object]),K("design:returntype",Promise)],rt.prototype,"bootstrapTenantFromTemplate",null);class nt{constructor(){this.membershipService=new Me,this.orgMembershipService=new qe,this.principalService=new ze,this.roleService=new Qe,this.roleAssignmentService=new He,this.effectivePermissionService=new Xe}async onboardUserToTenantAndOrgUnit(e,t,i,r,...n){await this.membershipService.addUserToTenant(e,t,D.Active,...n),await this.orgMembershipService.addUserToOrgUnit(e,i,t,D.Active,...n);const s=await this.principalService.getUserPrincipal(e,t,...n),o=await this.roleService.getTenantRoleByKey(e,r,...n);return await this.roleAssignmentService.assignRole({tenantId:e,principalId:s.id,roleId:o.id,scopeKind:G.OrgUnit,scopeId:i,inheritDown:!0},...n),await this.effectivePermissionService.rebuildForPrincipal(e,s.id,...n),{principalId:s.id}}async changeUserOrgRole(e,t,i,r,n,...s){const o=await this.roleService.getTenantRoleByKey(e,r,...s),a=await this.roleAssignmentService.listPrincipalAssignments(e,t,...s);for(const e of a.filter(e=>e.scopeKind===G.OrgUnit&&e.scopeId===i))await this.roleAssignmentService.revokeAssignment(e.id,...s);await this.roleAssignmentService.assignRole({tenantId:e,principalId:t,roleId:o.id,scopeKind:G.OrgUnit,scopeId:i,inheritDown:n},...s),await this.effectivePermissionService.rebuildForPrincipal(e,t,...s)}async suspendUserInTenant(e,t,i,...r){await this.membershipService.setStatus(e,D.Suspended,...r),await this.effectivePermissionService.deleteForPrincipal(t,i,...r)}async reactivateUserInTenant(e,t,i,...r){await this.membershipService.setStatus(e,D.Active,...r),await this.effectivePermissionService.rebuildForPrincipal(t,i,...r)}}P([m(),K("design:type",Function),K("design:paramtypes",[String,String,String,String,Object]),K("design:returntype",Promise)],nt.prototype,"onboardUserToTenantAndOrgUnit",null),P([m(),K("design:type",Function),K("design:paramtypes",[String,String,String,String,Boolean,Object]),K("design:returntype",Promise)],nt.prototype,"changeUserOrgRole",null),P([m(),K("design:type",Function),K("design:paramtypes",[String,String,String,Object]),K("design:returntype",Promise)],nt.prototype,"suspendUserInTenant",null),P([m(),K("design:type",Function),K("design:paramtypes",[String,String,String,Object]),K("design:returntype",Promise)],nt.prototype,"reactivateUserInTenant",null);class st{constructor(e={}){this.dataSources=e}async canAccess(e,...t){const i=e.at??new Date;if(e.scopeKind&&e.scopeId)return se(await(this.dataSources.listEffectivePermissionsForScope?.(e.tenantId,e.scopeKind,e.scopeId))).some(t=>t.permissionKey===e.permissionKey&&pe(i,t.startsAt,t.expiresAt));if(!e.resourceProtectedId)return!1;const r=await(this.dataSources.loadResource?.(e.tenantId,e.resourceProtectedId));if(!r)return!1;if(r.tenantId!==e.tenantId)return!1;if(r.ownerPrincipalId===e.principalId)return!0;if(se(await(this.dataSources.listResourceGrants?.(e.tenantId,e.resourceProtectedId))).filter(t=>t.principalId===e.principalId&&t.permissionKey===e.permissionKey&&pe(i,t.startsAt,t.expiresAt)).length>0)return!0;const n=r.visibility;return n!==N.Private&&n!==N.ResourceAcl&&(n===N.OrgUnit||n===N.OrgSubtree?se(await(this.dataSources.listEffectivePermissionsForScope?.(e.tenantId,G.OrgUnit,r.orgUnitId))).some(t=>t.permissionKey===e.permissionKey&&pe(i,t.startsAt,t.expiresAt)):n===N.Tenant&&se(await(this.dataSources.listEffectivePermissionsForScope?.(e.tenantId,G.Tenant,e.tenantId))).some(t=>t.permissionKey===e.permissionKey&&pe(i,t.startsAt,t.expiresAt)))}async requireAccess(e,...t){if(!await this.canAccess(e,...t))throw new f(`Access denied for ${e.permissionKey} on ${e.resourceProtectedId??(i=e.scopeKind??G.Resource,r=e.scopeId??"",`${i}:${r}`)}`);var i,r}async buildAccessContext(e,t,...i){return ce({tenantId:e,principalId:t,permissions:se(await(this.dataSources.listEffectivePermissions?.(e,t))),grants:se(await(this.dataSources.listPrincipalGrants?.(e,t)))})}async buildArangoContext(e,t,i,...r){const n=await this.buildAccessContext(e,t,...r),s=n.allowedOrgUnitIdsByPermission[i]??[],o=n.resourceGrants.filter(e=>e.permissionKey===i).map(e=>e.resourceId);return te({tenantId:e,principalId:t,permissionKey:i,allowedOrgUnitIds:s,allowedResourceIds:o})}async buildQdrantFilter(e,t,i,...r){const n=await this.buildAccessContext(e,t,...r);return ie({tenantId:e,principalId:t,allowedOrgUnitIds:n.allowedOrgUnitIdsByPermission[i]??[],allowedResourceIds:n.resourceGrants.filter(e=>e.permissionKey===i).map(e=>e.resourceId)})}}const ot="featureFlag",at="FEATURE_FLAG",dt="feature-flags:model",pt="feature-flags:auth",ct="feature-flags:block",yt="feature-flags:render-if",lt="feature-flags:hide-on";function ut(e){const t=e.trim();if(!t)return t;if(/^[a-z][a-zA-Z0-9]*$/.test(t))return t;const i=t.toLowerCase().replace(/[_\-\s]+/g," ").split(" ").filter(Boolean);if(0===i.length)return t;const[r,...n]=i;return[r,...n.map(e=>e?e.charAt(0).toUpperCase()+e.slice(1):e)].join("").replace(/[^a-zA-Z0-9]/g,"")}function gt(e){if("string"!=typeof e)return e;const t=e.trim();if("true"===t)return!0;if("false"===t)return!1;if(/^-?\d+(\.\d+)?$/.test(t))return Number(t);if(t.startsWith("{")&&t.endsWith("}")||t.startsWith("[")&&t.endsWith("]"))try{return JSON.parse(t)}catch{return e}return e}function ht(e){if(void 0===e)return;if(!0===e)return!0;if(!e||"object"!=typeof e||Array.isArray(e))return gt(e);const t={};return Object.entries(e).forEach(([e,i])=>{const r=(e=>{if(!e)return e;if(/^[a-z][a-zA-Z0-9]*$/.test(e))return e;const t=e.replace(/[\s-]+/g,"_").split("_").filter(Boolean);if(0===t.length)return e;const[i,...r]=t;return[i.toLowerCase(),...r.map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase())].join("")})(e);void 0!==i&&(t[r]=ht(i)??i)}),t}function mt(e){return!e||"object"!=typeof e||Array.isArray(e)?{}:Object.entries(e).reduce((e,[t,i])=>{const r=ut(t),n=ht(i);return void 0!==n&&(e[r]=n),e},{})}function ft(e){return!0===e||!!e&&"object"==typeof e}function vt(e,t){return ft(e?.[ut(t)])}function wt(e,t="any"){return{features:[...new Set(e.map(ut).filter(Boolean))],match:t}}function bt(e,t){if(!e||0===e.features.length)return!0;const i=e.features.filter(e=>vt(t,e));return"all"===e.match?i.length===e.features.length:i.length>0}function St(e,t){return!(!e||0===e.features.length)&&e.features.some(e=>vt(t,e))}function At(e,t){return k.get(e,t)}function Ot(e){return e.trim().toLowerCase()}function It(e){return e.trim()}const _t=i.accumulate({[ot]:{}});async function jt(e=_t){return mt(e.featureFlag)}async function Ut(e,t=_t){return(await jt(t))[ut(e)]}async function Pt(e,t=_t){return!!await Ut(e,t)}let Kt=class extends v{constructor(e){super(e),this.enabled=!0}};P([a(),d(),K("design:type",String)],Kt.prototype,"id",void 0),P([g(),I(),c(),K("design:type",String)],Kt.prototype,"key",void 0),P([c(),K("design:type",Boolean)],Kt.prototype,"enabled",void 0),P([c(),K("design:type",String)],Kt.prototype,"description",void 0),P([c(),K("design:type",String)],Kt.prototype,"scope",void 0),P([c(),K("design:type",Object)],Kt.prototype,"metadata",void 0),P([c(),K("design:type",Object)],Kt.prototype,"config",void 0),P([c(),K("design:type",String)],Kt.prototype,"createdBy",void 0),P([c(),K("design:type",String)],Kt.prototype,"updatedBy",void 0),P([y(),K("design:type",Date)],Kt.prototype,"createdAt",void 0),P([l(),K("design:type",Date)],Kt.prototype,"updatedAt",void 0),Kt=P([u("feature_flags"),U(),K("design:paramtypes",[Object])],Kt);let kt=class extends v{constructor(e){super(e),this.enabled=!0}};P([a(),d(),K("design:type",String)],kt.prototype,"id",void 0),P([I(),c(),K("design:type",String)],kt.prototype,"featureKey",void 0),P([I(),c(),K("design:type",String)],kt.prototype,"subjectType",void 0),P([I(),c(),K("design:type",String)],kt.prototype,"subjectKey",void 0),P([c(),K("design:type",Boolean)],kt.prototype,"enabled",void 0),P([c(),K("design:type",Object)],kt.prototype,"metadata",void 0),P([c(),K("design:type",String)],kt.prototype,"createdBy",void 0),P([c(),K("design:type",String)],kt.prototype,"updatedBy",void 0),P([y(),K("design:type",Date)],kt.prototype,"createdAt",void 0),P([l(),K("design:type",Date)],kt.prototype,"updatedAt",void 0),kt=P([u("feature_flag_access"),U(),K("design:paramtypes",[Object])],kt);class Ft{async readOne(e,t){return(await this.read(t))[ut(e)]}}class Rt extends Ft{async read(e={}){return jt(e.source??{[ot]:{}})}}let Tt=class extends o{constructor(){super(Kt),this.reader=new Rt,this.cachedRegistry={}}async initialize(...e){const t=e[0]??{};t.repository&&(this._repository=t.repository),this.reader=t.reader?"function"==typeof t.reader?new t.reader:t.reader:new Rt;const i={...t.readerConfig??{},source:t.readerConfig?.source??_t};return this.cachedRegistry=await this.refreshCachedRegistry(i,...e),{config:{...t,reader:this.reader,readerConfig:i},client:this.reader}}cloneRegistry(e){return Object.entries(e).reduce((e,[t,i])=>(e[t]=i&&"object"==typeof i&&!Array.isArray(i)?{...i}:i,e),{})}async refreshCachedRegistry(e={},...t){const i=await this.reader.read({...e,source:e.source??_t});let r=[];try{r=await this.repo.select().execute(...t)}catch{r=[]}const n=this.cloneRegistry(i);for(const e of r)n[e.key]=!!e.enabled&&(e.config??!0);return n}setCachedFlag(e){this.cachedRegistry[e.key]=!!e.enabled&&(e.config??!0)}getAccessRepository(){return this.accessRepository??S.forModel(kt)}assertInitialized(){this.reader}normalizeFeatureAccessInput(e){return{...e,featureKey:ut(e.featureKey),subjectType:Ot(e.subjectType),subjectKey:It(e.subjectKey)}}buildAccessCondition(e){let t=A.attr("subjectType").eq(Ot(e.subjectType));return t=t.and(A.attr("subjectKey").eq(It(e.subjectKey))),void 0!==e.enabled&&(t=t.and(A.attr("enabled").eq(e.enabled))),e.featureKeys&&e.featureKeys.length>0&&(t=t.and(A.attr("featureKey").in(e.featureKeys.map(ut)))),t}async create(e,...t){e.key=ut(e.key),e.enabled??=!0;const i=await super.create(e,...t);return this.setCachedFlag(i),i}async update(e,...t){e.key=ut(e.key),e.enabled??=!0;const i=await super.update(e,...t);return this.setCachedFlag(i),i}async findOneBy(e,t,...i){const r="key"===e&&"string"==typeof t?ut(t):t;return this.repo.findOneBy(e,r,...i)}async readAll(e,...t){const i=await this.repo.readAll(e,...t);for(const e of i)this.setCachedFlag(e);return i}async listEnabled(...e){return this.repo.select().where(A.attr("enabled").eq(!0)).execute(...e)}async grantFeatureAccess(e,...t){const i=this.normalizeFeatureAccessInput(e),r=await this.findFeatureAccess(i,...t).catch(()=>{});return r?this.getAccessRepository().update(Object.assign(r,i),...t):this.getAccessRepository().create(new kt(i),...t)}async revokeFeatureAccess(e,...t){const i=await this.findFeatureAccess(e,...t).catch(()=>{});if(i)return this.getAccessRepository().delete(i.id,...t)}async findFeatureAccess(e,...t){const i=this.buildAccessCondition(e),r=(await this.getAccessRepository().select().where(i).execute(...t))[0];if(!r)throw new n(`Feature access for ${Ot(e.subjectType)}:${It(e.subjectKey)} not found`);return r}async listFeatureAccess(e,...t){return this.getAccessRepository().select().where(this.buildAccessCondition(e)).execute(...t)}async resolveFeatureFlagsForSubject(e,...t){this.assertInitialized();const i=await this.listFeatureAccess({...e,enabled:!0},...t),r=[...new Set(i.map(e=>e.featureKey))];if(0===r.length)return{};const n=A.attr("enabled").eq(!0).and(A.attr("key").in(r.map(ut)));return(await this.repo.select().where(n).execute(...t)).reduce((e,t)=>(e[t.key]=t.config??!0,e),{})}async isEnabledForSubject(e,t,...i){return vt(await this.resolveFeatureFlagsForSubject(t,...i),e)}isEnabled(e){this.assertInitialized();const t=ut(e);return vt(this.cachedRegistry,t)}async resolveFeatureFlags(){return this.assertInitialized(),this.cloneRegistry(this.cachedRegistry)}async syncFromEnvironment(e={},...t){this.assertInitialized();const i=await this.reader.read({...e,source:e.source??_t}),r=[];for(const[e,n]of Object.entries(i)){const i=n&&"object"==typeof n&&!Array.isArray(n)?n:{enabled:!!n},{enabled:s,...o}=i,a=ut(e),d=await this.findOneBy("key",a,...t).catch(()=>{}),p=d?Object.assign(d,{enabled:ft(n),description:o.description??d.description,scope:o.scope??d.scope,metadata:o.metadata??d.metadata,config:{...o,enabled:ft(n)}}):new Kt({key:a,enabled:ft(n),description:o.description,scope:o.scope,metadata:o.metadata,config:{...o,enabled:ft(n)}});r.push(d?await this.update(p,...t):await this.create(p,...t))}return this.cachedRegistry=await this.refreshCachedRegistry({...e,source:e.source??_t},...t),r}};function xt(e,t){return void 0===t?e:k.key(e,t.toString())}function Bt(e,t,i="any"){const r=wt(t,i);return(t,i,n)=>{if(void 0===i)return F(e,r)(t);const s=xt(e,i);return n?R(s,r)(t,i,n):T(s,r)(t,i)}}function Dt(...e){return Bt(dt,e)}function Ct(...e){return Bt(pt,e)}function Gt(...e){return Bt(ct,e)}function Et(...e){return Bt(yt,e)}function Nt(...e){return Bt(lt,e)}function $t(e,t,i){return At(e,xt(t,i))}function Lt(e,t,i,r){return bt($t(e,i,r),t)}function zt(e,t,i,r){return St($t(e,i,r),t)}P([w(kt),K("design:type",Object)],Tt.prototype,"accessRepository",void 0),Tt=P([b(Kt),K("design:paramtypes",[])],Tt);const Mt="##VERSION##",qt="##COMMIT##",Wt="##FULL_VERSION##",Vt="##PACKAGE##";export{ge as AuthorizationModel,st as AuthzService,ye as BaseModelService,rt as BootstrapService,qt as COMMIT,xe as EffectivePermission,Xe as EffectivePermissionService,Rt as EnvironmeFlagReader,pt as FEATURE_FLAG_AUTH_KEY,ct as FEATURE_FLAG_BLOCK_KEY,at as FEATURE_FLAG_ENV_PREFIX,ot as FEATURE_FLAG_ENV_ROOT,lt as FEATURE_FLAG_HIDE_KEY,dt as FEATURE_FLAG_MODEL_KEY,yt as FEATURE_FLAG_RENDER_KEY,Wt as FULL_VERSION,Kt as FeatureFlag,kt as FeatureFlagAccess,_t as FeatureFlagEnvironment,Ft as FeatureFlagReader,Tt as FeatureFlagService,Te as Group,Re as GroupMembership,Ve as GroupMembershipService,We as GroupService,je as InheritanceBlock,Ge as InheritanceBlockService,B as IsolationTier,z as IsolationTierOptions,D as MembershipStatus,M as MembershipStatusOptions,Ue as OrgUnit,ve as OrgUnitClosure,Ce as OrgUnitClosureService,fe as OrgUnitMembership,qe as OrgUnitMembershipService,Fe as OrgUnitProfile,De as OrgUnitProfileService,$e as OrgUnitService,Vt as PACKAGE_NAME,we as Permission,E as PermissionCategory,V as PermissionCategoryOptions,Ze as PermissionService,Ie as Principal,C as PrincipalKind,q as PrincipalKindOptions,ze as PrincipalService,_e as ProtectedResource,Ye as ProtectedResourceService,Y as REL_CASCADE_DEPENDENT,ee as REL_CASCADE_INSERT_UPDATE,X as REL_NULLIFY,H as REL_RESTRICT,Oe as ResourceGrant,et as ResourceGrantService,tt as ResourceLifecycleService,N as ResourceVisibility,Z as ResourceVisibilityOptions,Se as Role,Ae as RoleAssignment,He as RoleAssignmentService,be as RolePermission,Je as RolePermissionService,Qe as RoleService,G as ScopeKind,W as ScopeKindOptions,Pe as StorageBinding,L as StorageBindingKind,J as StorageBindingKindOptions,it as StorageBindingService,$ as StorageKind,Q as StorageKindOptions,nt as SystemManagementService,Ke as Tenant,he as TenantMembership,Me as TenantMembershipService,ke as TenantProfile,Be as TenantProfileService,Ee as TenantService,me as User,Le as UserService,Mt as VERSION,se as asArray,Gt as blockFeatureOperations,ce as buildAccessContext,te as buildArangoContext,ie as buildQdrantFilter,x as execWithLogging,Ct as featureAuth,Dt as featureFlags,$t as getFeatureGateMetadata,Pt as hasFeatureFlagInEnvironment,Nt as hideOnFeature,le as id,ft as isFeatureFlagEnabled,vt as isFeatureFlagEnabledByName,St as isFeatureRuleBlocked,bt as isFeatureRuleSatisfied,pe as isTimeValid,jt as loadFeatureFlagsFromEnvironment,de as lowerSlug,ht as normalizeFeatureConfig,ut as normalizeFeatureName,mt as normalizeFeatureRegistry,wt as normalizeFeatureRule,It as normalizeFeatureSubjectKey,Ot as normalizeFeatureSubjectType,ne as nowIso,gt as parseRuntimeValue,At as readMetadata,ue as relationId,ae as relationMatch,Et as renderIfFeature,Ut as resolveFeatureFlagFromEnvironment,oe as sameTenant,Lt as shouldExposeForFeatures,zt as shouldHideForFeatures};
1
+ import{exec as e}from"child_process";import{LogLevel as t,LoggedEnvironment as i}from"@decaf-ts/logging";import{InternalError as r,NotFoundError as n}from"@decaf-ts/db-decorators";import{Cascade as s,ModelService as o,pk as a,uuid as d,manyToOne as c,column as p,createdAt as y,updatedAt as l,table as u,unique as g,oneToMany as h,transactional as m,AuthorizationError as f,BaseModel as v,repository as w,service as b,Repository as S,Condition as A}from"@decaf-ts/core";export{AuthorizationError,transactional}from"@decaf-ts/core";import{Model as O,required as I,type as _,option as j,model as U}from"@decaf-ts/decorator-validation";import{__decorate as P,__metadata as K}from"tslib";import{Metadata as k,metadata as F,methodMetadata as R,propMetadata as T}from"@decaf-ts/decoration";async function x(i,n,s,o=t.info){return s.debug("Executing: "+i),new Promise((t,a)=>{const d=e(i,n),c=[],p=[];d.stdout?.on("data",e=>{c.push(e),s[o](e.trim())}),d.stderr?.on("data",e=>{p.push(e),s.debug(e.trim())}),d.on("close",e=>{0===e?(s.silly("Command completed successfully"),t({stdout:c.join("\n"),stderr:p.join("\n")})):(s.critical(`Command failed with code ${e}:\n ${p.join("\n")}`),a(new r(`Command failed with code ${e}: ${p.join("\n")}`)))}),d.on("error",e=>{s.critical("Command execution error",e),a(e)})})}var B,D,C,E,G,N,$,L;(e=>{e.Pooled="pooled",e.Bridge="bridge",e.Silo="silo"})(B||(B={})),(e=>{e.Invited="invited",e.Active="active",e.Suspended="suspended",e.Removed="removed"})(D||(D={})),(e=>{e.User="user",e.Group="group",e.ServiceAccount="service_account",e.Agent="agent",e.ApiKey="api_key"})(C||(C={})),(e=>{e.Tenant="tenant",e.OrgUnit="org_unit",e.Resource="resource"})(E||(E={})),(e=>{e.Admin="admin",e.ContentRead="content_read",e.ContentWrite="content_write",e.Memory="memory",e.Graph="graph",e.Vector="vector",e.Export="export",e.Billing="billing",e.Audit="audit",e.Security="security",e.Data="data",e.Automation="automation"})(G||(G={})),(e=>{e.Private="private",e.ResourceAcl="resource_acl",e.OrgUnit="org_unit",e.OrgSubtree="org_subtree",e.Tenant="tenant"})(N||(N={})),(e=>{e.Postgres="postgres",e.Arango="arango",e.Qdrant="qdrant",e.ObjectStorage="object_storage"})($||($={})),(e=>{e.Shared="shared",e.Dedicated="dedicated"})(L||(L={}));const z=Object.values(B),M=Object.values(D),q=Object.values(C),W=Object.values(E),V=Object.values(G),Z=Object.values(N),Q=Object.values($),J=Object.values(L),H={update:s.NONE,delete:s.NONE,nullable:!1},X={update:s.NONE,delete:s.NONE,nullable:!0},Y={update:s.CASCADE,delete:s.CASCADE,nullable:!1},ee={update:s.CASCADE,delete:s.NONE,nullable:!1};function te(e){return{tenantId:e.tenantId,principalId:e.principalId,permissionKey:e.permissionKey,allowedOrgUnitIds:[...e.allowedOrgUnitIds],allowedResourceIds:[...e.allowedResourceIds]}}function ie(e){return{must:[{key:"tenant_id",match:{value:e.tenantId}},{should:[{key:"org_unit_id",match:{any:e.allowedOrgUnitIds}},{key:"protected_resource_id",match:{any:e.allowedResourceIds}},{key:"owner_principal_id",match:{value:e.principalId}}]}]}}function re(e,t){return`${e}:${t}`}function ne(){return new Date}function se(e){return e??[]}function oe(e,t){return ue(e)===t}function ae(e,t){return!!t&&ue(e)===t}function de(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"item"}function ce(e,t,i){const r=e??new Date;return!(t&&t>r||i&&r>i)}function pe(e){const t={},i={};for(const r of e.permissions){const e=re(r.scopeKind,r.scopeId);t[e]=t[e]??[],t[e].push(r.permissionKey),r.scopeKind===E.OrgUnit&&(i[r.permissionKey]=i[r.permissionKey]??[],i[r.permissionKey].push(r.scopeId))}return{tenantId:e.tenantId,principalId:e.principalId,permissionsByScope:t,allowedOrgUnitIdsByPermission:i,resourceGrants:e.grants.map(e=>({resourceId:e.resourceId,permissionKey:e.permissionKey}))}}class ye extends o{constructor(e){super(e)}newModel(e,t){return Object.assign(new e,t)}async create(e,...t){return this.repo.create(Object.assign({},e),...t)}async createOne(e,...t){return this.create(e,...t)}async getById(e,...t){return this.repo.read(e,...t)}async updateOne(e,t,...i){const r=await this.repo.read(e,...i);return this.repo.update(Object.assign(r,t),...i)}async deleteById(e,...t){await this.repo.delete(e,...t)}async findOneBy(e,t,...i){return this.repo.findOneBy(e,t,...i)}async findManyBy(e,t,...i){return this.repo.select().where({[e]:t}).execute(...i)}async listAll(...e){return this.repo.select().execute(...e)}}function le(){return crypto.randomUUID()}function ue(e){return"string"==typeof e?e:e.id}class ge extends O{constructor(e){super(e)}}let he=class extends ge{constructor(e){super(e)}};P([a({type:String}),d(),K("design:type",String)],he.prototype,"id",void 0),P([c(()=>Ke,Y,!1,void 0,"fk_tenant_memberships_tenant"),I(),K("design:type",Object)],he.prototype,"tenant",void 0),P([c(()=>me,Y,!1,void 0,"fk_tenant_memberships_user"),I(),K("design:type",Object)],he.prototype,"user",void 0),P([I(),_(String),j(M),p(),K("design:type",String)],he.prototype,"status",void 0),P([y(),K("design:type",Date)],he.prototype,"createdAt",void 0),P([l(),K("design:type",Date)],he.prototype,"updatedAt",void 0),he=P([u("tenant_memberships"),U(),K("design:paramtypes",[Object])],he);let me=class extends ge{constructor(e){super(e)}};P([a({type:String}),d(),K("design:type",String)],me.prototype,"id",void 0),P([g(),_(String),p(),K("design:type",String)],me.prototype,"email",void 0),P([g(),_(String),p(),K("design:type",String)],me.prototype,"phone",void 0),P([I(),_(String),p(),K("design:type",String)],me.prototype,"displayName",void 0),P([h(()=>he,H,!1),K("design:type",Array)],me.prototype,"tenantMemberships",void 0),P([h(()=>fe,H,!1),K("design:type",Array)],me.prototype,"orgUnitMemberships",void 0),P([y(),K("design:type",Date)],me.prototype,"createdAt",void 0),P([l(),K("design:type",Date)],me.prototype,"updatedAt",void 0),me=P([u("users"),U(),K("design:paramtypes",[Object])],me);let fe=class extends ge{constructor(e){super(e)}};P([a({type:String}),d(),K("design:type",String)],fe.prototype,"id",void 0),P([c(()=>Ke,Y,!1,void 0,"fk_org_memberships_tenant"),I(),K("design:type",Object)],fe.prototype,"tenant",void 0),P([c(()=>Ue,Y,!1,void 0,"fk_org_memberships_org_unit"),I(),K("design:type",Object)],fe.prototype,"orgUnit",void 0),P([c(()=>me,H,!1,void 0,"fk_org_memberships_user"),I(),K("design:type",Object)],fe.prototype,"user",void 0),P([I(),_(String),j(M),p(),K("design:type",String)],fe.prototype,"status",void 0),P([y(),K("design:type",Date)],fe.prototype,"createdAt",void 0),P([l(),K("design:type",Date)],fe.prototype,"updatedAt",void 0),fe=P([u("org_unit_memberships"),U(),K("design:paramtypes",[Object])],fe);let ve=class extends ge{constructor(e){super(e)}};P([a({type:String}),d(),K("design:type",String)],ve.prototype,"id",void 0),P([c(()=>Ke,Y,!1,void 0,"fk_org_closure_tenant"),I(),K("design:type",Object)],ve.prototype,"tenant",void 0),P([c(()=>Ue,Y,!1,void 0,"fk_org_closure_ancestor"),I(),K("design:type",Object)],ve.prototype,"ancestor",void 0),P([c(()=>Ue,Y,!1,void 0,"fk_org_closure_descendant"),I(),K("design:type",Object)],ve.prototype,"descendant",void 0),P([I(),_(Number),p(),K("design:type",Number)],ve.prototype,"depth",void 0),P([y(),K("design:type",Date)],ve.prototype,"createdAt",void 0),ve=P([u("org_unit_closure"),U(),K("design:paramtypes",[Object])],ve);let we=class extends ge{constructor(e){super(e)}};P([a({type:String}),d(),K("design:type",String)],we.prototype,"id",void 0),P([g(),I(),_(String),p(),K("design:type",String)],we.prototype,"key",void 0),P([I(),_(String),j(V),p(),K("design:type",String)],we.prototype,"category",void 0),P([_(String),p(),K("design:type",String)],we.prototype,"description",void 0),P([h(()=>be,H,!1),K("design:type",Array)],we.prototype,"rolePermissions",void 0),we=P([u("permissions"),U(),K("design:paramtypes",[Object])],we);let be=class extends ge{constructor(e){super(e)}};P([a({type:String}),d(),K("design:type",String)],be.prototype,"id",void 0),P([c(()=>Se,Y,!1,void 0,"fk_role_permissions_role"),I(),K("design:type",Object)],be.prototype,"role",void 0),P([c(()=>we,Y,!1,void 0,"fk_role_permissions_permission"),I(),K("design:type",Object)],be.prototype,"permission",void 0),P([y(),K("design:type",Date)],be.prototype,"createdAt",void 0),be=P([u("role_permissions"),U(),K("design:paramtypes",[Object])],be);let Se=class extends ge{constructor(e){super(e)}};P([a({type:String}),d(),K("design:type",String)],Se.prototype,"id",void 0),P([c(()=>Ke,X,!1,void 0,"fk_roles_tenant"),K("design:type",Object)],Se.prototype,"tenant",void 0),P([I(),_(String),p(),K("design:type",String)],Se.prototype,"key",void 0),P([I(),_(String),p(),K("design:type",String)],Se.prototype,"name",void 0),P([_(String),p(),K("design:type",String)],Se.prototype,"description",void 0),P([_(Object),p(),K("design:type",Object)],Se.prototype,"metadata",void 0),P([h(()=>be,H,!1),K("design:type",Array)],Se.prototype,"rolePermissions",void 0),P([h(()=>Ae,H,!1),K("design:type",Array)],Se.prototype,"assignments",void 0),P([y(),K("design:type",Date)],Se.prototype,"createdAt",void 0),P([l(),K("design:type",Date)],Se.prototype,"updatedAt",void 0),Se=P([u("roles"),U(),K("design:paramtypes",[Object])],Se);let Ae=class extends ge{constructor(e){super(e)}};P([a({type:String}),d(),K("design:type",String)],Ae.prototype,"id",void 0),P([c(()=>Ke,Y,!1,void 0,"fk_role_assignments_tenant"),I(),K("design:type",Object)],Ae.prototype,"tenant",void 0),P([c(()=>Ie,Y,!1,void 0,"fk_role_assignments_principal"),I(),K("design:type",Object)],Ae.prototype,"principal",void 0),P([c(()=>Se,H,!1,void 0,"fk_role_assignments_role"),I(),K("design:type",Object)],Ae.prototype,"role",void 0),P([I(),_(String),j(W),p(),K("design:type",String)],Ae.prototype,"scopeKind",void 0),P([I(),_(String),p(),K("design:type",String)],Ae.prototype,"scopeId",void 0),P([I(),_(Boolean),p(),K("design:type",Boolean)],Ae.prototype,"inheritDown",void 0),P([p(),K("design:type",Date)],Ae.prototype,"startsAt",void 0),P([p(),K("design:type",Date)],Ae.prototype,"expiresAt",void 0),P([_(Object),p(),K("design:type",Object)],Ae.prototype,"conditions",void 0),P([y(),K("design:type",Date)],Ae.prototype,"createdAt",void 0),P([l(),K("design:type",Date)],Ae.prototype,"updatedAt",void 0),Ae=P([u("role_assignments"),U(),K("design:paramtypes",[Object])],Ae);let Oe=class extends ge{constructor(e){super(e)}};P([a({type:String}),d(),K("design:type",String)],Oe.prototype,"id",void 0),P([c(()=>Ke,Y,!1,void 0,"fk_resource_grants_tenant"),I(),K("design:type",Object)],Oe.prototype,"tenant",void 0),P([c(()=>_e,Y,!1,void 0,"fk_resource_grants_resource"),I(),K("design:type",Object)],Oe.prototype,"resource",void 0),P([c(()=>Ie,Y,!1,void 0,"fk_resource_grants_principal"),I(),K("design:type",Object)],Oe.prototype,"principal",void 0),P([I(),_(String),p(),K("design:type",String)],Oe.prototype,"permissionKey",void 0),P([p(),K("design:type",Date)],Oe.prototype,"startsAt",void 0),P([p(),K("design:type",Date)],Oe.prototype,"expiresAt",void 0),P([_(Object),p(),K("design:type",Object)],Oe.prototype,"conditions",void 0),P([c(()=>Ie,H,!1,void 0,"fk_resource_grants_created_by"),K("design:type",Object)],Oe.prototype,"createdBy",void 0),P([y(),K("design:type",Date)],Oe.prototype,"createdAt",void 0),P([l(),K("design:type",Date)],Oe.prototype,"updatedAt",void 0),Oe=P([u("resource_grants"),U(),K("design:paramtypes",[Object])],Oe);let Ie=class extends ge{constructor(e){super(e)}};P([a({type:String}),d(),K("design:type",String)],Ie.prototype,"id",void 0),P([c(()=>Ke,H,!1,void 0,"fk_principals_tenant"),I(),K("design:type",Object)],Ie.prototype,"tenant",void 0),P([I(),_(String),j(q),p(),K("design:type",String)],Ie.prototype,"kind",void 0),P([I(),_(String),p(),K("design:type",String)],Ie.prototype,"subjectId",void 0),P([h(()=>Ae,H,!1),K("design:type",Array)],Ie.prototype,"roleAssignments",void 0),P([h(()=>Oe,H,!1),K("design:type",Array)],Ie.prototype,"resourceGrants",void 0),P([y(),K("design:type",Date)],Ie.prototype,"createdAt",void 0),P([l(),K("design:type",Date)],Ie.prototype,"updatedAt",void 0),Ie=P([u("principals"),U(),K("design:paramtypes",[Object])],Ie);let _e=class extends ge{constructor(e){super(e)}};P([a({type:String}),d(),K("design:type",String)],_e.prototype,"id",void 0),P([c(()=>Ke,H,!1,void 0,"fk_protected_resources_tenant"),I(),K("design:type",Object)],_e.prototype,"tenant",void 0),P([c(()=>Ue,H,!1,void 0,"fk_protected_resources_org_unit"),I(),K("design:type",Object)],_e.prototype,"orgUnit",void 0),P([I(),_(String),p(),K("design:type",String)],_e.prototype,"resourceType",void 0),P([I(),_(String),p(),K("design:type",String)],_e.prototype,"resourceId",void 0),P([I(),_(String),j(Z),p(),K("design:type",String)],_e.prototype,"visibility",void 0),P([c(()=>Ie,X,!1,void 0,"fk_protected_resources_owner"),K("design:type",Object)],_e.prototype,"owner",void 0),P([_(String),p(),K("design:type",String)],_e.prototype,"sensitivity",void 0),P([_(Object),p(),K("design:type",Object)],_e.prototype,"metadata",void 0),P([h(()=>Oe,H,!1),K("design:type",Array)],_e.prototype,"grants",void 0),P([y(),K("design:type",Date)],_e.prototype,"createdAt",void 0),P([l(),K("design:type",Date)],_e.prototype,"updatedAt",void 0),_e=P([u("protected_resources"),U(),K("design:paramtypes",[Object])],_e);let je=class extends ge{constructor(e){super(e)}};P([a({type:String}),d(),K("design:type",String)],je.prototype,"id",void 0),P([c(()=>Ke,Y,!1,void 0,"fk_inheritance_blocks_tenant"),I(),K("design:type",Object)],je.prototype,"tenant",void 0),P([c(()=>Ue,Y,!1,void 0,"fk_inheritance_blocks_org_unit"),I(),K("design:type",Object)],je.prototype,"orgUnit",void 0),P([c(()=>Ue,X,!1,void 0,"fk_inheritance_blocks_blocked_ancestor"),K("design:type",Object)],je.prototype,"blockedFromAncestor",void 0),P([I(),_(String),j(V),p(),K("design:type",String)],je.prototype,"permissionCategory",void 0),P([_(String),p(),K("design:type",String)],je.prototype,"reason",void 0),P([y(),K("design:type",Date)],je.prototype,"createdAt",void 0),P([l(),K("design:type",Date)],je.prototype,"updatedAt",void 0),je=P([u("inheritance_blocks"),U(),K("design:paramtypes",[Object])],je);let Ue=class extends ge{constructor(e){super(e)}};P([a({type:String}),d(),K("design:type",String)],Ue.prototype,"id",void 0),P([c(()=>Ke,H,!1,void 0,"fk_org_units_tenant"),I(),K("design:type",Object)],Ue.prototype,"tenant",void 0),P([c(()=>Ue,H,!1,void 0,"fk_org_units_parent"),K("design:type",Object)],Ue.prototype,"parent",void 0),P([h(()=>Ue,H,!1),K("design:type",Array)],Ue.prototype,"children",void 0),P([I(),_(String),p(),K("design:type",String)],Ue.prototype,"name",void 0),P([I(),_(String),p(),K("design:type",String)],Ue.prototype,"path",void 0),P([_(Object),p(),K("design:type",Object)],Ue.prototype,"metadata",void 0),P([h(()=>fe,H,!1),K("design:type",Array)],Ue.prototype,"memberships",void 0),P([h(()=>_e,H,!1),K("design:type",Array)],Ue.prototype,"resources",void 0),P([h(()=>je,H,!1),K("design:type",Array)],Ue.prototype,"inheritanceBlocks",void 0),P([h(()=>ve,H,!1),K("design:type",Array)],Ue.prototype,"ancestorLinks",void 0),P([h(()=>ve,H,!1),K("design:type",Array)],Ue.prototype,"descendantLinks",void 0),P([y(),K("design:type",Date)],Ue.prototype,"createdAt",void 0),P([l(),K("design:type",Date)],Ue.prototype,"updatedAt",void 0),Ue=P([u("org_units"),U(),K("design:paramtypes",[Object])],Ue);let Pe=class extends ge{constructor(e){super(e)}};P([a({type:String}),d(),K("design:type",String)],Pe.prototype,"id",void 0),P([c(()=>Ke,Y,!1,void 0,"fk_storage_bindings_tenant"),I(),K("design:type",Object)],Pe.prototype,"tenant",void 0),P([I(),_(String),j(Q),p(),K("design:type",String)],Pe.prototype,"storageKind",void 0),P([I(),_(String),j(J),p(),K("design:type",String)],Pe.prototype,"bindingKind",void 0),P([I(),_(String),p(),K("design:type",String)],Pe.prototype,"bindingKey",void 0),P([I(),_(String),p(),K("design:type",String)],Pe.prototype,"region",void 0),P([_(Object),p(),K("design:type",Object)],Pe.prototype,"config",void 0),P([y(),K("design:type",Date)],Pe.prototype,"createdAt",void 0),P([l(),K("design:type",Date)],Pe.prototype,"updatedAt",void 0),Pe=P([u("storage_bindings"),U(),K("design:paramtypes",[Object])],Pe);let Ke=class extends ge{constructor(e){super(e)}};P([a({type:String}),d(),K("design:type",String)],Ke.prototype,"id",void 0),P([g(),I(),_(String),p(),K("design:type",String)],Ke.prototype,"slug",void 0),P([I(),_(String),p(),K("design:type",String)],Ke.prototype,"name",void 0),P([I(),_(String),j(z),p(),K("design:type",String)],Ke.prototype,"isolationTier",void 0),P([h(()=>Ue,H,!1),K("design:type",Array)],Ke.prototype,"orgUnits",void 0),P([h(()=>he,H,!1),K("design:type",Array)],Ke.prototype,"memberships",void 0),P([h(()=>Ie,H,!1),K("design:type",Array)],Ke.prototype,"principals",void 0),P([h(()=>Pe,H,!1),K("design:type",Array)],Ke.prototype,"storageBindings",void 0),P([y(),K("design:type",Date)],Ke.prototype,"createdAt",void 0),P([l(),K("design:type",Date)],Ke.prototype,"updatedAt",void 0),Ke=P([u("tenants"),U(),K("design:paramtypes",[Object])],Ke);let ke=class extends ge{constructor(e){super(e)}};P([a({type:String}),d(),K("design:type",String)],ke.prototype,"id",void 0),P([c(()=>Ke,Y,!1,void 0,"fk_tenant_profiles_tenant"),I(),K("design:type",Object)],ke.prototype,"tenant",void 0),P([I(),_(String),p(),K("design:type",String)],ke.prototype,"profileKey",void 0),P([_(Object),p(),K("design:type",Object)],ke.prototype,"metadata",void 0),P([y(),K("design:type",Date)],ke.prototype,"createdAt",void 0),P([l(),K("design:type",Date)],ke.prototype,"updatedAt",void 0),ke=P([u("tenant_profiles"),U(),K("design:paramtypes",[Object])],ke);let Fe=class extends ge{constructor(e){super(e)}};P([a({type:String}),d(),K("design:type",String)],Fe.prototype,"id",void 0),P([c(()=>Ue,Y,!1,void 0,"fk_org_unit_profiles_org_unit"),I(),K("design:type",Object)],Fe.prototype,"orgUnit",void 0),P([I(),_(String),p(),K("design:type",String)],Fe.prototype,"profileKey",void 0),P([_(Object),p(),K("design:type",Object)],Fe.prototype,"metadata",void 0),P([y(),K("design:type",Date)],Fe.prototype,"createdAt",void 0),P([l(),K("design:type",Date)],Fe.prototype,"updatedAt",void 0),Fe=P([u("org_unit_profiles"),U(),K("design:paramtypes",[Object])],Fe);let Re=class extends ge{constructor(e){super(e)}};P([a({type:String}),d(),K("design:type",String)],Re.prototype,"id",void 0),P([c(()=>Ke,Y,!1,void 0,"fk_group_memberships_tenant"),I(),K("design:type",Object)],Re.prototype,"tenant",void 0),P([c(()=>Te,Y,!1,void 0,"fk_group_memberships_group"),I(),K("design:type",Object)],Re.prototype,"group",void 0),P([c(()=>Ie,Y,!1,void 0,"fk_group_memberships_principal"),I(),K("design:type",Object)],Re.prototype,"principal",void 0),P([_(Object),p(),K("design:type",Object)],Re.prototype,"metadata",void 0),P([y(),K("design:type",Date)],Re.prototype,"createdAt",void 0),Re=P([u("group_memberships"),U(),K("design:paramtypes",[Object])],Re);let Te=class extends ge{constructor(e){super(e)}};P([a({type:String}),d(),K("design:type",String)],Te.prototype,"id",void 0),P([c(()=>Ke,H,!1,void 0,"fk_groups_tenant"),I(),K("design:type",Object)],Te.prototype,"tenant",void 0),P([c(()=>Ue,X,!1,void 0,"fk_groups_org_unit"),K("design:type",Object)],Te.prototype,"orgUnit",void 0),P([I(),_(String),p(),K("design:type",String)],Te.prototype,"name",void 0),P([_(Object),p(),K("design:type",Object)],Te.prototype,"metadata",void 0),P([h(()=>Re,H,!1),K("design:type",Array)],Te.prototype,"members",void 0),P([y(),K("design:type",Date)],Te.prototype,"createdAt",void 0),P([l(),K("design:type",Date)],Te.prototype,"updatedAt",void 0),Te=P([u("groups"),U(),K("design:paramtypes",[Object])],Te);let xe=class extends ge{constructor(e){super(e)}};P([a({type:String}),d(),K("design:type",String)],xe.prototype,"id",void 0),P([c(()=>Ke,Y,!1,void 0,"fk_effective_permissions_tenant"),I(),K("design:type",Object)],xe.prototype,"tenant",void 0),P([c(()=>Ie,Y,!1,void 0,"fk_effective_permissions_principal"),I(),K("design:type",Object)],xe.prototype,"principal",void 0),P([I(),_(String),p(),K("design:type",String)],xe.prototype,"permissionKey",void 0),P([I(),_(String),j(W),p(),K("design:type",String)],xe.prototype,"scopeKind",void 0),P([I(),_(String),p(),K("design:type",String)],xe.prototype,"scopeId",void 0),P([I(),_(String),p(),K("design:type",String)],xe.prototype,"sourceKind",void 0),P([I(),_(String),p(),K("design:type",String)],xe.prototype,"sourceId",void 0),P([p(),K("design:type",Date)],xe.prototype,"startsAt",void 0),P([p(),K("design:type",Date)],xe.prototype,"expiresAt",void 0),P([y(),K("design:type",Date)],xe.prototype,"createdAt",void 0),xe=P([u("effective_permissions"),U(),K("design:paramtypes",[Object])],xe);class Be extends ye{constructor(){super(ke)}async createProfile(e,t,i,...r){return this.create({tenant:e,profileKey:t,metadata:i},...r)}async listForTenant(e,...t){return(await this.listAll(...t)).filter(t=>oe(t.tenant,e))}async deleteForTenant(e,...t){for(const i of await this.listForTenant(e,...t))await this.deleteById(i.id,...t)}}class De extends ye{constructor(){super(Fe)}async createProfile(e,t,i,...r){return this.create({orgUnit:e,profileKey:t,metadata:i},...r)}async listForOrgUnit(e,...t){return(await this.listAll(...t)).filter(t=>ae(t.orgUnit,e))}}class Ce extends ye{constructor(){super(ve)}async listAncestors(e,t,...i){return(await this.listAll(...i)).filter(i=>oe(i.tenant,e)&&ae(i.descendant,t)).sort((e,t)=>e.depth-t.depth)}async listDescendants(e,t,...i){return(await this.listAll(...i)).filter(i=>oe(i.tenant,e)&&ae(i.ancestor,t)).sort((e,t)=>e.depth-t.depth)}async isAncestorOf(e,t,i,...r){return(await this.listAncestors(e,i,...r)).some(e=>ae(e.ancestor,t))}async createSelfLink(e,t,...i){return this.create({tenant:e,ancestor:t,descendant:t,depth:0},...i)}async insertAncestorLinksForNewChild(e,t,i,...r){const n=await this.listAncestors(e,t,...r);for(const t of n)await this.create({tenant:e,ancestor:t.ancestor,descendant:i,depth:t.depth+1},...r)}async deleteLinksForSubtree(e,t,...i){const r=await this.listDescendants(e,t,...i),n=new Set([t,...r.map(e=>ue(e.descendant))]),s=new Set([t,...r.map(e=>ue(e.ancestor))]),o=(await this.listAll(...i)).filter(t=>oe(t.tenant,e)&&(n.has(ue(t.descendant))||s.has(ue(t.ancestor))));for(const e of o)await this.deleteById(e.id,...i)}}class Ee extends ye{constructor(){super(je)}async blockCategory(e,t,i,r,n,...s){return this.create({tenant:e,orgUnit:t,blockedFromAncestor:r,permissionCategory:i,reason:n},...s)}async unblockCategory(e,...t){await this.deleteById(e,...t)}async listForOrgUnit(e,t,...i){return(await this.listAll(...i)).filter(i=>oe(i.tenant,e)&&ae(i.orgUnit,t))}async categoryBlockedForAncestor(e,t,i,r,...n){return(await this.listForOrgUnit(e,t,...n)).some(e=>e.permissionCategory===r&&(!e.blockedFromAncestor||ae(e.blockedFromAncestor,i)))}}class Ge extends ye{constructor(){super(Ke)}async createTenant(e,...t){return this.create({slug:e.slug,name:e.name,isolationTier:e.isolationTier??B.Pooled},...t)}async getBySlug(e,...t){return this.findOneBy("slug",e,...t)}async renameTenant(e,t,...i){return this.updateOne(e,{name:t},...i)}async changeSlug(e,t,...i){return this.updateOne(e,{slug:t},...i)}async setIsolationTier(e,t,...i){return this.updateOne(e,{isolationTier:t},...i)}async deleteTenantControlled(e,...t){await this.deleteById(e,...t)}}async function Ne(e,t,...i){for(const r of t)await e.deleteById(r.id,...i)}class $e extends ye{constructor(){super(Ue)}orgUnitPath(e,t){const i=de(t);return e?`${e.replace(/\/+$/,"")}/${i}`:"/"+i}async createProfileIfNeeded(e,t,i,...r){t&&await(new De).createProfile(e,t,i,...r)}async createRoot(e,t,i,r,n,...s){const o=await this.create({tenant:e,name:t,path:this.orgUnitPath(void 0,t),metadata:i},...s);return await this.createProfileIfNeeded(o.id,r,n,...s),await(new Ce).createSelfLink(e,o.id,...s),o}async createChild(e,...t){const i=e.parentOrgUnitId?await this.getById(e.parentOrgUnitId,...t):void 0,r=await this.create({tenant:e.tenantId,parent:i?.id??e.parentOrgUnitId,name:e.name,path:this.orgUnitPath(i?.path,e.name),metadata:e.metadata},...t);await this.createProfileIfNeeded(r.id,e.profileKey,e.profileMetadata,...t);const n=new Ce;return await n.createSelfLink(e.tenantId,r.id,...t),e.parentOrgUnitId&&await n.insertAncestorLinksForNewChild(e.tenantId,e.parentOrgUnitId,r.id,...t),r}async listChildren(e,...t){return(await this.listAll(...t)).filter(t=>ae(t.parent,e))}async listTenantOrgUnits(e,...t){return(await this.listAll(...t)).filter(t=>oe(t.tenant,e))}async listDescendantOrgUnits(e,t,i=!1,...r){const n=await(new Ce).listDescendants(e,t,...r),s=new Set(n.map(e=>ue(e.descendant)));return i&&s.add(t),(await this.listTenantOrgUnits(e,...r)).filter(e=>s.has(e.id))}async listAncestorOrgUnits(e,t,i=!1,...r){const n=await(new Ce).listAncestors(e,t,...r),s=new Set(n.map(e=>ue(e.ancestor)));return i&&s.add(t),(await this.listTenantOrgUnits(e,...r)).filter(e=>s.has(e.id))}async renameOrgUnit(e,t,...i){const r=await this.getById(e,...i);return this.updateOne(e,{name:t,path:this.orgUnitPath(r.path.includes("/")?r.path.replace(/\/[^/]+$/,""):void 0,t)},...i)}async moveOrgUnit(e,t,i,...r){const n=await this.getById(i,...r),s=await this.getById(t,...r),o=await this.updateOne(t,{parent:n.id,path:this.orgUnitPath(n.path,s.name)},...r);return await this.rebuildTenantClosure(e,...r),o}async rebuildTenantClosure(e,...t){const i=new Ce,r=await i.listAll(...t);await Ne(i,r.filter(t=>oe(t.tenant,e)),...t);const n=(await this.listTenantOrgUnits(e,...t)).sort((e,t)=>e.path.split("/").filter(Boolean).length-t.path.split("/").filter(Boolean).length);for(const r of n)await i.createSelfLink(e,r.id,...t),r.parent&&await i.insertAncestorLinksForNewChild(e,ue(r.parent),r.id,...t)}async deleteOrgUnitTree(e,t,...i){const r=new Ce,n=await this.listDescendantOrgUnits(e,t,!0,...i),s=new Set(n.map(e=>e.id)),o=(await this.listTenantOrgUnits(e,...i)).filter(e=>s.has(e.id));await Ne(this,o,...i),await r.deleteLinksForSubtree(e,t,...i)}}P([m(),K("design:type",Function),K("design:paramtypes",[String,String,Object,String,Object,Object]),K("design:returntype",Promise)],$e.prototype,"createRoot",null),P([m(),K("design:type",Function),K("design:paramtypes",[Object,Object]),K("design:returntype",Promise)],$e.prototype,"createChild",null),P([m(),K("design:type",Function),K("design:paramtypes",[String,String,String,Object]),K("design:returntype",Promise)],$e.prototype,"moveOrgUnit",null),P([m(),K("design:type",Function),K("design:paramtypes",[String,Object]),K("design:returntype",Promise)],$e.prototype,"rebuildTenantClosure",null),P([m(),K("design:type",Function),K("design:paramtypes",[String,String,Object]),K("design:returntype",Promise)],$e.prototype,"deleteOrgUnitTree",null);class Le extends ye{constructor(){super(me)}async createUser(e,...t){return this.create({email:e.email,phone:e.phone,displayName:e.displayName},...t)}async getByEmail(e,...t){return(await this.listAll(...t)).find(t=>t.email===e)}async updateDisplayName(e,t,...i){return this.updateOne(e,{displayName:t},...i)}async updateEmail(e,t,...i){return this.updateOne(e,{email:t},...i)}async updatePhone(e,t,...i){return this.updateOne(e,{phone:t},...i)}}class ze extends ye{constructor(){super(Ie)}async createPrincipal(e,t,i,...r){return this.create({tenant:e,kind:t,subjectId:i},...r)}async getForSubject(e,t,i,...r){return(await this.listAll(...r)).find(r=>oe(r.tenant,e)&&r.kind===t&&r.subjectId===i)}async getOrCreateForSubject(e,t,i,...r){return await this.getForSubject(e,t,i,...r)??await this.createPrincipal(e,t,i,...r)}async getUserPrincipal(e,t,...i){return this.getOrCreateForSubject(e,C.User,t,...i)}async getGroupPrincipal(e,t,...i){return this.getOrCreateForSubject(e,C.Group,t,...i)}}class Me extends ye{constructor(){super(he)}async addUserToTenant(e,t,i=D.Active,...r){return this.create({tenant:e,user:t,status:i},...r)}async setStatus(e,t,...i){return this.updateOne(e,{status:t},...i)}async listUserTenants(e,...t){return(await this.listAll(...t)).filter(t=>ae(t.user,e))}async listTenantUsers(e,...t){return(await this.listAll(...t)).filter(t=>oe(t.tenant,e))}async removeUserFromTenant(e,...t){await this.deleteById(e,...t)}}class qe extends ye{constructor(){super(fe)}async addUserToOrgUnit(e,t,i,r=D.Active,...n){return this.create({tenant:e,orgUnit:t,user:i,status:r},...n)}async setStatus(e,t,...i){return this.updateOne(e,{status:t},...i)}async listUserOrgUnits(e,...t){return(await this.listAll(...t)).filter(t=>ae(t.user,e))}async listOrgUnitUsers(e,...t){return(await this.listAll(...t)).filter(t=>ae(t.orgUnit,e))}async removeUserFromOrgUnit(e,...t){await this.deleteById(e,...t)}}class We extends ye{constructor(){super(Te)}async createGroup(e,t,i,r,...n){return this.create({tenant:e,orgUnit:i,name:t,metadata:r},...n)}async renameGroup(e,t,...i){return this.updateOne(e,{name:t},...i)}async moveGroupToOrgUnit(e,t,...i){return this.updateOne(e,{orgUnit:t},...i)}async listTenantGroups(e,...t){return(await this.listAll(...t)).filter(t=>oe(t.tenant,e))}}class Ve extends ye{constructor(){super(Re)}async addPrincipalToGroup(e,t,i,r,...n){return this.create({tenant:e,group:t,principal:i,metadata:r},...n)}async listGroupMembers(e,...t){return(await this.listAll(...t)).filter(t=>ae(t.group,e))}async listPrincipalGroups(e,...t){return(await this.listAll(...t)).filter(t=>ae(t.principal,e))}async removePrincipalFromGroup(e,...t){await this.deleteById(e,...t)}async resolveGroupPrincipalIdsForPrincipal(e,...t){const i=new ze,r=await this.listPrincipalGroups(e,...t);return await Promise.all(r.map(async e=>{const r=ue(e.tenant),n=ue(e.group);return(await i.getGroupPrincipal(r,n,...t)).id}))}}class Ze extends ye{constructor(){super(we)}async createPermission(e,...t){return this.create({key:e.key,category:e.category,description:e.description},...t)}async getByKey(e,...t){return(await this.listAll(...t)).find(t=>t.key===e)}async listByCategory(e,...t){return(await this.listAll(...t)).filter(t=>t.category===e)}async updateDescription(e,t,...i){return this.updateOne(e,{description:t},...i)}}class Qe extends ye{constructor(){super(Se)}async createRole(e,...t){return this.create({tenant:e.tenantId,key:e.key,name:e.name,description:e.description,metadata:e.metadata},...t)}async getSystemRoleByKey(e,...t){const i=(await this.listAll(...t)).find(t=>!t.tenant&&t.key===e);if(!i)throw Error(`Role "${e}" not found`);return i}async getTenantRoleByKey(e,t,...i){const r=(await this.listAll(...i)).find(i=>oe(i.tenant,e)&&i.key===t);if(!r)throw Error(`Role "${t}" not found for tenant ${e}`);return r}async renameRole(e,t,...i){return this.updateOne(e,{name:t},...i)}async updateRoleMetadata(e,t,...i){return this.updateOne(e,{metadata:t},...i)}async listTenantRoles(e,t=!1,...i){return(await this.listAll(...i)).filter(i=>t&&!i.tenant||oe(i.tenant,e))}}class Je extends ye{constructor(){super(be)}async addPermissionToRole(e,t,...i){return this.create({role:e,permission:t},...i)}async addPermissionKeyToRole(e,t,...i){const r=await(new Ze).getByKey(t,...i);return this.addPermissionToRole(e,r.id,...i)}async removePermissionFromRole(e,...t){await this.deleteById(e,...t)}async listRolePermissions(e,...t){return(await this.listAll(...t)).filter(t=>ae(t.role,e))}async listPermissionRoles(e,...t){return(await this.listAll(...t)).filter(t=>ae(t.permission,e))}async replaceRolePermissions(e,t,...i){const r=await this.listRolePermissions(e,...i);return await(async(e,t,...i)=>{for(const r of t)await e.deleteById(r.id,...i)})(this,r,...i),Promise.all(t.map(t=>this.addPermissionToRole(e,t,...i)))}async createRoleWithPermissions(e,t,...i){const r=await(new Qe).createRole(e,...i);for(const e of t)await this.addPermissionKeyToRole(r.id,e,...i);return r}}class He extends ye{constructor(){super(Ae)}async assignRole(e,...t){return this.create({tenant:e.tenantId,principal:e.principalId,role:e.roleId,scopeKind:e.scopeKind,scopeId:e.scopeId,inheritDown:e.inheritDown??!1,startsAt:e.startsAt,expiresAt:e.expiresAt,conditions:e.conditions},...t)}async revokeAssignment(e,...t){await this.deleteById(e,...t)}async listPrincipalAssignments(e,t,...i){return(await this.listAll(...i)).filter(i=>oe(i.tenant,e)&&ae(i.principal,t))}async listRoleAssignments(e,...t){return(await this.listAll(...t)).filter(t=>ae(t.role,e))}async listTenantAssignments(e,...t){return(await this.listAll(...t)).filter(t=>oe(t.tenant,e))}async updateAssignmentWindow(e,t,i,...r){return this.updateOne(e,{startsAt:t,expiresAt:i},...r)}}class Xe extends ye{constructor(){super(xe)}async listForPrincipal(e,t,...i){return(await this.listAll(...i)).filter(i=>oe(i.tenant,e)&&ae(i.principal,t))}async listForScope(e,t,i,...r){return(await this.listAll(...r)).filter(r=>oe(r.tenant,e)&&r.scopeKind===t&&r.scopeId===i)}async hasPermission(e,t,i,r,n,s,...o){return(await this.listForPrincipal(e,t,...o)).some(e=>!(e.permissionKey!==i||e.scopeKind!==r||e.scopeId!==n||e.startsAt&&s&&e.startsAt>s||e.expiresAt&&s&&e.expiresAt<s))}async deleteForPrincipal(e,t,...i){for(const r of await this.listForPrincipal(e,t,...i))await this.deleteById(r.id,...i)}async deleteForTenant(e,...t){for(const i of(await this.listAll(...t)).filter(t=>oe(t.tenant,e)))await this.deleteById(i.id,...t)}async rebuildForPrincipal(e,t,...i){await this.deleteForPrincipal(e,t,...i);const r=new He,n=new Je,s=new Ze,o=new Ve,a=new ze,d=new Ce,c=new Ee,p=[],y=await r.listPrincipalAssignments(e,t,...i),l=await o.listPrincipalGroups(t,...i),u=[...y,...(await Promise.all(l.map(async t=>{const n=await a.getGroupPrincipal(ue(t.tenant),ue(t.group),...i);return r.listPrincipalAssignments(e,n.id,...i)}))).flat()];for(const r of u){const o=await n.listRolePermissions(ue(r.role),...i),a=await Promise.all(o.map(async e=>s.findOneBy("id",ue(e.permission),...i)));for(const n of a){if(!n)continue;const s=r.scopeKind,o=r.scopeId,a=[];if(s===E.Tenant)a.push({scopeKind:s,scopeId:e});else if(s===E.Resource)a.push({scopeKind:s,scopeId:o});else if(s!==E.OrgUnit||r.inheritDown){if(s===E.OrgUnit&&r.inheritDown){const t=await d.listDescendants(e,o,...i);a.push(...t.map(e=>({scopeKind:s,scopeId:ue(e.descendant)})))}}else a.push({scopeKind:s,scopeId:o});for(const d of a)s===E.OrgUnit&&r.inheritDown&&d.scopeId!==o&&await c.categoryBlockedForAncestor(e,d.scopeId,o,n.category,...i)||p.push({id:"",tenantId:e,principalId:t,permissionKey:n.key,scopeKind:d.scopeKind,scopeId:d.scopeId,sourceKind:"role_assignment",sourceId:r.id,startsAt:r.startsAt,expiresAt:r.expiresAt})}}return await Promise.all(p.map(e=>this.create({tenant:e.tenantId,principal:e.principalId,permissionKey:e.permissionKey,scopeKind:e.scopeKind,scopeId:e.scopeId,sourceKind:e.sourceKind,sourceId:e.sourceId,startsAt:e.startsAt,expiresAt:e.expiresAt},...i)))}async rebuildForTenant(e,...t){const i=(await(new ze).listAll(...t)).filter(t=>oe(t.tenant,e));for(const r of i)await this.rebuildForPrincipal(e,r.id,...t)}}P([m(),K("design:type",Function),K("design:paramtypes",[String,String,Object]),K("design:returntype",Promise)],Xe.prototype,"rebuildForPrincipal",null),P([m(),K("design:type",Function),K("design:paramtypes",[String,Object]),K("design:returntype",Promise)],Xe.prototype,"rebuildForTenant",null);class Ye extends ye{constructor(){super(_e)}async registerResource(e,...t){return this.create({tenant:e.tenantId,orgUnit:e.orgUnitId,resourceType:e.resourceType,resourceId:e.resourceId,visibility:e.visibility,owner:e.ownerPrincipalId,sensitivity:e.sensitivity,metadata:e.metadata},...t)}async getByDomainResource(e,t,i,...r){return(await this.listAll(...r)).find(r=>oe(r.tenant,e)&&r.resourceType===t&&r.resourceId===i)}async moveResourceToOrgUnit(e,t,...i){return this.updateOne(e,{orgUnit:t},...i)}async setVisibility(e,t,...i){return this.updateOne(e,{visibility:t},...i)}async transferOwnership(e,t,...i){return this.updateOne(e,{owner:t},...i)}async listOrgUnitResources(e,...t){return(await this.listAll(...t)).filter(t=>ae(t.orgUnit,e))}async listTenantResources(e,...t){return(await this.listAll(...t)).filter(t=>oe(t.tenant,e))}}class et extends ye{constructor(){super(Oe)}async grantResource(e,...t){return this.create({tenant:e.tenantId,resource:e.resourceId,principal:e.principalId,permissionKey:e.permissionKey,startsAt:e.startsAt,expiresAt:e.expiresAt,conditions:e.conditions,createdBy:e.createdByPrincipalId},...t)}async revokeGrant(e,...t){await this.deleteById(e,...t)}async listResourceGrants(e,...t){return(await this.listAll(...t)).filter(t=>ae(t.resource,e))}async listPrincipalGrants(e,t,...i){return(await this.listAll(...i)).filter(i=>oe(i.tenant,e)&&ae(i.principal,t))}async hasGrant(e,t,i,r,n,...s){return(await this.listPrincipalGrants(e,t,...s)).some(e=>ae(e.resource,i)&&e.permissionKey===r&&(!e.startsAt||!n||e.startsAt<=n)&&(!e.expiresAt||!n||e.expiresAt>=n))}async deleteAllForResource(e,...t){for(const i of await this.listResourceGrants(e,...t))await this.deleteById(i.id,...t)}}class tt{async unregisterResource(e,...t){await(new et).deleteAllForResource(e,...t),await(new Ye).deleteById(e,...t)}async resolveResourceScope(e,...t){const i=await(new Ye).getById(e,...t);return{tenantId:ue(i.tenant),orgUnitId:ue(i.orgUnit),visibility:i.visibility,ownerPrincipalId:i.owner?ue(i.owner):void 0}}}class it extends ye{constructor(){super(Pe)}async createBinding(e,...t){return this.create({tenant:e.tenantId,storageKind:e.storageKind,bindingKind:e.bindingKind,bindingKey:e.bindingKey,region:e.region,config:e.config},...t)}async listTenantBindings(e,...t){return(await this.listAll(...t)).filter(t=>ue(t.tenant)===e)}async getBinding(e,t,...i){return(await this.listTenantBindings(e,...i)).find(e=>e.storageKind===t)}async setBindingConfig(e,t,...i){return this.updateOne(e,{config:t},...i)}async promoteToDedicated(e,t,i,r,...n){return this.updateOne(e,{bindingKind:L.Dedicated,bindingKey:t,region:i,config:r},...n)}async setShared(e,t,i,r,...n){return this.updateOne(e,{bindingKind:L.Shared,bindingKey:t,region:i,config:r},...n)}}class rt{constructor(){this.tenantService=new Ge,this.tenantProfileService=new Be,this.orgUnitService=new $e,this.orgUnitProfileService=new De,this.userService=new Le,this.membershipService=new Me,this.principalService=new ze,this.permissionService=new Ze,this.roleService=new Qe,this.rolePermissionService=new Je,this.roleAssignmentService=new He,this.effectivePermissionService=new Xe}async bootstrapTenantFromTemplate(e,...t){const i=await this.tenantService.createTenant(e.tenant,...t);e.tenant.profileKey&&await this.tenantProfileService.createProfile(i.id,e.tenant.profileKey,e.tenant.profileMetadata,...t);const r=async(e,n)=>{const s=void 0===e?await this.orgUnitService.createRoot(i.id,n.name,n.metadata,n.profileKey,n.metadata,...t):await this.orgUnitService.createChild({tenantId:i.id,parentOrgUnitId:e,name:n.name,metadata:n.metadata,profileKey:n.profileKey,profileMetadata:n.metadata},...t);for(const e of n.children??[])await r(s.id,e);return s},n=await r(void 0,e.rootOrgUnit),s=await this.userService.createUser(e.ownerUser,...t);await this.membershipService.addUserToTenant(i.id,s.id,D.Active,...t);const o=await this.principalService.getUserPrincipal(i.id,s.id,...t);for(const i of e.permissions)await this.permissionService.createPermission(i,...t);for(const r of e.roles){const e=await this.roleService.createRole({tenantId:i.id,key:r.key,name:r.name,description:r.description},...t);for(const i of r.permissionKeys)await this.rolePermissionService.addPermissionKeyToRole(e.id,i,...t)}const a=await this.roleService.getTenantRoleByKey(i.id,e.ownerRoleKey,...t);return await this.roleAssignmentService.assignRole({tenantId:i.id,principalId:o.id,roleId:a.id,scopeKind:E.OrgUnit,scopeId:n.id,inheritDown:!0},...t),await this.effectivePermissionService.rebuildForPrincipal(i.id,o.id,...t),{tenantId:i.id,rootOrgUnitId:n.id,ownerUserId:s.id,ownerPrincipalId:o.id}}}P([m(),K("design:type",Function),K("design:paramtypes",[Object,Object]),K("design:returntype",Promise)],rt.prototype,"bootstrapTenantFromTemplate",null);class nt{constructor(){this.membershipService=new Me,this.orgMembershipService=new qe,this.principalService=new ze,this.roleService=new Qe,this.roleAssignmentService=new He,this.effectivePermissionService=new Xe}async onboardUserToTenantAndOrgUnit(e,t,i,r,...n){await this.membershipService.addUserToTenant(e,t,D.Active,...n),await this.orgMembershipService.addUserToOrgUnit(e,i,t,D.Active,...n);const s=await this.principalService.getUserPrincipal(e,t,...n),o=await this.roleService.getTenantRoleByKey(e,r,...n);return await this.roleAssignmentService.assignRole({tenantId:e,principalId:s.id,roleId:o.id,scopeKind:E.OrgUnit,scopeId:i,inheritDown:!0},...n),await this.effectivePermissionService.rebuildForPrincipal(e,s.id,...n),{principalId:s.id}}async changeUserOrgRole(e,t,i,r,n,...s){const o=await this.roleService.getTenantRoleByKey(e,r,...s),a=await this.roleAssignmentService.listPrincipalAssignments(e,t,...s);for(const e of a.filter(e=>e.scopeKind===E.OrgUnit&&e.scopeId===i))await this.roleAssignmentService.revokeAssignment(e.id,...s);await this.roleAssignmentService.assignRole({tenantId:e,principalId:t,roleId:o.id,scopeKind:E.OrgUnit,scopeId:i,inheritDown:n},...s),await this.effectivePermissionService.rebuildForPrincipal(e,t,...s)}async suspendUserInTenant(e,t,i,...r){await this.membershipService.setStatus(e,D.Suspended,...r),await this.effectivePermissionService.deleteForPrincipal(t,i,...r)}async reactivateUserInTenant(e,t,i,...r){await this.membershipService.setStatus(e,D.Active,...r),await this.effectivePermissionService.rebuildForPrincipal(t,i,...r)}}P([m(),K("design:type",Function),K("design:paramtypes",[String,String,String,String,Object]),K("design:returntype",Promise)],nt.prototype,"onboardUserToTenantAndOrgUnit",null),P([m(),K("design:type",Function),K("design:paramtypes",[String,String,String,String,Boolean,Object]),K("design:returntype",Promise)],nt.prototype,"changeUserOrgRole",null),P([m(),K("design:type",Function),K("design:paramtypes",[String,String,String,Object]),K("design:returntype",Promise)],nt.prototype,"suspendUserInTenant",null),P([m(),K("design:type",Function),K("design:paramtypes",[String,String,String,Object]),K("design:returntype",Promise)],nt.prototype,"reactivateUserInTenant",null);class st{constructor(e={}){this.dataSources=e}async canAccess(e,...t){const i=e.at??new Date;if(e.scopeKind&&e.scopeId)return se(await(this.dataSources.listEffectivePermissionsForScope?.(e.tenantId,e.scopeKind,e.scopeId))).some(t=>t.permissionKey===e.permissionKey&&ce(i,t.startsAt,t.expiresAt));if(!e.resourceProtectedId)return!1;const r=await(this.dataSources.loadResource?.(e.tenantId,e.resourceProtectedId));if(!r)return!1;if(r.tenantId!==e.tenantId)return!1;if(r.ownerPrincipalId===e.principalId)return!0;if(se(await(this.dataSources.listResourceGrants?.(e.tenantId,e.resourceProtectedId))).filter(t=>t.principalId===e.principalId&&t.permissionKey===e.permissionKey&&ce(i,t.startsAt,t.expiresAt)).length>0)return!0;const n=r.visibility;return n!==N.Private&&n!==N.ResourceAcl&&(n===N.OrgUnit||n===N.OrgSubtree?se(await(this.dataSources.listEffectivePermissionsForScope?.(e.tenantId,E.OrgUnit,r.orgUnitId))).some(t=>t.permissionKey===e.permissionKey&&ce(i,t.startsAt,t.expiresAt)):n===N.Tenant&&se(await(this.dataSources.listEffectivePermissionsForScope?.(e.tenantId,E.Tenant,e.tenantId))).some(t=>t.permissionKey===e.permissionKey&&ce(i,t.startsAt,t.expiresAt)))}async requireAccess(e,...t){if(!await this.canAccess(e,...t))throw new f(`Access denied for ${e.permissionKey} on ${e.resourceProtectedId??(i=e.scopeKind??E.Resource,r=e.scopeId??"",`${i}:${r}`)}`);var i,r}async buildAccessContext(e,t,...i){return pe({tenantId:e,principalId:t,permissions:se(await(this.dataSources.listEffectivePermissions?.(e,t))),grants:se(await(this.dataSources.listPrincipalGrants?.(e,t)))})}async buildArangoContext(e,t,i,...r){const n=await this.buildAccessContext(e,t,...r),s=n.allowedOrgUnitIdsByPermission[i]??[],o=n.resourceGrants.filter(e=>e.permissionKey===i).map(e=>e.resourceId);return te({tenantId:e,principalId:t,permissionKey:i,allowedOrgUnitIds:s,allowedResourceIds:o})}async buildQdrantFilter(e,t,i,...r){const n=await this.buildAccessContext(e,t,...r);return ie({tenantId:e,principalId:t,allowedOrgUnitIds:n.allowedOrgUnitIdsByPermission[i]??[],allowedResourceIds:n.resourceGrants.filter(e=>e.permissionKey===i).map(e=>e.resourceId)})}}const ot="featureFlag",at="FEATURE_FLAG",dt="feature-flags:model",ct="feature-flags:auth",pt="feature-flags:block",yt="feature-flags:render-if",lt="feature-flags:hide-on";function ut(e){const t=e.trim();if(!t)return t;if(/^[a-z][a-zA-Z0-9]*$/.test(t))return t;const i=t.toLowerCase().replace(/[_\-\s]+/g," ").split(" ").filter(Boolean);if(0===i.length)return t;const[r,...n]=i;return[r,...n.map(e=>e?e.charAt(0).toUpperCase()+e.slice(1):e)].join("").replace(/[^a-zA-Z0-9]/g,"")}function gt(e){if("string"!=typeof e)return e;const t=e.trim();if("true"===t)return!0;if("false"===t)return!1;if(/^-?\d+(\.\d+)?$/.test(t))return Number(t);if(t.startsWith("{")&&t.endsWith("}")||t.startsWith("[")&&t.endsWith("]"))try{return JSON.parse(t)}catch{return e}return e}function ht(e){if(void 0===e)return;if(!0===e)return!0;if(!e||"object"!=typeof e||Array.isArray(e))return gt(e);const t={};return Object.entries(e).forEach(([e,i])=>{const r=(e=>{if(!e)return e;if(/^[a-z][a-zA-Z0-9]*$/.test(e))return e;const t=e.replace(/[\s-]+/g,"_").split("_").filter(Boolean);if(0===t.length)return e;const[i,...r]=t;return[i.toLowerCase(),...r.map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase())].join("")})(e);void 0!==i&&(t[r]=ht(i)??i)}),t}function mt(e){return!e||"object"!=typeof e||Array.isArray(e)?{}:Object.entries(e).reduce((e,[t,i])=>{const r=ut(t),n=ht(i);return void 0!==n&&(e[r]=n),e},{})}function ft(e){return!0===e||!!e&&"object"==typeof e}function vt(e,t){return ft(e?.[ut(t)])}function wt(e,t="any"){return{features:[...new Set(e.map(ut).filter(Boolean))],match:t}}function bt(e,t){if(!e||0===e.features.length)return!0;const i=e.features.filter(e=>vt(t,e));return"all"===e.match?i.length===e.features.length:i.length>0}function St(e,t){return!(!e||0===e.features.length)&&e.features.some(e=>vt(t,e))}function At(e,t){return k.get(e,t)}function Ot(e){return e.trim().toLowerCase()}function It(e){return e.trim()}const _t=i.accumulate({[ot]:{}});async function jt(e=_t){return mt(e.featureFlag)}async function Ut(e,t=_t){return(await jt(t))[ut(e)]}async function Pt(e,t=_t){return!!await Ut(e,t)}let Kt=class extends v{constructor(e){super(e),this.enabled=!0}};P([a(),d(),K("design:type",String)],Kt.prototype,"id",void 0),P([g(),I(),p(),K("design:type",String)],Kt.prototype,"key",void 0),P([p(),K("design:type",Boolean)],Kt.prototype,"enabled",void 0),P([p(),K("design:type",String)],Kt.prototype,"description",void 0),P([p(),K("design:type",String)],Kt.prototype,"scope",void 0),P([p(),K("design:type",Object)],Kt.prototype,"metadata",void 0),P([p(),K("design:type",Object)],Kt.prototype,"config",void 0),P([p(),K("design:type",String)],Kt.prototype,"createdBy",void 0),P([p(),K("design:type",String)],Kt.prototype,"updatedBy",void 0),P([y(),K("design:type",Date)],Kt.prototype,"createdAt",void 0),P([l(),K("design:type",Date)],Kt.prototype,"updatedAt",void 0),Kt=P([u("feature_flags"),U(),K("design:paramtypes",[Object])],Kt);let kt=class extends v{constructor(e){super(e),this.enabled=!0}};P([a(),d(),K("design:type",String)],kt.prototype,"id",void 0),P([I(),p(),K("design:type",String)],kt.prototype,"featureKey",void 0),P([I(),p(),K("design:type",String)],kt.prototype,"subjectType",void 0),P([I(),p(),K("design:type",String)],kt.prototype,"subjectKey",void 0),P([p(),K("design:type",Boolean)],kt.prototype,"enabled",void 0),P([p(),K("design:type",Object)],kt.prototype,"metadata",void 0),P([p(),K("design:type",String)],kt.prototype,"createdBy",void 0),P([p(),K("design:type",String)],kt.prototype,"updatedBy",void 0),P([y(),K("design:type",Date)],kt.prototype,"createdAt",void 0),P([l(),K("design:type",Date)],kt.prototype,"updatedAt",void 0),kt=P([u("feature_flag_access"),U(),K("design:paramtypes",[Object])],kt);class Ft{async readOne(e,t){return(await this.read(t))[ut(e)]}}class Rt extends Ft{async read(e={}){return jt(e.source??{[ot]:{}})}}let Tt=class extends o{constructor(){super(Kt),this.reader=new Rt,this.cachedRegistry={}}async initialize(...e){const t=e[0]??{};t.repository&&(this._repository=t.repository),this.reader=t.reader?"function"==typeof t.reader?new t.reader:t.reader:new Rt;const i={...t.readerConfig??{},source:t.readerConfig?.source??_t};return this.cachedRegistry=await this.refreshCachedRegistry(i,...e),{config:{...t,reader:this.reader,readerConfig:i},client:this.reader}}cloneRegistry(e){return Object.entries(e).reduce((e,[t,i])=>(e[t]=i&&"object"==typeof i&&!Array.isArray(i)?{...i}:i,e),{})}async refreshCachedRegistry(e={},...t){const i=await this.reader.read({...e,source:e.source??_t});let r=[];try{r=await this.repo.select().execute(...t)}catch{r=[]}const n=this.cloneRegistry(i);for(const e of r)n[e.key]=!!e.enabled&&(e.config??!0);return n}setCachedFlag(e){this.cachedRegistry[e.key]=!!e.enabled&&(e.config??!0)}getAccessRepository(){return this.accessRepository??S.forModel(kt)}assertInitialized(){this.reader}normalizeFeatureAccessInput(e){return{...e,featureKey:ut(e.featureKey),subjectType:Ot(e.subjectType),subjectKey:It(e.subjectKey)}}buildAccessCondition(e){let t=A.attr("subjectType").eq(Ot(e.subjectType));return t=t.and(A.attr("subjectKey").eq(It(e.subjectKey))),void 0!==e.enabled&&(t=t.and(A.attr("enabled").eq(e.enabled))),e.featureKeys&&e.featureKeys.length>0&&(t=t.and(A.attr("featureKey").in(e.featureKeys.map(ut)))),t}async create(e,...t){e.key=ut(e.key),e.enabled??=!0;const i=await super.create(e,...t);return this.setCachedFlag(i),i}async update(e,...t){e.key=ut(e.key),e.enabled??=!0;const i=await super.update(e,...t);return this.setCachedFlag(i),i}async findOneBy(e,t,...i){const r="key"===e&&"string"==typeof t?ut(t):t;return this.repo.findOneBy(e,r,...i)}async readAll(e,...t){const i=await this.repo.readAll(e,...t);for(const e of i)this.setCachedFlag(e);return i}async listEnabled(...e){return this.repo.select().where(A.attr("enabled").eq(!0)).execute(...e)}async grantFeatureAccess(e,...t){const i=this.normalizeFeatureAccessInput(e),r=await this.findFeatureAccess(i,...t).catch(()=>{});return r?this.getAccessRepository().update(Object.assign(r,i),...t):this.getAccessRepository().create(new kt(i),...t)}async revokeFeatureAccess(e,...t){const i=await this.findFeatureAccess(e,...t).catch(()=>{});if(i)return this.getAccessRepository().delete(i.id,...t)}async findFeatureAccess(e,...t){const i=this.buildAccessCondition(e),r=(await this.getAccessRepository().select().where(i).execute(...t))[0];if(!r)throw new n(`Feature access for ${Ot(e.subjectType)}:${It(e.subjectKey)} not found`);return r}async listFeatureAccess(e,...t){return this.getAccessRepository().select().where(this.buildAccessCondition(e)).execute(...t)}async resolveFeatureFlagsForSubject(e,...t){this.assertInitialized();const i=await this.listFeatureAccess({...e,enabled:!0},...t),r=[...new Set(i.map(e=>e.featureKey))];if(0===r.length)return{};const n=A.attr("enabled").eq(!0).and(A.attr("key").in(r.map(ut)));return(await this.repo.select().where(n).execute(...t)).reduce((e,t)=>(e[t.key]=t.config??!0,e),{})}async isEnabledForSubject(e,t,...i){return vt(await this.resolveFeatureFlagsForSubject(t,...i),e)}isEnabled(e){this.assertInitialized();const t=ut(e);return vt(this.cachedRegistry,t)}async resolveFeatureFlags(){return this.assertInitialized(),this.cloneRegistry(this.cachedRegistry)}async syncFromEnvironment(e={},...t){this.assertInitialized();const i=await this.reader.read({...e,source:e.source??_t}),r=[];for(const[e,n]of Object.entries(i)){const i=n&&"object"==typeof n&&!Array.isArray(n)?n:{enabled:!!n},{enabled:s,...o}=i,a=ut(e),d=await this.findOneBy("key",a,...t).catch(()=>{}),c=d?Object.assign(d,{enabled:ft(n),description:o.description??d.description,scope:o.scope??d.scope,metadata:o.metadata??d.metadata,config:{...o,enabled:ft(n)}}):new Kt({key:a,enabled:ft(n),description:o.description,scope:o.scope,metadata:o.metadata,config:{...o,enabled:ft(n)}});r.push(d?await this.update(c,...t):await this.create(c,...t))}return this.cachedRegistry=await this.refreshCachedRegistry({...e,source:e.source??_t},...t),r}};var xt;function Bt(e){const t=ut(e);return t?t.charAt(0).toUpperCase()+t.slice(1):t}function Dt(e,t){const i=Bt(e);return void 0===t?"engine"+i:`engine${i}${Bt(t)}`}function Ct(e){const t={};for(const i of e.engines??[]){t[Dt(i.engineId)]=!0;for(const e of i.capabilities??[])t[Dt(i.engineId,e.feature)]="SUPPORTED"===e.verdict}return t}P([w(kt),K("design:type",Object)],Tt.prototype,"accessRepository",void 0),Tt=P([b(Kt),K("design:paramtypes",[])],Tt);class Et extends Ft{constructor(e){super(),this.registry=e}async read(e){return{...this.registry}}}let Gt=xt=class extends Tt{constructor(){const e=super();if(!(this instanceof xt))return Object.assign(Object.create(xt.prototype),e,{capabilityRegistry:{}});this.capabilityRegistry={}}async initialize(...e){const t=e[0]??{};t.repository&&(this._repository=t.repository),this.capabilityRegistry=Ct(t.manifest??{engines:[]});const i=new Et(this.capabilityRegistry);return{config:{...t,reader:i,readerConfig:{...t.readerConfig??{},source:{}}},client:i}}isEngineEnabled(e){return vt(this.capabilityRegistry,Dt(e))}isEngineFeatureEnabled(e,t){return vt(this.capabilityRegistry,Dt(e,t))}isEnabled(e){return vt(this.capabilityRegistry,e)}async resolveFeatureFlags(){return{...this.capabilityRegistry}}async resolveFeatureFlagsForSubject(e,...t){return{...this.capabilityRegistry}}async isEnabledForSubject(e,t,...i){return vt(this.capabilityRegistry,e)}async listEnabled(...e){return Object.entries(this.capabilityRegistry).filter(([,e])=>ft(e)).map(([e])=>new Kt({key:e,enabled:!0,config:{enabled:!0}}))}async syncFromEnvironment(...e){throw new r("Engine capability feature flags are derived from the served engine manifest and are never synced from the environment")}};function Nt(e,t){return void 0===t?e:k.key(e,t.toString())}function $t(e,t,i="any"){const r=wt(t,i);return(t,i,n)=>{if(void 0===i)return F(e,r)(t);const s=Nt(e,i);return n?R(s,r)(t,i,n):T(s,r)(t,i)}}function Lt(...e){return $t(dt,e)}function zt(...e){return $t(ct,e)}function Mt(...e){return $t(pt,e)}function qt(...e){return $t(yt,e)}function Wt(...e){return $t(lt,e)}function Vt(e,t,i){return At(e,Nt(t,i))}function Zt(e,t,i,r){return bt(Vt(e,i,r),t)}function Qt(e,t,i,r){return St(Vt(e,i,r),t)}Gt=xt=P([b(),K("design:paramtypes",[])],Gt);const Jt="##VERSION##",Ht="##COMMIT##",Xt="##FULL_VERSION##",Yt="##PACKAGE##";export{ge as AuthorizationModel,st as AuthzService,ye as BaseModelService,rt as BootstrapService,Ht as COMMIT,xe as EffectivePermission,Xe as EffectivePermissionService,Gt as EngineCapabilityFeatureFlagService,Rt as EnvironmeFlagReader,ct as FEATURE_FLAG_AUTH_KEY,pt as FEATURE_FLAG_BLOCK_KEY,at as FEATURE_FLAG_ENV_PREFIX,ot as FEATURE_FLAG_ENV_ROOT,lt as FEATURE_FLAG_HIDE_KEY,dt as FEATURE_FLAG_MODEL_KEY,yt as FEATURE_FLAG_RENDER_KEY,Xt as FULL_VERSION,Kt as FeatureFlag,kt as FeatureFlagAccess,_t as FeatureFlagEnvironment,Ft as FeatureFlagReader,Tt as FeatureFlagService,Te as Group,Re as GroupMembership,Ve as GroupMembershipService,We as GroupService,je as InheritanceBlock,Ee as InheritanceBlockService,B as IsolationTier,z as IsolationTierOptions,D as MembershipStatus,M as MembershipStatusOptions,Ue as OrgUnit,ve as OrgUnitClosure,Ce as OrgUnitClosureService,fe as OrgUnitMembership,qe as OrgUnitMembershipService,Fe as OrgUnitProfile,De as OrgUnitProfileService,$e as OrgUnitService,Yt as PACKAGE_NAME,we as Permission,G as PermissionCategory,V as PermissionCategoryOptions,Ze as PermissionService,Ie as Principal,C as PrincipalKind,q as PrincipalKindOptions,ze as PrincipalService,_e as ProtectedResource,Ye as ProtectedResourceService,Y as REL_CASCADE_DEPENDENT,ee as REL_CASCADE_INSERT_UPDATE,X as REL_NULLIFY,H as REL_RESTRICT,Oe as ResourceGrant,et as ResourceGrantService,tt as ResourceLifecycleService,N as ResourceVisibility,Z as ResourceVisibilityOptions,Se as Role,Ae as RoleAssignment,He as RoleAssignmentService,be as RolePermission,Je as RolePermissionService,Qe as RoleService,E as ScopeKind,W as ScopeKindOptions,Pe as StorageBinding,L as StorageBindingKind,J as StorageBindingKindOptions,it as StorageBindingService,$ as StorageKind,Q as StorageKindOptions,nt as SystemManagementService,Ke as Tenant,he as TenantMembership,Me as TenantMembershipService,ke as TenantProfile,Be as TenantProfileService,Ge as TenantService,me as User,Le as UserService,Jt as VERSION,se as asArray,Mt as blockFeatureOperations,pe as buildAccessContext,te as buildArangoContext,ie as buildQdrantFilter,Dt as engineCapabilityFlagKey,Ct as engineCapabilityFlagRegistry,x as execWithLogging,zt as featureAuth,Lt as featureFlags,Vt as getFeatureGateMetadata,Pt as hasFeatureFlagInEnvironment,Wt as hideOnFeature,le as id,ft as isFeatureFlagEnabled,vt as isFeatureFlagEnabledByName,St as isFeatureRuleBlocked,bt as isFeatureRuleSatisfied,ce as isTimeValid,jt as loadFeatureFlagsFromEnvironment,de as lowerSlug,ht as normalizeFeatureConfig,ut as normalizeFeatureName,mt as normalizeFeatureRegistry,wt as normalizeFeatureRule,It as normalizeFeatureSubjectKey,Ot as normalizeFeatureSubjectType,ne as nowIso,gt as parseRuntimeValue,At as readMetadata,ue as relationId,ae as relationMatch,qt as renderIfFeature,Ut as resolveFeatureFlagFromEnvironment,oe as sameTenant,Zt as shouldExposeForFeatures,Qt as shouldHideForFeatures};
2
2
  //# sourceMappingURL=integrations.js.map