@webiny/api-core 0.0.0-unstable.e2758ee1cf → 0.0.0-unstable.e6f0dc8ca7

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 (487) hide show
  1. package/ApiCoreFeature.d.ts +5 -1
  2. package/ApiCoreFeature.js +6 -0
  3. package/ApiCoreFeature.js.map +1 -1
  4. package/createApiCore.d.ts +1 -1
  5. package/createApiCore.js +2 -3
  6. package/createApiCore.js.map +1 -1
  7. package/domain/security/ApiToken.d.ts +1 -0
  8. package/domain/security/ApiToken.js +1 -0
  9. package/domain/security/ApiToken.js.map +1 -1
  10. package/exports/api/build-params.d.ts +1 -0
  11. package/exports/api/build-params.js +1 -0
  12. package/exports/api/build-params.js.map +1 -1
  13. package/exports/api/event-publisher.d.ts +1 -0
  14. package/exports/api/event-publisher.js +1 -0
  15. package/exports/api/event-publisher.js.map +1 -1
  16. package/exports/api/key-value-store.d.ts +1 -0
  17. package/exports/api/key-value-store.js +1 -0
  18. package/exports/api/key-value-store.js.map +1 -1
  19. package/exports/api/logger.d.ts +1 -0
  20. package/exports/api/logger.js +1 -0
  21. package/exports/api/logger.js.map +1 -1
  22. package/exports/api/security/api-key.d.ts +3 -3
  23. package/exports/api/security/api-key.js +3 -3
  24. package/exports/api/security/api-key.js.map +1 -1
  25. package/exports/api/security/authentication.d.ts +1 -1
  26. package/exports/api/security/authentication.js +1 -1
  27. package/exports/api/security/authentication.js.map +1 -1
  28. package/exports/api/security/role.d.ts +3 -3
  29. package/exports/api/security/role.js +3 -3
  30. package/exports/api/security/role.js.map +1 -1
  31. package/exports/api/security/user.d.ts +3 -3
  32. package/exports/api/security/user.js +3 -3
  33. package/exports/api/security/user.js.map +1 -1
  34. package/exports/api/security.d.ts +6 -0
  35. package/exports/api/security.js +5 -0
  36. package/exports/api/security.js.map +1 -1
  37. package/exports/api/system.d.ts +1 -1
  38. package/exports/api/system.js +1 -1
  39. package/exports/api/system.js.map +1 -1
  40. package/exports/api/tenancy.d.ts +4 -4
  41. package/exports/api/tenancy.js +4 -4
  42. package/exports/api/tenancy.js.map +1 -1
  43. package/exports/api.d.ts +7 -0
  44. package/exports/api.js +8 -0
  45. package/exports/api.js.map +1 -0
  46. package/features/ai/Ai.d.ts +26 -0
  47. package/features/ai/Ai.js +133 -0
  48. package/features/ai/Ai.js.map +1 -0
  49. package/features/ai/AiSdkTools.d.ts +11 -0
  50. package/features/ai/AiSdkTools.js +25 -0
  51. package/features/ai/AiSdkTools.js.map +1 -0
  52. package/features/ai/AnthropicSdkFactory.d.ts +10 -0
  53. package/features/ai/AnthropicSdkFactory.js +71 -0
  54. package/features/ai/AnthropicSdkFactory.js.map +1 -0
  55. package/features/ai/OpenAiSdkFactory.d.ts +10 -0
  56. package/features/ai/OpenAiSdkFactory.js +187 -0
  57. package/features/ai/OpenAiSdkFactory.js.map +1 -0
  58. package/features/ai/abstractions.d.ts +92 -0
  59. package/features/ai/abstractions.js +35 -0
  60. package/features/ai/abstractions.js.map +1 -0
  61. package/features/ai/feature.d.ts +4 -0
  62. package/features/ai/feature.js +16 -0
  63. package/features/ai/feature.js.map +1 -0
  64. package/features/ai/index.d.ts +3 -0
  65. package/features/ai/index.js +4 -0
  66. package/features/ai/index.js.map +1 -0
  67. package/features/buildParams/abstractions.d.ts +2 -0
  68. package/features/buildParams/abstractions.js +2 -0
  69. package/features/buildParams/abstractions.js.map +1 -1
  70. package/features/buildParams/feature.d.ts +5 -1
  71. package/features/encryption/EncryptionService.d.ts +10 -0
  72. package/features/encryption/EncryptionService.js +58 -0
  73. package/features/encryption/EncryptionService.js.map +1 -0
  74. package/features/encryption/abstractions.d.ts +9 -0
  75. package/features/encryption/abstractions.js +5 -0
  76. package/features/encryption/abstractions.js.map +1 -0
  77. package/features/encryption/feature.d.ts +4 -0
  78. package/features/encryption/feature.js +10 -0
  79. package/features/encryption/feature.js.map +1 -0
  80. package/features/encryption/index.d.ts +1 -0
  81. package/features/encryption/index.js +3 -0
  82. package/features/encryption/index.js.map +1 -0
  83. package/features/eventPublisher/abstractions.d.ts +2 -0
  84. package/features/eventPublisher/abstractions.js +3 -0
  85. package/features/eventPublisher/abstractions.js.map +1 -1
  86. package/features/eventPublisher/feature.d.ts +5 -1
  87. package/features/featureFlags/feature.d.ts +5 -1
  88. package/features/keyValueStore/GlobalKeyValueStore.js +3 -1
  89. package/features/keyValueStore/GlobalKeyValueStore.js.map +1 -1
  90. package/features/keyValueStore/KeyValueStoreRepository.d.ts +2 -2
  91. package/features/keyValueStore/KeyValueStoreRepository.js +2 -2
  92. package/features/keyValueStore/KeyValueStoreRepository.js.map +1 -1
  93. package/features/keyValueStore/abstractions.d.ts +10 -2
  94. package/features/keyValueStore/abstractions.js +4 -0
  95. package/features/keyValueStore/abstractions.js.map +1 -1
  96. package/features/keyValueStore/feature.d.ts +4 -1
  97. package/features/keyValueStore/feature.js.map +1 -1
  98. package/features/logger/abstractions.d.ts +1 -0
  99. package/features/logger/abstractions.js +1 -0
  100. package/features/logger/abstractions.js.map +1 -1
  101. package/features/logger/feature.d.ts +4 -1
  102. package/features/masker/Masker.d.ts +8 -0
  103. package/features/masker/Masker.js +21 -0
  104. package/features/masker/Masker.js.map +1 -0
  105. package/features/masker/abstractions.d.ts +11 -0
  106. package/features/masker/abstractions.js +4 -0
  107. package/features/masker/abstractions.js.map +1 -0
  108. package/features/masker/feature.d.ts +4 -0
  109. package/features/masker/feature.js +10 -0
  110. package/features/masker/feature.js.map +1 -0
  111. package/features/masker/index.d.ts +1 -0
  112. package/features/masker/index.js +3 -0
  113. package/features/masker/index.js.map +1 -0
  114. package/features/security/IdentityContext/abstractions.d.ts +1 -0
  115. package/features/security/IdentityContext/abstractions.js +1 -0
  116. package/features/security/IdentityContext/abstractions.js.map +1 -1
  117. package/features/security/IdentityContext/feature.d.ts +4 -1
  118. package/features/security/SecurityFeature.d.ts +5 -1
  119. package/features/security/apiKeys/CreateApiKey/CreateApiKeyUseCase.js +1 -1
  120. package/features/security/apiKeys/CreateApiKey/CreateApiKeyUseCase.js.map +1 -1
  121. package/features/security/apiKeys/CreateApiKey/abstractions.d.ts +1 -0
  122. package/features/security/apiKeys/CreateApiKey/abstractions.js +1 -0
  123. package/features/security/apiKeys/CreateApiKey/abstractions.js.map +1 -1
  124. package/features/security/apiKeys/CreateApiKey/events.d.ts +6 -4
  125. package/features/security/apiKeys/CreateApiKey/events.js +8 -4
  126. package/features/security/apiKeys/CreateApiKey/events.js.map +1 -1
  127. package/features/security/apiKeys/CreateApiKey/feature.d.ts +4 -1
  128. package/features/security/apiKeys/DeleteApiKey/abstractions.d.ts +1 -0
  129. package/features/security/apiKeys/DeleteApiKey/abstractions.js +1 -0
  130. package/features/security/apiKeys/DeleteApiKey/abstractions.js.map +1 -1
  131. package/features/security/apiKeys/DeleteApiKey/events.d.ts +6 -4
  132. package/features/security/apiKeys/DeleteApiKey/events.js +8 -4
  133. package/features/security/apiKeys/DeleteApiKey/events.js.map +1 -1
  134. package/features/security/apiKeys/DeleteApiKey/feature.d.ts +4 -1
  135. package/features/security/apiKeys/GetApiKey/abstractions.d.ts +1 -0
  136. package/features/security/apiKeys/GetApiKey/abstractions.js +1 -0
  137. package/features/security/apiKeys/GetApiKey/abstractions.js.map +1 -1
  138. package/features/security/apiKeys/GetApiKey/feature.d.ts +4 -1
  139. package/features/security/apiKeys/GetApiKeyBySlug/abstractions.d.ts +1 -0
  140. package/features/security/apiKeys/GetApiKeyBySlug/abstractions.js +1 -0
  141. package/features/security/apiKeys/GetApiKeyBySlug/abstractions.js.map +1 -1
  142. package/features/security/apiKeys/GetApiKeyBySlug/feature.d.ts +4 -1
  143. package/features/security/apiKeys/GetApiKeyByToken/abstractions.d.ts +1 -0
  144. package/features/security/apiKeys/GetApiKeyByToken/abstractions.js +1 -0
  145. package/features/security/apiKeys/GetApiKeyByToken/abstractions.js.map +1 -1
  146. package/features/security/apiKeys/GetApiKeyByToken/feature.d.ts +4 -1
  147. package/features/security/apiKeys/ListApiKeys/ListApiKeysUseCase.js +1 -1
  148. package/features/security/apiKeys/ListApiKeys/ListApiKeysUseCase.js.map +1 -1
  149. package/features/security/apiKeys/ListApiKeys/abstractions.d.ts +1 -0
  150. package/features/security/apiKeys/ListApiKeys/abstractions.js +1 -0
  151. package/features/security/apiKeys/ListApiKeys/abstractions.js.map +1 -1
  152. package/features/security/apiKeys/ListApiKeys/feature.d.ts +4 -1
  153. package/features/security/apiKeys/UpdateApiKey/UpdateApiKeyUseCase.js +1 -1
  154. package/features/security/apiKeys/UpdateApiKey/UpdateApiKeyUseCase.js.map +1 -1
  155. package/features/security/apiKeys/UpdateApiKey/abstractions.d.ts +1 -0
  156. package/features/security/apiKeys/UpdateApiKey/abstractions.js +1 -0
  157. package/features/security/apiKeys/UpdateApiKey/abstractions.js.map +1 -1
  158. package/features/security/apiKeys/UpdateApiKey/events.d.ts +6 -4
  159. package/features/security/apiKeys/UpdateApiKey/events.js +8 -4
  160. package/features/security/apiKeys/UpdateApiKey/events.js.map +1 -1
  161. package/features/security/apiKeys/UpdateApiKey/feature.d.ts +4 -1
  162. package/features/security/apiKeys/feature.d.ts +4 -1
  163. package/features/security/apiKeys/shared/abstractions.d.ts +5 -2
  164. package/features/security/apiKeys/shared/abstractions.js +3 -0
  165. package/features/security/apiKeys/shared/abstractions.js.map +1 -1
  166. package/features/security/apiKeys/shared/schemas.d.ts +10 -71
  167. package/features/security/apiKeys/shared/schemas.js +4 -4
  168. package/features/security/apiKeys/shared/schemas.js.map +1 -1
  169. package/features/security/authentication/AuthenticationContext/SetIdTokenCookie.d.ts +2 -2
  170. package/features/security/authentication/AuthenticationContext/SetIdTokenCookie.js +2 -2
  171. package/features/security/authentication/AuthenticationContext/SetIdTokenCookie.js.map +1 -1
  172. package/features/security/authentication/AuthenticationContext/abstractions.d.ts +1 -0
  173. package/features/security/authentication/AuthenticationContext/abstractions.js +1 -0
  174. package/features/security/authentication/AuthenticationContext/abstractions.js.map +1 -1
  175. package/features/security/authentication/AuthenticationContext/events.d.ts +6 -4
  176. package/features/security/authentication/AuthenticationContext/events.js +8 -4
  177. package/features/security/authentication/AuthenticationContext/events.js.map +1 -1
  178. package/features/security/authentication/AuthenticationContext/feature.d.ts +4 -1
  179. package/features/security/authentication/Authenticator/abstractions.d.ts +1 -0
  180. package/features/security/authentication/Authenticator/abstractions.js +1 -0
  181. package/features/security/authentication/Authenticator/abstractions.js.map +1 -1
  182. package/features/security/authorization/AuthorizationContext/AuthorizationContext.d.ts +1 -0
  183. package/features/security/authorization/AuthorizationContext/AuthorizationContext.js +14 -2
  184. package/features/security/authorization/AuthorizationContext/AuthorizationContext.js.map +1 -1
  185. package/features/security/authorization/AuthorizationContext/abstractions.d.ts +2 -0
  186. package/features/security/authorization/AuthorizationContext/abstractions.js +2 -0
  187. package/features/security/authorization/AuthorizationContext/abstractions.js.map +1 -1
  188. package/features/security/authorization/AuthorizationContext/feature.d.ts +4 -1
  189. package/features/security/authorization/Authorizer/abstractions.d.ts +1 -0
  190. package/features/security/authorization/Authorizer/abstractions.js +1 -0
  191. package/features/security/authorization/Authorizer/abstractions.js.map +1 -1
  192. package/features/security/authorization/GroupsTeamsAuthorizer/feature.d.ts +4 -1
  193. package/features/security/login/abstractions.d.ts +3 -2
  194. package/features/security/login/abstractions.js +4 -2
  195. package/features/security/login/abstractions.js.map +1 -1
  196. package/features/security/permissions/createPermissionSchema.d.ts +2 -0
  197. package/features/security/permissions/createPermissionSchema.js +8 -0
  198. package/features/security/permissions/createPermissionSchema.js.map +1 -0
  199. package/features/security/permissions/createPermissions.d.ts +5 -5
  200. package/features/security/permissions/createPermissions.js +198 -188
  201. package/features/security/permissions/createPermissions.js.map +1 -1
  202. package/features/security/permissions/index.d.ts +2 -1
  203. package/features/security/permissions/index.js +2 -1
  204. package/features/security/permissions/index.js.map +1 -1
  205. package/features/security/roles/CreateRole/CreateRoleUseCase.d.ts +1 -3
  206. package/features/security/roles/CreateRole/CreateRoleUseCase.js +3 -7
  207. package/features/security/roles/CreateRole/CreateRoleUseCase.js.map +1 -1
  208. package/features/security/roles/CreateRole/abstractions.d.ts +1 -0
  209. package/features/security/roles/CreateRole/abstractions.js +1 -0
  210. package/features/security/roles/CreateRole/abstractions.js.map +1 -1
  211. package/features/security/roles/CreateRole/events.d.ts +6 -4
  212. package/features/security/roles/CreateRole/events.js +8 -4
  213. package/features/security/roles/CreateRole/events.js.map +1 -1
  214. package/features/security/roles/CreateRole/feature.d.ts +4 -1
  215. package/features/security/roles/CreateRole/schema.d.ts +2 -20
  216. package/features/security/roles/CreateRole/schema.js +2 -2
  217. package/features/security/roles/CreateRole/schema.js.map +1 -1
  218. package/features/security/roles/DeleteRole/abstractions.d.ts +1 -0
  219. package/features/security/roles/DeleteRole/abstractions.js +1 -0
  220. package/features/security/roles/DeleteRole/abstractions.js.map +1 -1
  221. package/features/security/roles/DeleteRole/events.d.ts +6 -4
  222. package/features/security/roles/DeleteRole/events.js +8 -4
  223. package/features/security/roles/DeleteRole/events.js.map +1 -1
  224. package/features/security/roles/DeleteRole/feature.d.ts +4 -1
  225. package/features/security/roles/GetRole/abstractions.d.ts +1 -0
  226. package/features/security/roles/GetRole/abstractions.js +1 -0
  227. package/features/security/roles/GetRole/abstractions.js.map +1 -1
  228. package/features/security/roles/GetRole/feature.d.ts +4 -1
  229. package/features/security/roles/ListRoles/abstractions.d.ts +1 -0
  230. package/features/security/roles/ListRoles/abstractions.js +1 -0
  231. package/features/security/roles/ListRoles/abstractions.js.map +1 -1
  232. package/features/security/roles/ListRoles/feature.d.ts +4 -1
  233. package/features/security/roles/UpdateRole/UpdateRoleUseCase.js +1 -1
  234. package/features/security/roles/UpdateRole/UpdateRoleUseCase.js.map +1 -1
  235. package/features/security/roles/UpdateRole/abstractions.d.ts +1 -0
  236. package/features/security/roles/UpdateRole/abstractions.js +1 -0
  237. package/features/security/roles/UpdateRole/abstractions.js.map +1 -1
  238. package/features/security/roles/UpdateRole/events.d.ts +6 -4
  239. package/features/security/roles/UpdateRole/events.js +8 -4
  240. package/features/security/roles/UpdateRole/events.js.map +1 -1
  241. package/features/security/roles/UpdateRole/feature.d.ts +4 -1
  242. package/features/security/roles/UpdateRole/schema.d.ts +2 -18
  243. package/features/security/roles/UpdateRole/schema.js +2 -2
  244. package/features/security/roles/UpdateRole/schema.js.map +1 -1
  245. package/features/security/roles/feature.d.ts +4 -1
  246. package/features/security/roles/feature.js +2 -0
  247. package/features/security/roles/feature.js.map +1 -1
  248. package/features/security/roles/shared/RoleProvider.d.ts +13 -0
  249. package/features/security/roles/shared/RoleProvider.js +29 -0
  250. package/features/security/roles/shared/RoleProvider.js.map +1 -0
  251. package/features/security/roles/shared/RolesRepository.d.ts +3 -1
  252. package/features/security/roles/shared/RolesRepository.js +19 -18
  253. package/features/security/roles/shared/RolesRepository.js.map +1 -1
  254. package/features/security/roles/shared/abstractions.d.ts +19 -0
  255. package/features/security/roles/shared/abstractions.js +3 -0
  256. package/features/security/roles/shared/abstractions.js.map +1 -1
  257. package/features/security/shared/abstractions.d.ts +5 -14
  258. package/features/security/shared/abstractions.js +3 -16
  259. package/features/security/shared/abstractions.js.map +1 -1
  260. package/features/security/teams/CreateTeam/CreateTeamUseCase.d.ts +1 -3
  261. package/features/security/teams/CreateTeam/CreateTeamUseCase.js +3 -7
  262. package/features/security/teams/CreateTeam/CreateTeamUseCase.js.map +1 -1
  263. package/features/security/teams/CreateTeam/abstractions.d.ts +1 -0
  264. package/features/security/teams/CreateTeam/abstractions.js +1 -0
  265. package/features/security/teams/CreateTeam/abstractions.js.map +1 -1
  266. package/features/security/teams/CreateTeam/events.d.ts +6 -4
  267. package/features/security/teams/CreateTeam/events.js +8 -4
  268. package/features/security/teams/CreateTeam/events.js.map +1 -1
  269. package/features/security/teams/CreateTeam/feature.d.ts +4 -1
  270. package/features/security/teams/CreateTeam/index.d.ts +1 -1
  271. package/features/security/teams/CreateTeam/index.js +1 -1
  272. package/features/security/teams/CreateTeam/index.js.map +1 -1
  273. package/features/security/teams/CreateTeam/schema.d.ts +2 -12
  274. package/features/security/teams/DeleteTeam/abstractions.d.ts +1 -0
  275. package/features/security/teams/DeleteTeam/abstractions.js +1 -0
  276. package/features/security/teams/DeleteTeam/abstractions.js.map +1 -1
  277. package/features/security/teams/DeleteTeam/events.d.ts +6 -4
  278. package/features/security/teams/DeleteTeam/events.js +8 -4
  279. package/features/security/teams/DeleteTeam/events.js.map +1 -1
  280. package/features/security/teams/DeleteTeam/feature.d.ts +4 -1
  281. package/features/security/teams/GetTeam/abstractions.d.ts +1 -0
  282. package/features/security/teams/GetTeam/abstractions.js +1 -0
  283. package/features/security/teams/GetTeam/abstractions.js.map +1 -1
  284. package/features/security/teams/GetTeam/feature.d.ts +4 -1
  285. package/features/security/teams/ListTeams/abstractions.d.ts +1 -0
  286. package/features/security/teams/ListTeams/abstractions.js +1 -0
  287. package/features/security/teams/ListTeams/abstractions.js.map +1 -1
  288. package/features/security/teams/ListTeams/feature.d.ts +4 -1
  289. package/features/security/teams/UpdateTeam/UpdateTeamUseCase.js +1 -1
  290. package/features/security/teams/UpdateTeam/UpdateTeamUseCase.js.map +1 -1
  291. package/features/security/teams/UpdateTeam/abstractions.d.ts +1 -0
  292. package/features/security/teams/UpdateTeam/abstractions.js +1 -0
  293. package/features/security/teams/UpdateTeam/abstractions.js.map +1 -1
  294. package/features/security/teams/UpdateTeam/events.d.ts +6 -4
  295. package/features/security/teams/UpdateTeam/events.js +8 -4
  296. package/features/security/teams/UpdateTeam/events.js.map +1 -1
  297. package/features/security/teams/UpdateTeam/feature.d.ts +4 -1
  298. package/features/security/teams/UpdateTeam/schema.d.ts +2 -10
  299. package/features/security/teams/feature.d.ts +4 -1
  300. package/features/security/teams/feature.js +6 -0
  301. package/features/security/teams/feature.js.map +1 -1
  302. package/features/security/teams/shared/TeamProvider.d.ts +13 -0
  303. package/features/security/teams/shared/TeamProvider.js +29 -0
  304. package/features/security/teams/shared/TeamProvider.js.map +1 -0
  305. package/features/security/teams/shared/TeamsRepository.js +20 -18
  306. package/features/security/teams/shared/TeamsRepository.js.map +1 -1
  307. package/features/security/teams/shared/abstractions.d.ts +18 -0
  308. package/features/security/teams/shared/abstractions.js +3 -0
  309. package/features/security/teams/shared/abstractions.js.map +1 -1
  310. package/features/security/teams/shared/decorators/TeamsRepositoryCachingDecorator.d.ts +17 -0
  311. package/features/security/teams/shared/decorators/TeamsRepositoryCachingDecorator.js +76 -0
  312. package/features/security/teams/shared/decorators/TeamsRepositoryCachingDecorator.js.map +1 -0
  313. package/features/security/utils/verifyJwtUsingJwk.d.ts +2 -4
  314. package/features/security/utils/verifyJwtUsingJwk.js +1 -1
  315. package/features/security/utils/verifyJwtUsingJwk.js.map +1 -1
  316. package/features/system/InstallSystem/abstractions.d.ts +4 -5
  317. package/features/system/InstallSystem/abstractions.js +3 -4
  318. package/features/system/InstallSystem/abstractions.js.map +1 -1
  319. package/features/system/InstallSystem/events.js +2 -2
  320. package/features/system/InstallSystem/events.js.map +1 -1
  321. package/features/system/InstallSystem/feature.d.ts +5 -1
  322. package/features/system/InstallSystem/index.d.ts +1 -1
  323. package/features/system/InstallSystem/index.js +1 -1
  324. package/features/system/InstallSystem/index.js.map +1 -1
  325. package/features/system/SystemFeature.d.ts +4 -1
  326. package/features/task/TaskController/abstractions.d.ts +1 -0
  327. package/features/task/TaskController/abstractions.js +1 -0
  328. package/features/task/TaskController/abstractions.js.map +1 -1
  329. package/features/task/TaskDefinition/abstractions.d.ts +7 -1
  330. package/features/task/TaskDefinition/abstractions.js +1 -0
  331. package/features/task/TaskDefinition/abstractions.js.map +1 -1
  332. package/features/task/TaskService/abstractions.d.ts +1 -0
  333. package/features/task/TaskService/abstractions.js +1 -0
  334. package/features/task/TaskService/abstractions.js.map +1 -1
  335. package/features/tenancy/CreateTenant/abstractions.d.ts +9 -7
  336. package/features/tenancy/CreateTenant/abstractions.js +7 -5
  337. package/features/tenancy/CreateTenant/abstractions.js.map +1 -1
  338. package/features/tenancy/CreateTenant/events.js +3 -3
  339. package/features/tenancy/CreateTenant/events.js.map +1 -1
  340. package/features/tenancy/CreateTenant/feature.d.ts +5 -1
  341. package/features/tenancy/CreateTenant/index.d.ts +1 -1
  342. package/features/tenancy/CreateTenant/index.js +1 -1
  343. package/features/tenancy/CreateTenant/index.js.map +1 -1
  344. package/features/tenancy/DeleteTenant/abstractions.d.ts +9 -4
  345. package/features/tenancy/DeleteTenant/abstractions.js +7 -2
  346. package/features/tenancy/DeleteTenant/abstractions.js.map +1 -1
  347. package/features/tenancy/DeleteTenant/events.js +3 -3
  348. package/features/tenancy/DeleteTenant/events.js.map +1 -1
  349. package/features/tenancy/DeleteTenant/feature.d.ts +5 -1
  350. package/features/tenancy/DeleteTenant/index.d.ts +1 -1
  351. package/features/tenancy/DeleteTenant/index.js +1 -1
  352. package/features/tenancy/DeleteTenant/index.js.map +1 -1
  353. package/features/tenancy/GetRootTenant/feature.d.ts +5 -1
  354. package/features/tenancy/GetTenantById/abstractions.d.ts +3 -0
  355. package/features/tenancy/GetTenantById/abstractions.js +3 -9
  356. package/features/tenancy/GetTenantById/abstractions.js.map +1 -1
  357. package/features/tenancy/GetTenantById/feature.d.ts +5 -1
  358. package/features/tenancy/InstallTenant/abstractions.d.ts +5 -11
  359. package/features/tenancy/InstallTenant/abstractions.js +4 -13
  360. package/features/tenancy/InstallTenant/abstractions.js.map +1 -1
  361. package/features/tenancy/InstallTenant/events.js +2 -2
  362. package/features/tenancy/InstallTenant/events.js.map +1 -1
  363. package/features/tenancy/InstallTenant/feature.d.ts +5 -1
  364. package/features/tenancy/InstallTenant/index.d.ts +1 -1
  365. package/features/tenancy/InstallTenant/index.js +1 -1
  366. package/features/tenancy/InstallTenant/index.js.map +1 -1
  367. package/features/tenancy/ListTenants/feature.d.ts +5 -1
  368. package/features/tenancy/TenancyFeature.d.ts +4 -1
  369. package/features/tenancy/TenancyFeature.js.map +1 -1
  370. package/features/tenancy/TenantContext/abstractions.d.ts +1 -0
  371. package/features/tenancy/TenantContext/abstractions.js +1 -0
  372. package/features/tenancy/TenantContext/abstractions.js.map +1 -1
  373. package/features/tenancy/TenantContext/feature.d.ts +4 -1
  374. package/features/tenancy/UpdateTenant/abstractions.d.ts +9 -4
  375. package/features/tenancy/UpdateTenant/abstractions.js +7 -2
  376. package/features/tenancy/UpdateTenant/abstractions.js.map +1 -1
  377. package/features/tenancy/UpdateTenant/events.js +3 -3
  378. package/features/tenancy/UpdateTenant/events.js.map +1 -1
  379. package/features/tenancy/UpdateTenant/feature.d.ts +5 -1
  380. package/features/tenancy/UpdateTenant/index.d.ts +1 -1
  381. package/features/tenancy/UpdateTenant/index.js +1 -1
  382. package/features/tenancy/UpdateTenant/index.js.map +1 -1
  383. package/features/users/AdminUsersFeature.d.ts +4 -1
  384. package/features/users/AdminUsersFeature.js.map +1 -1
  385. package/features/users/CreateUser/CreateUserUseCase.js +1 -1
  386. package/features/users/CreateUser/CreateUserUseCase.js.map +1 -1
  387. package/features/users/CreateUser/abstractions.d.ts +1 -0
  388. package/features/users/CreateUser/abstractions.js +1 -1
  389. package/features/users/CreateUser/abstractions.js.map +1 -1
  390. package/features/users/CreateUser/events.d.ts +6 -4
  391. package/features/users/CreateUser/events.js +8 -4
  392. package/features/users/CreateUser/events.js.map +1 -1
  393. package/features/users/CreateUser/feature.d.ts +4 -1
  394. package/features/users/CreateUser/schema.d.ts +4 -36
  395. package/features/users/DeleteUser/abstractions.d.ts +1 -0
  396. package/features/users/DeleteUser/abstractions.js +1 -1
  397. package/features/users/DeleteUser/abstractions.js.map +1 -1
  398. package/features/users/DeleteUser/events.d.ts +6 -4
  399. package/features/users/DeleteUser/events.js +8 -4
  400. package/features/users/DeleteUser/events.js.map +1 -1
  401. package/features/users/DeleteUser/feature.d.ts +4 -1
  402. package/features/users/ExternalIdpUserSync/ExternalIdpUserSyncHandler.d.ts +3 -3
  403. package/features/users/ExternalIdpUserSync/ExternalIdpUserSyncHandler.js +2 -2
  404. package/features/users/ExternalIdpUserSync/ExternalIdpUserSyncHandler.js.map +1 -1
  405. package/features/users/ExternalIdpUserSync/feature.d.ts +4 -1
  406. package/features/users/GetIdentityProfile/feature.d.ts +4 -1
  407. package/features/users/GetUser/abstractions.d.ts +1 -0
  408. package/features/users/GetUser/abstractions.js +1 -1
  409. package/features/users/GetUser/abstractions.js.map +1 -1
  410. package/features/users/GetUser/feature.d.ts +4 -1
  411. package/features/users/ListUserTeams/abstractions.d.ts +1 -0
  412. package/features/users/ListUserTeams/abstractions.js +1 -1
  413. package/features/users/ListUserTeams/abstractions.js.map +1 -1
  414. package/features/users/ListUserTeams/feature.d.ts +4 -1
  415. package/features/users/ListUsers/abstractions.d.ts +1 -0
  416. package/features/users/ListUsers/abstractions.js +1 -1
  417. package/features/users/ListUsers/abstractions.js.map +1 -1
  418. package/features/users/ListUsers/feature.d.ts +4 -1
  419. package/features/users/UpdateUser/UpdateUserUseCase.js +1 -1
  420. package/features/users/UpdateUser/UpdateUserUseCase.js.map +1 -1
  421. package/features/users/UpdateUser/abstractions.d.ts +1 -0
  422. package/features/users/UpdateUser/abstractions.js +1 -1
  423. package/features/users/UpdateUser/abstractions.js.map +1 -1
  424. package/features/users/UpdateUser/events.d.ts +6 -4
  425. package/features/users/UpdateUser/events.js +8 -4
  426. package/features/users/UpdateUser/events.js.map +1 -1
  427. package/features/users/UpdateUser/feature.d.ts +4 -1
  428. package/features/users/UpdateUser/schema.d.ts +4 -30
  429. package/features/users/shared/abstractions.d.ts +1 -0
  430. package/features/users/shared/abstractions.js +1 -1
  431. package/features/users/shared/abstractions.js.map +1 -1
  432. package/features/wcp/WcpContext/WcpContext.d.ts +3 -0
  433. package/features/wcp/WcpContext/WcpContext.js +9 -0
  434. package/features/wcp/WcpContext/WcpContext.js.map +1 -1
  435. package/features/wcp/WcpContext/decorators/WcpContextWithFeatureFlagsDecorator.d.ts +15 -0
  436. package/features/wcp/WcpContext/decorators/WcpContextWithFeatureFlagsDecorator.js +24 -3
  437. package/features/wcp/WcpContext/decorators/WcpContextWithFeatureFlagsDecorator.js.map +1 -1
  438. package/features/wcp/WcpContext/feature.d.ts +5 -1
  439. package/features/wcp/WcpFeature.d.ts +4 -1
  440. package/features/wcp/WcpFeature.js.map +1 -1
  441. package/graphql/security/NotAuthorizedResponse.d.ts +1 -0
  442. package/graphql/security/NotAuthorizedResponse.js +1 -0
  443. package/graphql/security/NotAuthorizedResponse.js.map +1 -1
  444. package/graphql/wcp/graphql.js +1 -0
  445. package/graphql/wcp/graphql.js.map +1 -1
  446. package/idp/abstractions.d.ts +4 -0
  447. package/idp/abstractions.js +4 -0
  448. package/idp/abstractions.js.map +1 -1
  449. package/idp/feature.d.ts +4 -1
  450. package/legacy/security/createSecurityContext.js +0 -11
  451. package/legacy/security/createSecurityContext.js.map +1 -1
  452. package/legacy/security/plugins/authenticateUsingHttpHeader.d.ts +1 -1
  453. package/legacy/wcp/LegacyWcpContext.d.ts +3 -0
  454. package/legacy/wcp/LegacyWcpContext.js +9 -0
  455. package/legacy/wcp/LegacyWcpContext.js.map +1 -1
  456. package/legacy/wcp/context.d.ts +1 -3
  457. package/legacy/wcp/context.js +4 -2
  458. package/legacy/wcp/context.js.map +1 -1
  459. package/models/base/BaseModel.js +2 -2
  460. package/models/base/BaseModel.js.map +1 -1
  461. package/models/base/ModelBuilder.d.ts +2 -2
  462. package/models/base/ModelBuilder.js +21 -2
  463. package/models/base/ModelBuilder.js.map +1 -1
  464. package/models/cms/FieldBuilder.d.ts +3 -2
  465. package/models/cms/FieldBuilder.js +12 -17
  466. package/models/cms/FieldBuilder.js.map +1 -1
  467. package/models/cms/FieldBuilderRegistry.d.ts +1 -1
  468. package/models/cms/FieldBuilderRegistry.js.map +1 -1
  469. package/models/cms/FieldDefinitionsBuilder.d.ts +1 -0
  470. package/models/cms/FieldDefinitionsBuilder.js +15 -17
  471. package/models/cms/FieldDefinitionsBuilder.js.map +1 -1
  472. package/models/cms/PrivateCmsModelBuilder.js +1 -1
  473. package/models/cms/PrivateCmsModelBuilder.js.map +1 -1
  474. package/models/cms/abstractions.d.ts +1 -1
  475. package/models/cms/abstractions.js.map +1 -1
  476. package/models/cms/fieldsBuilder.md +4 -2
  477. package/models/simple/Page/abstractions.d.ts +1 -11
  478. package/package.json +27 -68
  479. package/types/security.d.ts +13 -10
  480. package/types/security.js.map +1 -1
  481. package/features/security/shared/abstractions.ts.bak +0 -52
  482. package/legacy/security/plugins/SecurityRolePlugin.d.ts +0 -16
  483. package/legacy/security/plugins/SecurityRolePlugin.js +0 -33
  484. package/legacy/security/plugins/SecurityRolePlugin.js.map +0 -1
  485. package/legacy/security/plugins/SecurityTeamPlugin.d.ts +0 -16
  486. package/legacy/security/plugins/SecurityTeamPlugin.js +0 -33
  487. package/legacy/security/plugins/SecurityTeamPlugin.js.map +0 -1
@@ -17,6 +17,7 @@ export interface IAdminUsersRepository {
17
17
  id: string;
18
18
  }>): void;
19
19
  }
20
+ /** Persist and retrieve admin users. */
20
21
  export declare const AdminUsersRepository: import("@webiny/di").Abstraction<IAdminUsersRepository>;
21
22
  export declare namespace AdminUsersRepository {
22
23
  type Interface = IAdminUsersRepository;
@@ -4,7 +4,7 @@ import { createAbstraction } from "@webiny/feature/api";
4
4
 
5
5
  // Repository interface
6
6
 
7
- // Abstraction constant
7
+ /** Persist and retrieve admin users. */
8
8
  export const AdminUsersRepository = createAbstraction("AdminUsersRepository");
9
9
 
10
10
  // Namespace exports
@@ -1 +1 @@
1
- {"version":3,"names":["createAbstraction","AdminUsersRepository"],"sources":["abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport { Result } from \"@webiny/feature/api\";\nimport type { AdminUser } from \"~/types/users.js\";\nimport type { GetUserInput, ListUsersInput } from \"./types.js\";\nimport { UserNotFoundError, UserStorageError } from \"./errors.js\";\n\n// Repository error interface\nexport interface IAdminUsersRepositoryErrors {\n base: UserNotFoundError | UserStorageError;\n}\n\nexport type RepositoryError = IAdminUsersRepositoryErrors[keyof IAdminUsersRepositoryErrors];\n\n// Repository interface\nexport interface IAdminUsersRepository {\n get(params: GetUserInput): Promise<Result<AdminUser, RepositoryError>>;\n list(params: ListUsersInput): Promise<Result<AdminUser[], RepositoryError>>;\n create(user: AdminUser): Promise<Result<AdminUser, RepositoryError>>;\n update(user: AdminUser): Promise<Result<AdminUser, RepositoryError>>;\n delete(user: AdminUser): Promise<Result<void, RepositoryError>>;\n clearCache(keys: Array<{ tenant: string; id: string }>): void;\n}\n\n// Abstraction constant\nexport const AdminUsersRepository =\n createAbstraction<IAdminUsersRepository>(\"AdminUsersRepository\");\n\n// Namespace exports\nexport namespace AdminUsersRepository {\n export type Interface = IAdminUsersRepository;\n export type Error = RepositoryError;\n}\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,qBAAqB;;AAMvD;;AAOA;;AAUA;AACA,OAAO,MAAMC,oBAAoB,GAC7BD,iBAAiB,CAAwB,sBAAsB,CAAC;;AAEpE","ignoreList":[]}
1
+ {"version":3,"names":["createAbstraction","AdminUsersRepository"],"sources":["abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport { Result } from \"@webiny/feature/api\";\nimport type { AdminUser } from \"~/types/users.js\";\nimport type { GetUserInput, ListUsersInput } from \"./types.js\";\nimport { UserNotFoundError, UserStorageError } from \"./errors.js\";\n\n// Repository error interface\nexport interface IAdminUsersRepositoryErrors {\n base: UserNotFoundError | UserStorageError;\n}\n\nexport type RepositoryError = IAdminUsersRepositoryErrors[keyof IAdminUsersRepositoryErrors];\n\n// Repository interface\nexport interface IAdminUsersRepository {\n get(params: GetUserInput): Promise<Result<AdminUser, RepositoryError>>;\n list(params: ListUsersInput): Promise<Result<AdminUser[], RepositoryError>>;\n create(user: AdminUser): Promise<Result<AdminUser, RepositoryError>>;\n update(user: AdminUser): Promise<Result<AdminUser, RepositoryError>>;\n delete(user: AdminUser): Promise<Result<void, RepositoryError>>;\n clearCache(keys: Array<{ tenant: string; id: string }>): void;\n}\n\n/** Persist and retrieve admin users. */\nexport const AdminUsersRepository =\n createAbstraction<IAdminUsersRepository>(\"AdminUsersRepository\");\n\n// Namespace exports\nexport namespace AdminUsersRepository {\n export type Interface = IAdminUsersRepository;\n export type Error = RepositoryError;\n}\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,qBAAqB;;AAMvD;;AAOA;;AAUA;AACA,OAAO,MAAMC,oBAAoB,GAC7BD,iBAAiB,CAAwB,sBAAsB,CAAC;;AAEpE","ignoreList":[]}
@@ -25,6 +25,9 @@ export declare class WcpContextImpl implements WcpContext.Interface {
25
25
  canUseFileManagerThreatDetection(): boolean;
26
26
  canUseWorkflows(): boolean;
27
27
  canUseHcmsFieldPermissions(): boolean;
28
+ canUseAiImageEnrichment(): boolean;
29
+ canUseAiPageGeneration(): boolean;
30
+ canUseAiLexicalGeneration(): boolean;
28
31
  ensureCanUseFeature(wcpFeatureId: keyof typeof WCP_FEATURE_LABEL): void;
29
32
  incrementSeats(): Promise<void>;
30
33
  decrementSeats(): Promise<void>;
@@ -102,6 +102,15 @@ export class WcpContextImpl {
102
102
  canUseHcmsFieldPermissions() {
103
103
  return this.license.canUseHcmsFieldPermissions();
104
104
  }
105
+ canUseAiImageEnrichment() {
106
+ return this.license.canUseAiImageEnrichment();
107
+ }
108
+ canUseAiPageGeneration() {
109
+ return this.license.canUseAiPageGeneration();
110
+ }
111
+ canUseAiLexicalGeneration() {
112
+ return this.license.canUseAiLexicalGeneration();
113
+ }
105
114
  ensureCanUseFeature(wcpFeatureId) {
106
115
  if (this.license.canUseFeature(wcpFeatureId)) {
107
116
  return;
@@ -1 +1 @@
1
- {"version":3,"names":["getWcpApiUrl","getWcpAppUrl","getWcpProjectEnvironment","WError","wcpFetch","wcpProjectEnvironment","WcpContextImpl","constructor","license","getWcpProjectUrl","path","orgId","org","id","projectId","project","url","filter","Boolean","join","updateSeats","operation","updateSeatsUrl","response","authorization","apiKey","body","meta","action","error","message","console","status","statusText","updateTenants","updateTenantsUrl","getRawLicense","getProject","getProjectWithFeatureFlags","getProjectEnvironment","getProjectLicense","canUseFeature","wcpFeatureId","canUseAacl","canUseTeams","canUseFolderLevelPermissions","canUsePrivateFiles","canUseAuditLogs","canUseRecordLocking","canUseFileManagerThreatDetection","canUseWorkflows","canUseHcmsFieldPermissions","ensureCanUseFeature","upgradeProjectLicenseLink","incrementSeats","decrementSeats","incrementTenants","decrementTenants","toDto"],"sources":["WcpContext.ts"],"sourcesContent":["import type { WCP_FEATURE_LABEL } from \"@webiny/wcp\";\nimport { getWcpApiUrl, getWcpAppUrl, getWcpProjectEnvironment } from \"@webiny/wcp\";\nimport WError from \"@webiny/error\";\nimport type {\n DecryptedWcpProjectLicense,\n ILicense,\n WcpProjectEnvironment,\n WcpProject\n} from \"@webiny/wcp/types.js\";\nimport { WcpContext } from \"./abstractions.js\";\nimport { wcpFetch } from \"./utils.js\";\n\nconst wcpProjectEnvironment = getWcpProjectEnvironment();\n\nexport interface CreateWcpContextParams {\n testProjectLicense?: DecryptedWcpProjectLicense;\n}\n\nexport class WcpContextImpl implements WcpContext.Interface {\n constructor(private license: ILicense) {}\n\n private getWcpProjectUrl(path = \"\"): string | null {\n if (!wcpProjectEnvironment) {\n return null;\n }\n\n const orgId = wcpProjectEnvironment.org.id;\n const projectId = wcpProjectEnvironment.project.id;\n const url = [\"/orgs\", orgId, \"projects\", projectId, path].filter(Boolean).join(\"/\");\n return getWcpApiUrl(url);\n }\n\n private async updateSeats(operation: \"increment\" | \"decrement\"): Promise<void> {\n if (!wcpProjectEnvironment) {\n return;\n }\n\n const updateSeatsUrl = this.getWcpProjectUrl(\"package/seats\");\n\n const response = await wcpFetch({\n url: updateSeatsUrl!,\n authorization: wcpProjectEnvironment.apiKey,\n body: { operation },\n meta: {\n action: operation + \"Seats\"\n }\n });\n\n if (response.error) {\n const message = response.message || `Failed to ${operation} user seats.`;\n console.error(message, response.status, response.statusText);\n throw new WError(message, \"WCP_CANNOT_UPDATE_USER_TENANTS\");\n }\n }\n\n private async updateTenants(operation: \"increment\" | \"decrement\"): Promise<void> {\n if (!wcpProjectEnvironment) {\n return;\n }\n\n const updateTenantsUrl = this.getWcpProjectUrl(\"package/tenants\");\n\n const response = await wcpFetch({\n url: updateTenantsUrl!,\n authorization: wcpProjectEnvironment.apiKey,\n body: { operation },\n meta: {\n action: operation + \"Tenants\"\n }\n });\n\n if (response.error) {\n const message = response.message || `Failed to ${operation} tenants.`;\n console.error(message, response.status, response.statusText);\n throw new WError(message, \"WCP_CANNOT_UPDATE_USER_TENANTS\");\n }\n }\n\n getRawLicense(): DecryptedWcpProjectLicense | null {\n return this.license.getRawLicense();\n }\n\n getProject(): WcpProject | null {\n return this.license.getProject();\n }\n\n getProjectWithFeatureFlags(): WcpProject | null {\n return this.getProject();\n }\n\n getProjectEnvironment(): WcpProjectEnvironment | null {\n return wcpProjectEnvironment;\n }\n\n getProjectLicense(): ILicense {\n return this.license;\n }\n\n canUseFeature(wcpFeatureId: keyof typeof WCP_FEATURE_LABEL): boolean {\n return this.license.canUseFeature(wcpFeatureId);\n }\n\n canUseAacl(): boolean {\n return this.license.canUseAacl();\n }\n\n canUseTeams(): boolean {\n return this.license.canUseTeams();\n }\n\n canUseFolderLevelPermissions(): boolean {\n return this.license.canUseFolderLevelPermissions();\n }\n\n canUsePrivateFiles(): boolean {\n return this.license.canUsePrivateFiles();\n }\n\n canUseAuditLogs(): boolean {\n return this.license.canUseAuditLogs();\n }\n\n canUseRecordLocking(): boolean {\n return this.license.canUseRecordLocking();\n }\n\n canUseFileManagerThreatDetection(): boolean {\n return this.license.canUseFileManagerThreatDetection();\n }\n\n canUseWorkflows(): boolean {\n return this.license.canUseWorkflows();\n }\n\n canUseHcmsFieldPermissions(): boolean {\n return this.license.canUseHcmsFieldPermissions();\n }\n\n ensureCanUseFeature(wcpFeatureId: keyof typeof WCP_FEATURE_LABEL): void {\n if (this.license.canUseFeature(wcpFeatureId)) {\n return;\n }\n\n let message = `The ${wcpFeatureId} Webiny Control Panel feature cannot be used because your project license does not permit it.`;\n if (wcpProjectEnvironment) {\n const { org, project } = wcpProjectEnvironment;\n const upgradeProjectLicenseLink = getWcpAppUrl(`/${org.id}/${project.id}/settings`);\n message += ` To upgrade your project license, please use the following link: ${upgradeProjectLicenseLink}.`;\n }\n\n throw new WError(message, \"WCP_CANNOT_USE_FEATURE\", { wcpFeatureId });\n }\n\n async incrementSeats(): Promise<void> {\n await this.updateSeats(\"increment\");\n }\n\n async decrementSeats(): Promise<void> {\n await this.updateSeats(\"decrement\");\n }\n\n async incrementTenants(): Promise<void> {\n await this.updateTenants(\"increment\");\n }\n\n async decrementTenants(): Promise<void> {\n await this.updateTenants(\"decrement\");\n }\n\n toDto() {\n return this.getRawLicense();\n }\n}\n"],"mappings":"AACA,SAASA,YAAY,EAAEC,YAAY,EAAEC,wBAAwB,QAAQ,aAAa;AAClF,OAAOC,MAAM,MAAM,eAAe;AAQlC,SAASC,QAAQ;AAEjB,MAAMC,qBAAqB,GAAGH,wBAAwB,CAAC,CAAC;AAMxD,OAAO,MAAMI,cAAc,CAAiC;EACxDC,WAAWA,CAASC,OAAiB,EAAE;IAAA,KAAnBA,OAAiB,GAAjBA,OAAiB;EAAG;EAEhCC,gBAAgBA,CAACC,IAAI,GAAG,EAAE,EAAiB;IAC/C,IAAI,CAACL,qBAAqB,EAAE;MACxB,OAAO,IAAI;IACf;IAEA,MAAMM,KAAK,GAAGN,qBAAqB,CAACO,GAAG,CAACC,EAAE;IAC1C,MAAMC,SAAS,GAAGT,qBAAqB,CAACU,OAAO,CAACF,EAAE;IAClD,MAAMG,GAAG,GAAG,CAAC,OAAO,EAAEL,KAAK,EAAE,UAAU,EAAEG,SAAS,EAAEJ,IAAI,CAAC,CAACO,MAAM,CAACC,OAAO,CAAC,CAACC,IAAI,CAAC,GAAG,CAAC;IACnF,OAAOnB,YAAY,CAACgB,GAAG,CAAC;EAC5B;EAEA,MAAcI,WAAWA,CAACC,SAAoC,EAAiB;IAC3E,IAAI,CAAChB,qBAAqB,EAAE;MACxB;IACJ;IAEA,MAAMiB,cAAc,GAAG,IAAI,CAACb,gBAAgB,CAAC,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AA,EAAY;IAClC,OAAO,IAAI,CAAC3C,OAAO,CAAC2C,0BAA0B,CAAC,CAAC;EACpD;EAEAC,mBAAmBA,CAACV,YAA4C,EAAQ;IACpE,IAAI,IAAI,CAAClC,OAAO,CAACiC,aAAa,CAACC,YAAY,CAAC,EAAE;MAC1C;IACJ;IAEA,IAAIZ,OAAO,GAAG,OAAOY,YAAY,+FAA+F;IAChI,IAAIrC,qBAAqB,EAAE;MACvB,MAAM;QAAEO,GAAG;QAAEG;MAAQ,CAAC,GAAGV,qBAAqB;MAC9C,MAAMgD,yBAAyB,GAAGpD,YAAY,CAAC,IAAIW,GAAG,CAACC,EAAE,IAAIE,OAAO,CAACF,EAAE,WAAW,CAAC;MACnFiB,OAAO,IAAI,oEAAoEuB,yBAAyB,GAAG;IAC/G;IAEA,MAAM,IAAIlD,MAAM,CAAC2B,OAAO,EAAE,wBAAwB,EAAE;MAAEY;IAAa,CAAC,CAAC;EACzE;EAEA,MAAMY,cAAcA,CAAA,EAAkB;IAClC,MAAM,IAAI,CAAClC,WAAW,CAAC,WAAW,CAAC;EACvC;EAEA,MAAMmC,cAAcA,CAAA,EAAkB;IAClC,MAAM,IAAI,CAACnC,WAAW,CAAC,WAAW,CAAC;EACvC;EAEA,MAAMoC,gBAAgBA,CAAA,EAAkB;IACpC,MAAM,IAAI,CAACtB,aAAa,CAAC,WAAW,CAAC;EACzC;EAEA,MAAMuB,gBAAgBA,CAAA,EAAkB;IACpC,MAAM,IAAI,CAACvB,aAAa,CAAC,WAAW,CAAC;EACzC;EAEAwB,KAAKA,CAAA,EAAG;IACJ,OAAO,IAAI,CAACtB,aAAa,CAAC,CAAC;EAC/B;AACJ","ignoreList":[]}
1
+ {"version":3,"names":["getWcpApiUrl","getWcpAppUrl","getWcpProjectEnvironment","WError","wcpFetch","wcpProjectEnvironment","WcpContextImpl","constructor","license","getWcpProjectUrl","path","orgId","org","id","projectId","project","url","filter","Boolean","join","updateSeats","operation","updateSeatsUrl","response","authorization","apiKey","body","meta","action","error","message","console","status","statusText","updateTenants","updateTenantsUrl","getRawLicense","getProject","getProjectWithFeatureFlags","getProjectEnvironment","getProjectLicense","canUseFeature","wcpFeatureId","canUseAacl","canUseTeams","canUseFolderLevelPermissions","canUsePrivateFiles","canUseAuditLogs","canUseRecordLocking","canUseFileManagerThreatDetection","canUseWorkflows","canUseHcmsFieldPermissions","canUseAiImageEnrichment","canUseAiPageGeneration","canUseAiLexicalGeneration","ensureCanUseFeature","upgradeProjectLicenseLink","incrementSeats","decrementSeats","incrementTenants","decrementTenants","toDto"],"sources":["WcpContext.ts"],"sourcesContent":["import type { WCP_FEATURE_LABEL } from \"@webiny/wcp\";\nimport { getWcpApiUrl, getWcpAppUrl, getWcpProjectEnvironment } from \"@webiny/wcp\";\nimport WError from \"@webiny/error\";\nimport type {\n DecryptedWcpProjectLicense,\n ILicense,\n WcpProjectEnvironment,\n WcpProject\n} from \"@webiny/wcp/types.js\";\nimport { WcpContext } from \"./abstractions.js\";\nimport { wcpFetch } from \"./utils.js\";\n\nconst wcpProjectEnvironment = getWcpProjectEnvironment();\n\nexport interface CreateWcpContextParams {\n testProjectLicense?: DecryptedWcpProjectLicense;\n}\n\nexport class WcpContextImpl implements WcpContext.Interface {\n constructor(private license: ILicense) {}\n\n private getWcpProjectUrl(path = \"\"): string | null {\n if (!wcpProjectEnvironment) {\n return null;\n }\n\n const orgId = wcpProjectEnvironment.org.id;\n const projectId = wcpProjectEnvironment.project.id;\n const url = [\"/orgs\", orgId, \"projects\", projectId, path].filter(Boolean).join(\"/\");\n return getWcpApiUrl(url);\n }\n\n private async updateSeats(operation: \"increment\" | \"decrement\"): Promise<void> {\n if (!wcpProjectEnvironment) {\n return;\n }\n\n const updateSeatsUrl = this.getWcpProjectUrl(\"package/seats\");\n\n const response = await wcpFetch({\n url: updateSeatsUrl!,\n authorization: wcpProjectEnvironment.apiKey,\n body: { operation },\n meta: {\n action: operation + \"Seats\"\n }\n });\n\n if (response.error) {\n const message = response.message || `Failed to ${operation} user seats.`;\n console.error(message, response.status, response.statusText);\n throw new WError(message, \"WCP_CANNOT_UPDATE_USER_TENANTS\");\n }\n }\n\n private async updateTenants(operation: \"increment\" | \"decrement\"): Promise<void> {\n if (!wcpProjectEnvironment) {\n return;\n }\n\n const updateTenantsUrl = this.getWcpProjectUrl(\"package/tenants\");\n\n const response = await wcpFetch({\n url: updateTenantsUrl!,\n authorization: wcpProjectEnvironment.apiKey,\n body: { operation },\n meta: {\n action: operation + \"Tenants\"\n }\n });\n\n if (response.error) {\n const message = response.message || `Failed to ${operation} tenants.`;\n console.error(message, response.status, response.statusText);\n throw new WError(message, \"WCP_CANNOT_UPDATE_USER_TENANTS\");\n }\n }\n\n getRawLicense(): DecryptedWcpProjectLicense | null {\n return this.license.getRawLicense();\n }\n\n getProject(): WcpProject | null {\n return this.license.getProject();\n }\n\n getProjectWithFeatureFlags(): WcpProject | null {\n return this.getProject();\n }\n\n getProjectEnvironment(): WcpProjectEnvironment | null {\n return wcpProjectEnvironment;\n }\n\n getProjectLicense(): ILicense {\n return this.license;\n }\n\n canUseFeature(wcpFeatureId: keyof typeof WCP_FEATURE_LABEL): boolean {\n return this.license.canUseFeature(wcpFeatureId);\n }\n\n canUseAacl(): boolean {\n return this.license.canUseAacl();\n }\n\n canUseTeams(): boolean {\n return this.license.canUseTeams();\n }\n\n canUseFolderLevelPermissions(): boolean {\n return this.license.canUseFolderLevelPermissions();\n }\n\n canUsePrivateFiles(): boolean {\n return this.license.canUsePrivateFiles();\n }\n\n canUseAuditLogs(): boolean {\n return this.license.canUseAuditLogs();\n }\n\n canUseRecordLocking(): boolean {\n return this.license.canUseRecordLocking();\n }\n\n canUseFileManagerThreatDetection(): boolean {\n return this.license.canUseFileManagerThreatDetection();\n }\n\n canUseWorkflows(): boolean {\n return this.license.canUseWorkflows();\n }\n\n canUseHcmsFieldPermissions(): boolean {\n return this.license.canUseHcmsFieldPermissions();\n }\n\n canUseAiImageEnrichment(): boolean {\n return this.license.canUseAiImageEnrichment();\n }\n\n canUseAiPageGeneration(): boolean {\n return this.license.canUseAiPageGeneration();\n }\n\n canUseAiLexicalGeneration(): boolean {\n return this.license.canUseAiLexicalGeneration();\n }\n\n ensureCanUseFeature(wcpFeatureId: keyof typeof WCP_FEATURE_LABEL): void {\n if (this.license.canUseFeature(wcpFeatureId)) {\n return;\n }\n\n let message = `The ${wcpFeatureId} Webiny Control Panel feature cannot be used because your project license does not permit it.`;\n if (wcpProjectEnvironment) {\n const { org, project } = wcpProjectEnvironment;\n const upgradeProjectLicenseLink = getWcpAppUrl(`/${org.id}/${project.id}/settings`);\n message += ` To upgrade your project license, please use the following link: ${upgradeProjectLicenseLink}.`;\n }\n\n throw new WError(message, \"WCP_CANNOT_USE_FEATURE\", { wcpFeatureId });\n }\n\n async incrementSeats(): Promise<void> {\n await this.updateSeats(\"increment\");\n }\n\n async decrementSeats(): Promise<void> {\n await this.updateSeats(\"decrement\");\n }\n\n async incrementTenants(): Promise<void> {\n await this.updateTenants(\"increment\");\n }\n\n async decrementTenants(): Promise<void> {\n await this.updateTenants(\"decrement\");\n }\n\n toDto() {\n return this.getRawLicense();\n }\n}\n"],"mappings":"AACA,SAASA,YAAY,EAAEC,YAAY,EAAEC,wBAAwB,QAAQ,aAAa;AAClF,OAAOC,MAAM,MAAM,eAAe;AAQlC,SAASC,QAAQ;AAEjB,MAAMC,qBAAqB,GAAGH,wBAAwB,CAAC,CAAC;AAMxD,OAAO,MAAMI,cAAc,CAAiC;EACxDC,WAAWA,CAASC,OAAiB,EAAE;IAAA,KAAnBA,OAAiB,GAAjBA,OAAiB;EAAG;EAEhCC,gBAAgBA,CAACC,IAAI,GAAG,EAAE,EAAiB;IAC/C,IAAI,CAACL,qBAAqB,EAAE;MACxB,OAAO,IAAI;IACf;IAEA,MAAMM,KAAK,GAAGN,qBAAqB,CAACO,GAAG,CAACC,EAAE;IAC1C,MAAMC,SAAS,GAAGT,qBAAqB,CAACU,OAAO,CAACF,EAAE;IAClD,MAAMG,GA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,EAAkB;IAClC,MAAM,IAAI,CAACrC,WAAW,CAAC,WAAW,CAAC;EACvC;EAEA,MAAMsC,cAAcA,CAAA,EAAkB;IAClC,MAAM,IAAI,CAACtC,WAAW,CAAC,WAAW,CAAC;EACvC;EAEA,MAAMuC,gBAAgBA,CAAA,EAAkB;IACpC,MAAM,IAAI,CAACzB,aAAa,CAAC,WAAW,CAAC;EACzC;EAEA,MAAM0B,gBAAgBA,CAAA,EAAkB;IACpC,MAAM,IAAI,CAAC1B,aAAa,CAAC,WAAW,CAAC;EACzC;EAEA2B,KAAKA,CAAA,EAAG;IACJ,OAAO,IAAI,CAACzB,aAAa,CAAC,CAAC;EAC/B;AACJ","ignoreList":[]}
@@ -43,6 +43,18 @@ declare class WcpContextWithFeatureFlagsDecoratorImpl implements WcpContext.Inte
43
43
  threatDetection: boolean;
44
44
  };
45
45
  };
46
+ aiPowerups: {
47
+ enabled: boolean;
48
+ options: {
49
+ websiteBuilder: {
50
+ pageGeneration: boolean | undefined;
51
+ };
52
+ fileManager: {
53
+ imageEnrichment: boolean | undefined;
54
+ };
55
+ lexicalGeneration: boolean | undefined;
56
+ };
57
+ };
46
58
  seats: {
47
59
  enabled: true;
48
60
  options: {
@@ -66,6 +78,9 @@ declare class WcpContextWithFeatureFlagsDecoratorImpl implements WcpContext.Inte
66
78
  canUseFileManagerThreatDetection(): boolean;
67
79
  canUseWorkflows(): boolean;
68
80
  canUseHcmsFieldPermissions(): boolean;
81
+ canUseAiImageEnrichment(): boolean;
82
+ canUseAiPageGeneration(): boolean;
83
+ canUseAiLexicalGeneration(): boolean;
69
84
  ensureCanUseFeature(featureId: keyof typeof WCP_FEATURE_LABEL): void;
70
85
  incrementSeats(): Promise<void>;
71
86
  decrementSeats(): Promise<void>;
@@ -17,7 +17,6 @@ class WcpContextWithFeatureFlagsDecoratorImpl {
17
17
  return null;
18
18
  }
19
19
  const flags = this.featureFlags.get();
20
- console.log("flags", flags);
21
20
  return {
22
21
  ...project,
23
22
  package: {
@@ -36,7 +35,7 @@ class WcpContextWithFeatureFlagsDecoratorImpl {
36
35
  teams: flags.isTeamsEnabled() ? project.package.features.advancedAccessControlLayer.options.teams : false,
37
36
  privateFiles: flags.isPrivateFilesEnabled() ? project.package.features.advancedAccessControlLayer.options.privateFiles : false,
38
37
  folderLevelPermissions: flags.isFolderLevelPermissionsEnabled() ? project.package.features.advancedAccessControlLayer.options.folderLevelPermissions : false,
39
- hcmsFieldPermissions: project.package.features.advancedAccessControlLayer.options.hcmsFieldPermissions
38
+ hcmsFieldPermissions: flags.isHcmsFieldPermissionsEnabled() ? project.package.features.advancedAccessControlLayer.options.hcmsFieldPermissions : false
40
39
  }
41
40
  },
42
41
  auditLogs: {
@@ -53,6 +52,19 @@ class WcpContextWithFeatureFlagsDecoratorImpl {
53
52
  options: {
54
53
  threatDetection: flags.isFileManagerThreatDetectionEnabled() ? project.package.features.fileManager.options.threatDetection : false
55
54
  }
55
+ },
56
+ aiPowerups: {
57
+ ...project.package.features.aiPowerups,
58
+ enabled: flags.isAiPowerupsEnabled() ? project.package.features.aiPowerups?.enabled : false,
59
+ options: {
60
+ websiteBuilder: {
61
+ pageGeneration: flags.isAiPageGenerationEnabled() ? project.package.features.aiPowerups?.options?.websiteBuilder?.pageGeneration : false
62
+ },
63
+ fileManager: {
64
+ imageEnrichment: flags.isAiImageEnrichmentEnabled() ? project.package.features.aiPowerups?.options?.fileManager?.imageEnrichment : false
65
+ },
66
+ lexicalGeneration: flags.isAiLexicalGenerationEnabled() ? project.package.features.aiPowerups?.options?.lexicalGeneration : false
67
+ }
56
68
  }
57
69
  }
58
70
  }
@@ -92,7 +104,16 @@ class WcpContextWithFeatureFlagsDecoratorImpl {
92
104
  return this.decoratee.canUseWorkflows() && this.featureFlags.get().isWorkflowsEnabled();
93
105
  }
94
106
  canUseHcmsFieldPermissions() {
95
- return this.decoratee.canUseHcmsFieldPermissions();
107
+ return this.decoratee.canUseHcmsFieldPermissions() && this.featureFlags.get().isHcmsFieldPermissionsEnabled();
108
+ }
109
+ canUseAiImageEnrichment() {
110
+ return this.decoratee.canUseAiImageEnrichment() && this.featureFlags.get().isAiImageEnrichmentEnabled();
111
+ }
112
+ canUseAiPageGeneration() {
113
+ return this.decoratee.canUseAiPageGeneration() && this.featureFlags.get().isAiPageGenerationEnabled();
114
+ }
115
+ canUseAiLexicalGeneration() {
116
+ return this.decoratee.canUseAiLexicalGeneration() && this.featureFlags.get().isAiLexicalGenerationEnabled();
96
117
  }
97
118
  ensureCanUseFeature(featureId) {
98
119
  return this.decoratee.ensureCanUseFeature(featureId);
@@ -1 +1 @@
1
- {"version":3,"names":["WcpContext","FeatureFlags","WcpContextWithFeatureFlagsDecoratorImpl","constructor","featureFlags","decoratee","getRawLicense","getProject","getProjectWithFeatureFlags","project","flags","get","console","log","package","features","multiTenancy","advancedPublishingWorkflow","enabled","isWorkflowsEnabled","advancedAccessControlLayer","isAaclEnabled","options","teams","isTeamsEnabled","privateFiles","isPrivateFilesEnabled","folderLevelPermissions","isFolderLevelPermissionsEnabled","hcmsFieldPermissions","auditLogs","isAuditLogsEnabled","recordLocking","isRecordLockingEnabled","fileManager","threatDetection","isFileManagerThreatDetectionEnabled","getProjectEnvironment","getProjectLicense","canUseFeature","wcpFeatureId","canUseAacl","canUseTeams","canUseFolderLevelPermissions","canUsePrivateFiles","canUseAuditLogs","canUseRecordLocking","canUseFileManagerThreatDetection","canUseWorkflows","canUseHcmsFieldPermissions","ensureCanUseFeature","featureId","incrementSeats","decrementSeats","incrementTenants","decrementTenants","toDto","WcpContextWithFeatureFlagsDecorator","createDecorator","decorator","dependencies"],"sources":["WcpContextWithFeatureFlagsDecorator.ts"],"sourcesContent":["import type { WCP_FEATURE_LABEL } from \"@webiny/wcp\";\nimport { WcpContext } from \"../abstractions.js\";\nimport { FeatureFlags } from \"../../../featureFlags/abstractions.js\";\n\nclass WcpContextWithFeatureFlagsDecoratorImpl implements WcpContext.Interface {\n constructor(\n private featureFlags: FeatureFlags.Interface,\n private decoratee: WcpContext.Interface\n ) {}\n\n getRawLicense() {\n return this.decoratee.getRawLicense();\n }\n\n getProject() {\n return this.decoratee.getProject();\n }\n\n getProjectWithFeatureFlags() {\n const project = this.decoratee.getProjectWithFeatureFlags();\n if (!project) {\n return null;\n }\n\n const flags = this.featureFlags.get();\n\n console.log(\"flags\", flags);\n return {\n ...project,\n package: {\n ...project.package,\n features: {\n ...project.package.features,\n multiTenancy: project.package.features.multiTenancy,\n advancedPublishingWorkflow: {\n ...project.package.features.advancedPublishingWorkflow,\n enabled: flags.isWorkflowsEnabled()\n ? project.package.features.advancedPublishingWorkflow.enabled\n : false\n },\n advancedAccessControlLayer: {\n ...project.package.features.advancedAccessControlLayer,\n enabled: flags.isAaclEnabled()\n ? project.package.features.advancedAccessControlLayer.enabled\n : false,\n options: {\n teams: flags.isTeamsEnabled()\n ? project.package.features.advancedAccessControlLayer.options.teams\n : false,\n privateFiles: flags.isPrivateFilesEnabled()\n ? project.package.features.advancedAccessControlLayer.options\n .privateFiles\n : false,\n folderLevelPermissions: flags.isFolderLevelPermissionsEnabled()\n ? project.package.features.advancedAccessControlLayer.options\n .folderLevelPermissions\n : false,\n hcmsFieldPermissions:\n project.package.features.advancedAccessControlLayer.options\n .hcmsFieldPermissions\n }\n },\n auditLogs: {\n ...project.package.features.auditLogs,\n enabled: flags.isAuditLogsEnabled()\n ? project.package.features.auditLogs.enabled\n : false\n },\n recordLocking: {\n ...project.package.features.recordLocking,\n enabled: flags.isRecordLockingEnabled()\n ? project.package.features.recordLocking.enabled\n : false\n },\n fileManager: {\n ...project.package.features.fileManager,\n enabled: project.package.features.fileManager.enabled,\n options: {\n threatDetection: flags.isFileManagerThreatDetectionEnabled()\n ? project.package.features.fileManager.options.threatDetection\n : false\n }\n }\n }\n }\n };\n }\n\n getProjectEnvironment() {\n return this.decoratee.getProjectEnvironment();\n }\n\n getProjectLicense() {\n return this.decoratee.getProjectLicense();\n }\n\n canUseFeature(wcpFeatureId: keyof typeof WCP_FEATURE_LABEL) {\n return this.decoratee.canUseFeature(wcpFeatureId);\n }\n\n canUseAacl() {\n return this.decoratee.canUseAacl() && this.featureFlags.get().isAaclEnabled();\n }\n\n canUseTeams() {\n return this.decoratee.canUseTeams() && this.featureFlags.get().isTeamsEnabled();\n }\n\n canUseFolderLevelPermissions() {\n return (\n this.decoratee.canUseFolderLevelPermissions() &&\n this.featureFlags.get().isFolderLevelPermissionsEnabled()\n );\n }\n\n canUsePrivateFiles() {\n return (\n this.decoratee.canUsePrivateFiles() && this.featureFlags.get().isPrivateFilesEnabled()\n );\n }\n\n canUseAuditLogs() {\n return this.decoratee.canUseAuditLogs() && this.featureFlags.get().isAuditLogsEnabled();\n }\n\n canUseRecordLocking() {\n return (\n this.decoratee.canUseRecordLocking() && this.featureFlags.get().isRecordLockingEnabled()\n );\n }\n\n canUseFileManagerThreatDetection() {\n return (\n this.decoratee.canUseFileManagerThreatDetection() &&\n this.featureFlags.get().isFileManagerThreatDetectionEnabled()\n );\n }\n\n canUseWorkflows() {\n return this.decoratee.canUseWorkflows() && this.featureFlags.get().isWorkflowsEnabled();\n }\n\n canUseHcmsFieldPermissions() {\n return this.decoratee.canUseHcmsFieldPermissions();\n }\n\n ensureCanUseFeature(featureId: keyof typeof WCP_FEATURE_LABEL) {\n return this.decoratee.ensureCanUseFeature(featureId);\n }\n\n async incrementSeats() {\n return this.decoratee.incrementSeats();\n }\n\n async decrementSeats() {\n return this.decoratee.decrementSeats();\n }\n\n async incrementTenants() {\n return this.decoratee.incrementTenants();\n }\n\n async decrementTenants() {\n return this.decoratee.decrementTenants();\n }\n\n toDto() {\n return this.decoratee.toDto();\n }\n}\n\nexport const WcpContextWithFeatureFlagsDecorator = WcpContext.createDecorator({\n decorator: WcpContextWithFeatureFlagsDecoratorImpl,\n dependencies: [FeatureFlags]\n});\n"],"mappings":"AACA,SAASA,UAAU;AACnB,SAASC,YAAY;AAErB,MAAMC,uCAAuC,CAAiC;EAC1EC,WAAWA,CACCC,YAAoC,EACpCC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,EAAEzD,uCAAuC;EAClD0D,YAAY,EAAE,CAAC3D,YAAY;AAC/B,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["WcpContext","FeatureFlags","WcpContextWithFeatureFlagsDecoratorImpl","constructor","featureFlags","decoratee","getRawLicense","getProject","getProjectWithFeatureFlags","project","flags","get","package","features","multiTenancy","advancedPublishingWorkflow","enabled","isWorkflowsEnabled","advancedAccessControlLayer","isAaclEnabled","options","teams","isTeamsEnabled","privateFiles","isPrivateFilesEnabled","folderLevelPermissions","isFolderLevelPermissionsEnabled","hcmsFieldPermissions","isHcmsFieldPermissionsEnabled","auditLogs","isAuditLogsEnabled","recordLocking","isRecordLockingEnabled","fileManager","threatDetection","isFileManagerThreatDetectionEnabled","aiPowerups","isAiPowerupsEnabled","websiteBuilder","pageGeneration","isAiPageGenerationEnabled","imageEnrichment","isAiImageEnrichmentEnabled","lexicalGeneration","isAiLexicalGenerationEnabled","getProjectEnvironment","getProjectLicense","canUseFeature","wcpFeatureId","canUseAacl","canUseTeams","canUseFolderLevelPermissions","canUsePrivateFiles","canUseAuditLogs","canUseRecordLocking","canUseFileManagerThreatDetection","canUseWorkflows","canUseHcmsFieldPermissions","canUseAiImageEnrichment","canUseAiPageGeneration","canUseAiLexicalGeneration","ensureCanUseFeature","featureId","incrementSeats","decrementSeats","incrementTenants","decrementTenants","toDto","WcpContextWithFeatureFlagsDecorator","createDecorator","decorator","dependencies"],"sources":["WcpContextWithFeatureFlagsDecorator.ts"],"sourcesContent":["import type { WCP_FEATURE_LABEL } from \"@webiny/wcp\";\nimport { WcpContext } from \"../abstractions.js\";\nimport { FeatureFlags } from \"../../../featureFlags/abstractions.js\";\n\nclass WcpContextWithFeatureFlagsDecoratorImpl implements WcpContext.Interface {\n constructor(\n private featureFlags: FeatureFlags.Interface,\n private decoratee: WcpContext.Interface\n ) {}\n\n getRawLicense() {\n return this.decoratee.getRawLicense();\n }\n\n getProject() {\n return this.decoratee.getProject();\n }\n\n getProjectWithFeatureFlags() {\n const project = this.decoratee.getProjectWithFeatureFlags();\n if (!project) {\n return null;\n }\n\n const flags = this.featureFlags.get();\n\n return {\n ...project,\n package: {\n ...project.package,\n features: {\n ...project.package.features,\n multiTenancy: project.package.features.multiTenancy,\n advancedPublishingWorkflow: {\n ...project.package.features.advancedPublishingWorkflow,\n enabled: flags.isWorkflowsEnabled()\n ? project.package.features.advancedPublishingWorkflow.enabled\n : false\n },\n advancedAccessControlLayer: {\n ...project.package.features.advancedAccessControlLayer,\n enabled: flags.isAaclEnabled()\n ? project.package.features.advancedAccessControlLayer.enabled\n : false,\n options: {\n teams: flags.isTeamsEnabled()\n ? project.package.features.advancedAccessControlLayer.options.teams\n : false,\n privateFiles: flags.isPrivateFilesEnabled()\n ? project.package.features.advancedAccessControlLayer.options\n .privateFiles\n : false,\n folderLevelPermissions: flags.isFolderLevelPermissionsEnabled()\n ? project.package.features.advancedAccessControlLayer.options\n .folderLevelPermissions\n : false,\n hcmsFieldPermissions: flags.isHcmsFieldPermissionsEnabled()\n ? project.package.features.advancedAccessControlLayer.options\n .hcmsFieldPermissions\n : false\n }\n },\n auditLogs: {\n ...project.package.features.auditLogs,\n enabled: flags.isAuditLogsEnabled()\n ? project.package.features.auditLogs.enabled\n : false\n },\n recordLocking: {\n ...project.package.features.recordLocking,\n enabled: flags.isRecordLockingEnabled()\n ? project.package.features.recordLocking.enabled\n : false\n },\n fileManager: {\n ...project.package.features.fileManager,\n enabled: project.package.features.fileManager.enabled,\n options: {\n threatDetection: flags.isFileManagerThreatDetectionEnabled()\n ? project.package.features.fileManager.options.threatDetection\n : false\n }\n },\n aiPowerups: {\n ...project.package.features.aiPowerups,\n enabled: flags.isAiPowerupsEnabled()\n ? project.package.features.aiPowerups?.enabled\n : false,\n options: {\n websiteBuilder: {\n pageGeneration: flags.isAiPageGenerationEnabled()\n ? project.package.features.aiPowerups?.options?.websiteBuilder\n ?.pageGeneration\n : false\n },\n fileManager: {\n imageEnrichment: flags.isAiImageEnrichmentEnabled()\n ? project.package.features.aiPowerups?.options?.fileManager\n ?.imageEnrichment\n : false\n },\n lexicalGeneration: flags.isAiLexicalGenerationEnabled()\n ? project.package.features.aiPowerups?.options?.lexicalGeneration\n : false\n }\n }\n }\n }\n };\n }\n\n getProjectEnvironment() {\n return this.decoratee.getProjectEnvironment();\n }\n\n getProjectLicense() {\n return this.decoratee.getProjectLicense();\n }\n\n canUseFeature(wcpFeatureId: keyof typeof WCP_FEATURE_LABEL) {\n return this.decoratee.canUseFeature(wcpFeatureId);\n }\n\n canUseAacl() {\n return this.decoratee.canUseAacl() && this.featureFlags.get().isAaclEnabled();\n }\n\n canUseTeams() {\n return this.decoratee.canUseTeams() && this.featureFlags.get().isTeamsEnabled();\n }\n\n canUseFolderLevelPermissions() {\n return (\n this.decoratee.canUseFolderLevelPermissions() &&\n this.featureFlags.get().isFolderLevelPermissionsEnabled()\n );\n }\n\n canUsePrivateFiles() {\n return (\n this.decoratee.canUsePrivateFiles() && this.featureFlags.get().isPrivateFilesEnabled()\n );\n }\n\n canUseAuditLogs() {\n return this.decoratee.canUseAuditLogs() && this.featureFlags.get().isAuditLogsEnabled();\n }\n\n canUseRecordLocking() {\n return (\n this.decoratee.canUseRecordLocking() && this.featureFlags.get().isRecordLockingEnabled()\n );\n }\n\n canUseFileManagerThreatDetection() {\n return (\n this.decoratee.canUseFileManagerThreatDetection() &&\n this.featureFlags.get().isFileManagerThreatDetectionEnabled()\n );\n }\n\n canUseWorkflows() {\n return this.decoratee.canUseWorkflows() && this.featureFlags.get().isWorkflowsEnabled();\n }\n\n canUseHcmsFieldPermissions() {\n return (\n this.decoratee.canUseHcmsFieldPermissions() &&\n this.featureFlags.get().isHcmsFieldPermissionsEnabled()\n );\n }\n\n canUseAiImageEnrichment() {\n return (\n this.decoratee.canUseAiImageEnrichment() &&\n this.featureFlags.get().isAiImageEnrichmentEnabled()\n );\n }\n\n canUseAiPageGeneration() {\n return (\n this.decoratee.canUseAiPageGeneration() &&\n this.featureFlags.get().isAiPageGenerationEnabled()\n );\n }\n\n canUseAiLexicalGeneration() {\n return (\n this.decoratee.canUseAiLexicalGeneration() &&\n this.featureFlags.get().isAiLexicalGenerationEnabled()\n );\n }\n\n ensureCanUseFeature(featureId: keyof typeof WCP_FEATURE_LABEL) {\n return this.decoratee.ensureCanUseFeature(featureId);\n }\n\n async incrementSeats() {\n return this.decoratee.incrementSeats();\n }\n\n async decrementSeats() {\n return this.decoratee.decrementSeats();\n }\n\n async incrementTenants() {\n return this.decoratee.incrementTenants();\n }\n\n async decrementTenants() {\n return this.decoratee.decrementTenants();\n }\n\n toDto() {\n return this.decoratee.toDto();\n }\n}\n\nexport const WcpContextWithFeatureFlagsDecorator = WcpContext.createDecorator({\n decorator: WcpContextWithFeatureFlagsDecoratorImpl,\n dependencies: [FeatureFlags]\n});\n"],"mappings":"AACA,SAASA,UAAU;AACnB,SAASC,YAAY;AAErB,MAAMC,uCAAuC,CAAiC;EAC1EC,WAAWA,CACCC,YAAoC,EACpCC,SAA+B,EACzC;IAAA,KAFUD,YAAoC,GAApCA,YAAoC;IAAA,KACpCC,SAA+B,GAA/BA,SAA+B;EACxC;EAEHC,aAAaA,CAAA,EAAG;IACZ,OAAO,IAAI,CAACD,SAAS,CAACC,aAAa,CAAC,CAAC;EACzC;EAEAC,UAAUA,CAAA,EAAG;IACT,OAAO,IAAI,CAACF,SAAS,CAACE,UAAU,CAAC,CAAC;EACtC;EAEAC,0BAA0BA,CAAA,EAAG;IACzB,MAAMC,OAAO,GAAG,IAAI,CAACJ,SAAS,CAACG,0BAA0B,CAAC,CAAC;IAC3D,IAAI,CAACC,OAAO,EAAE;MACV,OAAO,IAAI;IACf;IAEA,MAAMC,KAAK,GAAG,IAAI,CAACN,YAAY,CAACO,GAAG,CAAC,CAAC;IAErC,OAAO;MACH,GAAGF,OAAO;MACVG,OAAO,EAAE;QACL,GAAGH,OAAO,CAACG,OAAO;QAClBC,QAAQ,EAAE;UACN,GAAGJ,OAAO,CAACG,OAAO,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IAC1C,IAAI,CAACxD,YAAY,CAACO,GAAG,CAAC,CAAC,CAACiC,4BAA4B,CAAC,CAAC;EAE9D;EAEAiB,mBAAmBA,CAACC,SAAyC,EAAE;IAC3D,OAAO,IAAI,CAACzD,SAAS,CAACwD,mBAAmB,CAACC,SAAS,CAAC;EACxD;EAEA,MAAMC,cAAcA,CAAA,EAAG;IACnB,OAAO,IAAI,CAAC1D,SAAS,CAAC0D,cAAc,CAAC,CAAC;EAC1C;EAEA,MAAMC,cAAcA,CAAA,EAAG;IACnB,OAAO,IAAI,CAAC3D,SAAS,CAAC2D,cAAc,CAAC,CAAC;EAC1C;EAEA,MAAMC,gBAAgBA,CAAA,EAAG;IACrB,OAAO,IAAI,CAAC5D,SAAS,CAAC4D,gBAAgB,CAAC,CAAC;EAC5C;EAEA,MAAMC,gBAAgBA,CAAA,EAAG;IACrB,OAAO,IAAI,CAAC7D,SAAS,CAAC6D,gBAAgB,CAAC,CAAC;EAC5C;EAEAC,KAAKA,CAAA,EAAG;IACJ,OAAO,IAAI,CAAC9D,SAAS,CAAC8D,KAAK,CAAC,CAAC;EACjC;AACJ;AAEA,OAAO,MAAMC,mCAAmC,GAAGpE,UAAU,CAACqE,eAAe,CAAC;EAC1EC,SAAS,EAAEpE,uCAAuC;EAClDqE,YAAY,EAAE,CAACtE,YAAY;AAC/B,CAAC,CAAC","ignoreList":[]}
@@ -1,2 +1,6 @@
1
+ import type { Container } from "@webiny/di";
1
2
  import type { ILicense } from "@webiny/wcp/types.js";
2
- export declare const WcpContextFeature: import("@webiny/feature/api/createFeature.js").FeatureDefinition<ILicense>;
3
+ export declare const WcpContextFeature: {
4
+ name: string;
5
+ register(container: Container, context: ILicense): void;
6
+ };
@@ -1,2 +1,5 @@
1
1
  import type { ILicense } from "@webiny/wcp/types.js";
2
- export declare const WcpFeature: import("@webiny/feature/api/createFeature.js").FeatureDefinition<ILicense>;
2
+ export declare const WcpFeature: {
3
+ name: string;
4
+ register(container: import("@webiny/di").Container, context: ILicense): void;
5
+ };
@@ -1 +1 @@
1
- {"version":3,"names":["createFeature","WcpContextFeature","WcpContextWithFeatureFlagsDecorator","WcpFeature","name","register","container","license","registerDecorator"],"sources":["WcpFeature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { WcpContextFeature } from \"./WcpContext/feature.js\";\nimport { WcpContextWithFeatureFlagsDecorator } from \"./WcpContext/decorators/WcpContextWithFeatureFlagsDecorator.js\";\nimport type { ILicense } from \"@webiny/wcp/types.js\";\n\nexport const WcpFeature = createFeature({\n name: \"WebinyControlPanel\",\n register(container, license: ILicense) {\n WcpContextFeature.register(container, license);\n container.registerDecorator(WcpContextWithFeatureFlagsDecorator);\n }\n});\n"],"mappings":"AAAA,SAASA,aAAa,QAAQ,qBAAqB;AACnD,SAASC,iBAAiB;AAC1B,SAASC,mCAAmC;AAG5C,OAAO,MAAMC,UAAU,GAAGH,aAAa,CAAC;EACpCI,IAAI,EAAE,oBAAoB;EAC1BC,QAAQA,CAACC,SAAS,EAAEC,OAAiB,EAAE;IACnCN,iBAAiB,CAACI,QAAQ,CAACC,SAAS,EAAEC,OAAO,CAAC;IAC9CD,SAAS,CAACE,iBAAiB,CAACN,mCAAmC,CAAC;EACpE;AACJ,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["createFeature","WcpContextFeature","WcpContextWithFeatureFlagsDecorator","WcpFeature","name","register","container","license","registerDecorator"],"sources":["WcpFeature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { WcpContextFeature } from \"./WcpContext/feature.js\";\nimport { WcpContextWithFeatureFlagsDecorator } from \"./WcpContext/decorators/WcpContextWithFeatureFlagsDecorator.js\";\nimport type { ILicense } from \"@webiny/wcp/types.js\";\n\nexport const WcpFeature = createFeature<ILicense>({\n name: \"WebinyControlPanel\",\n register(container, license) {\n WcpContextFeature.register(container, license);\n container.registerDecorator(WcpContextWithFeatureFlagsDecorator);\n }\n});\n"],"mappings":"AAAA,SAASA,aAAa,QAAQ,qBAAqB;AACnD,SAASC,iBAAiB;AAC1B,SAASC,mCAAmC;AAG5C,OAAO,MAAMC,UAAU,GAAGH,aAAa,CAAW;EAC9CI,IAAI,EAAE,oBAAoB;EAC1BC,QAAQA,CAACC,SAAS,EAAEC,OAAO,EAAE;IACzBN,iBAAiB,CAACI,QAAQ,CAACC,SAAS,EAAEC,OAAO,CAAC;IAC9CD,SAAS,CAACE,iBAAiB,CAACN,mCAAmC,CAAC;EACpE;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -4,6 +4,7 @@ interface NotAuthorizedResponseArgsType {
4
4
  code: string | null;
5
5
  data: any | null;
6
6
  }
7
+ /** GraphQL not-authorized response helper. */
7
8
  export declare class NotAuthorizedResponse extends ErrorResponse {
8
9
  constructor({ message, code, data }?: Partial<NotAuthorizedResponseArgsType>);
9
10
  }
@@ -1,4 +1,5 @@
1
1
  import { ErrorResponse } from "@webiny/handler-graphql/responses.js";
2
+ /** GraphQL not-authorized response helper. */
2
3
  export class NotAuthorizedResponse extends ErrorResponse {
3
4
  constructor({
4
5
  message,
@@ -1 +1 @@
1
- {"version":3,"names":["ErrorResponse","NotAuthorizedResponse","constructor","message","code","data"],"sources":["NotAuthorizedResponse.ts"],"sourcesContent":["import { ErrorResponse } from \"@webiny/handler-graphql/responses.js\";\n\ninterface NotAuthorizedResponseArgsType {\n message: string;\n code: string | null;\n data: any | null;\n}\n\nexport class NotAuthorizedResponse extends ErrorResponse {\n constructor({ message, code, data }: Partial<NotAuthorizedResponseArgsType> = {}) {\n super({\n message: message || \"Not authorized!\",\n code: code || \"SECURITY_NOT_AUTHORIZED\",\n data\n });\n }\n}\n\nexport default NotAuthorizedResponse;\n"],"mappings":"AAAA,SAASA,aAAa,QAAQ,sCAAsC;AAQpE,OAAO,MAAMC,qBAAqB,SAASD,aAAa,CAAC;EACrDE,WAAWA,CAAC;IAAEC,OAAO;IAAEC,IAAI;IAAEC;EAA6C,CAAC,GAAG,CAAC,CAAC,EAAE;IAC9E,KAAK,CAAC;MACFF,OAAO,EAAEA,OAAO,IAAI,iBAAiB;MACrCC,IAAI,EAAEA,IAAI,IAAI,yBAAyB;MACvCC;IACJ,CAAC,CAAC;EACN;AACJ;AAEA,eAAeJ,qBAAqB","ignoreList":[]}
1
+ {"version":3,"names":["ErrorResponse","NotAuthorizedResponse","constructor","message","code","data"],"sources":["NotAuthorizedResponse.ts"],"sourcesContent":["import { ErrorResponse } from \"@webiny/handler-graphql/responses.js\";\n\ninterface NotAuthorizedResponseArgsType {\n message: string;\n code: string | null;\n data: any | null;\n}\n\n/** GraphQL not-authorized response helper. */\nexport class NotAuthorizedResponse extends ErrorResponse {\n constructor({ message, code, data }: Partial<NotAuthorizedResponseArgsType> = {}) {\n super({\n message: message || \"Not authorized!\",\n code: code || \"SECURITY_NOT_AUTHORIZED\",\n data\n });\n }\n}\n\nexport default NotAuthorizedResponse;\n"],"mappings":"AAAA,SAASA,aAAa,QAAQ,sCAAsC;AAQpE;AACA,OAAO,MAAMC,qBAAqB,SAASD,aAAa,CAAC;EACrDE,WAAWA,CAAC;IAAEC,OAAO;IAAEC,IAAI;IAAEC;EAA6C,CAAC,GAAG,CAAC,CAAC,EAAE;IAC9E,KAAK,CAAC;MACFF,OAAO,EAAEA,OAAO,IAAI,iBAAiB;MACrCC,IAAI,EAAEA,IAAI,IAAI,yBAAyB;MACvCC;IACJ,CAAC,CAAC;EACN;AACJ;AAEA,eAAeJ,qBAAqB","ignoreList":[]}
@@ -18,6 +18,7 @@ export const createWcpGraphQL = () => {
18
18
  auditLogs: WcpProjectPackageFeaturesFeature
19
19
  recordLocking: WcpProjectPackageFeaturesFeature
20
20
  fileManager: WcpProjectPackageFeaturesFeature
21
+ aiPowerups: WcpProjectPackageFeaturesFeature
21
22
  }
22
23
 
23
24
  type WcpProjectPackage {
@@ -1 +1 @@
1
- {"version":3,"names":["GraphQLSchemaPlugin","ErrorResponse","Response","WcpContext","emptyResolver","createWcpGraphQL","typeDefs","resolvers","Query","wcp","WcpQuery","getProject","_","__","context","wcpContext","container","resolve","project","getProjectWithFeatureFlags","Error","e","code","message","data","stack"],"sources":["graphql.ts"],"sourcesContent":["import { GraphQLSchemaPlugin } from \"@webiny/handler-graphql/plugins/index.js\";\nimport { ErrorResponse, Response } from \"@webiny/handler-graphql/responses.js\";\nimport { WcpContext } from \"~/features/wcp/WcpContext/index.js\";\n\nconst emptyResolver = () => ({});\n\nexport const createWcpGraphQL = () => {\n return new GraphQLSchemaPlugin({\n typeDefs: /* GraphQL */ `\n type WcpProjectPackageFeaturesFeature {\n enabled: Boolean\n options: JSON\n }\n\n type WcpProjectPackageFeatures {\n seats: WcpProjectPackageFeaturesFeature\n multiTenancy: WcpProjectPackageFeaturesFeature\n advancedPublishingWorkflow: WcpProjectPackageFeaturesFeature\n advancedAccessControlLayer: WcpProjectPackageFeaturesFeature\n auditLogs: WcpProjectPackageFeaturesFeature\n recordLocking: WcpProjectPackageFeaturesFeature\n fileManager: WcpProjectPackageFeaturesFeature\n }\n\n type WcpProjectPackage {\n features: WcpProjectPackageFeatures\n }\n\n type WcpProject {\n orgId: ID\n projectId: ID\n package: WcpProjectPackage\n }\n\n type WcpError {\n code: String\n message: String\n data: JSON\n stack: String\n }\n\n type WcpProjectResponse {\n data: WcpProject\n error: WcpError\n }\n\n type WcpQuery {\n getProject: WcpProjectResponse\n }\n\n type WcpMutation {\n updateProject: WcpProjectResponse\n }\n\n extend type Query {\n wcp: WcpQuery\n }\n\n extend type Mutation {\n wcp: WcpMutation\n }\n `,\n resolvers: {\n Query: {\n wcp: emptyResolver\n },\n WcpQuery: {\n getProject: async (_, __, context) => {\n try {\n const wcpContext = context.container.resolve(WcpContext);\n const project = wcpContext.getProjectWithFeatureFlags();\n\n if (!project) {\n throw Error(`Could not get project!`);\n }\n\n return new Response(project);\n } catch (e) {\n return new ErrorResponse({\n code: \"COULD_NOT_GET_PROJECT\",\n message: e.message,\n data: null,\n stack: e.stack\n });\n }\n }\n }\n }\n });\n};\n"],"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":[]}
1
+ {"version":3,"names":["GraphQLSchemaPlugin","ErrorResponse","Response","WcpContext","emptyResolver","createWcpGraphQL","typeDefs","resolvers","Query","wcp","WcpQuery","getProject","_","__","context","wcpContext","container","resolve","project","getProjectWithFeatureFlags","Error","e","code","message","data","stack"],"sources":["graphql.ts"],"sourcesContent":["import { GraphQLSchemaPlugin } from \"@webiny/handler-graphql/plugins/index.js\";\nimport { ErrorResponse, Response } from \"@webiny/handler-graphql/responses.js\";\nimport { WcpContext } from \"~/features/wcp/WcpContext/index.js\";\n\nconst emptyResolver = () => ({});\n\nexport const createWcpGraphQL = () => {\n return new GraphQLSchemaPlugin({\n typeDefs: /* GraphQL */ `\n type WcpProjectPackageFeaturesFeature {\n enabled: Boolean\n options: JSON\n }\n\n type WcpProjectPackageFeatures {\n seats: WcpProjectPackageFeaturesFeature\n multiTenancy: WcpProjectPackageFeaturesFeature\n advancedPublishingWorkflow: WcpProjectPackageFeaturesFeature\n advancedAccessControlLayer: WcpProjectPackageFeaturesFeature\n auditLogs: WcpProjectPackageFeaturesFeature\n recordLocking: WcpProjectPackageFeaturesFeature\n fileManager: WcpProjectPackageFeaturesFeature\n aiPowerups: WcpProjectPackageFeaturesFeature\n }\n\n type WcpProjectPackage {\n features: WcpProjectPackageFeatures\n }\n\n type WcpProject {\n orgId: ID\n projectId: ID\n package: WcpProjectPackage\n }\n\n type WcpError {\n code: String\n message: String\n data: JSON\n stack: String\n }\n\n type WcpProjectResponse {\n data: WcpProject\n error: WcpError\n }\n\n type WcpQuery {\n getProject: WcpProjectResponse\n }\n\n type WcpMutation {\n updateProject: WcpProjectResponse\n }\n\n extend type Query {\n wcp: WcpQuery\n }\n\n extend type Mutation {\n wcp: WcpMutation\n }\n `,\n resolvers: {\n Query: {\n wcp: emptyResolver\n },\n WcpQuery: {\n getProject: async (_, __, context) => {\n try {\n const wcpContext = context.container.resolve(WcpContext);\n const project = wcpContext.getProjectWithFeatureFlags();\n\n if (!project) {\n throw Error(`Could not get project!`);\n }\n\n return new Response(project);\n } catch (e) {\n return new ErrorResponse({\n code: \"COULD_NOT_GET_PROJECT\",\n message: e.message,\n data: null,\n stack: e.stack\n });\n }\n }\n }\n }\n });\n};\n"],"mappings":"AAAA,SAASA,mBAAmB,QAAQ,0CAA0C;AAC9E,SAASC,aAAa,EAAEC,QAAQ,QAAQ,sCAAsC;AAC9E,SAASC,UAAU;AAEnB,MAAMC,aAAa,GAAGA,CAAA,MAAO,CAAC,CAAC,CAAC;AAEhC,OAAO,MAAMC,gBAAgB,GAAGA,CAAA,KAAM;EAClC,OAAO,IAAIL,mBAAmB,CAAC;IAC3BM,QAAQ,EAAE,aAAc;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;IACDC,SAAS,EAAE;MACPC,KAAK,EAAE;QACHC,GAAG,EAAEL;MACT,CAAC;MACDM,QAAQ,EAAE;QACNC,UAAU,EAAE,MAAAA,CAAOC,CAAC,EAAEC,EAAE,EAAEC,OAAO,KAAK;UAClC,IAAI;YACA,MAAMC,UAAU,GAAGD,OAAO,CAACE,SAAS,CAACC,OAAO,CAACd,UAAU,CAAC;YACxD,MAAMe,OAAO,GAAGH,UAAU,CAACI,0BAA0B,CAAC,CAAC;YAEvD,IAAI,CAACD,OAAO,EAAE;cACV,MAAME,KAAK,CAAC,wBAAwB,CAAC;YACzC;YAEA,OAAO,IAAIlB,QAAQ,CAACgB,OAAO,CAAC;UAChC,CAAC,CAAC,OAAOG,CAAC,EAAE;YACR,OAAO,IAAIpB,aAAa,CAAC;cACrBqB,IAAI,EAAE,uBAAuB;cAC7BC,OAAO,EAAEF,CAAC,CAACE,OAAO;cAClBC,IAAI,EAAE,IAAI;cACVC,KAAK,EAAEJ,CAAC,CAACI;YACb,CAAC,CAAC;UACN;QACJ;MACJ;IACJ;EACJ,CAAC,CAAC;AACN,CAAC","ignoreList":[]}
@@ -19,6 +19,7 @@ export interface IIdentityProvider {
19
19
  isApplicable(token: string): boolean;
20
20
  getIdentity(token: string): Promise<IProviderIdentityData | null>;
21
21
  }
22
+ /** Generic identity provider for token-based authentication. */
22
23
  export declare const IdentityProvider: import("@webiny/di").Abstraction<IIdentityProvider>;
23
24
  export declare namespace IdentityProvider {
24
25
  type Interface = IIdentityProvider;
@@ -29,6 +30,7 @@ export interface IJwtIdentityProvider {
29
30
  isApplicable(token: IJwtPayload): boolean;
30
31
  getIdentity(token: string, jwt: IJwt): Promise<IProviderIdentityData | null>;
31
32
  }
33
+ /** JWT-specific identity provider for token validation. */
32
34
  export declare const JwtIdentityProvider: import("@webiny/di").Abstraction<IJwtIdentityProvider>;
33
35
  export declare namespace JwtIdentityProvider {
34
36
  type Interface = IJwtIdentityProvider;
@@ -45,6 +47,7 @@ export interface IOidcIdentityProvider {
45
47
  verifyToken?(token: string): Promise<IJwtPayload | undefined>;
46
48
  verifyTokenClaims?(token: IJwtPayload): Promise<void>;
47
49
  }
50
+ /** OIDC-compliant identity provider with issuer validation. */
48
51
  export declare const OidcIdentityProvider: import("@webiny/di").Abstraction<IOidcIdentityProvider>;
49
52
  export declare namespace OidcIdentityProvider {
50
53
  type Interface = IOidcIdentityProvider;
@@ -54,6 +57,7 @@ export declare namespace OidcIdentityProvider {
54
57
  interface IJwkCache {
55
58
  getKeys(issuer: string): Promise<IJwk[]>;
56
59
  }
60
+ /** Cache for JSON Web Keys used in JWT verification. */
57
61
  export declare const JwkCache: import("@webiny/di").Abstraction<IJwkCache>;
58
62
  export declare namespace JwkCache {
59
63
  type Interface = IJwkCache;
@@ -2,12 +2,16 @@ import { createAbstraction } from "@webiny/feature/api";
2
2
 
3
3
  // Generic Idp Provider
4
4
 
5
+ /** Generic identity provider for token-based authentication. */
5
6
  export const IdentityProvider = createAbstraction("IdentityProvider");
7
+ /** JWT-specific identity provider for token validation. */
6
8
  export const JwtIdentityProvider = createAbstraction("JwtIdentityProvider");
7
9
 
8
10
  // OIDC Provider
9
11
 
12
+ /** OIDC-compliant identity provider with issuer validation. */
10
13
  export const OidcIdentityProvider = createAbstraction("OidcIdentityProvider");
14
+ /** Cache for JSON Web Keys used in JWT verification. */
11
15
  export const JwkCache = createAbstraction("JwkCache");
12
16
 
13
17
  //# sourceMappingURL=abstractions.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["createAbstraction","IdentityProvider","JwtIdentityProvider","OidcIdentityProvider","JwkCache"],"sources":["abstractions.ts"],"sourcesContent":["import type { JwtPayload as IJwtPayload, JwtHeader as IJwtHeader } from \"jsonwebtoken\";\nimport { createAbstraction } from \"@webiny/feature/api\";\nimport type { IdentityData as IIdentityData } from \"~/features/security/IdentityContext/Identity.js\";\nimport type { Jwk as IJwk } from \"~/features/security/utils/verifyJwtUsingJwk.js\";\n\nexport type IJwt = {\n header: IJwtHeader;\n payload: IJwtPayload;\n};\n\nexport type OptionalExternal<T> = Omit<T, \"external\"> & { external?: boolean };\n\nexport type IProviderIdentityData = Omit<IIdentityData, \"type\" | \"profile\"> & {\n /**\n * Defaults to `admin` it omitted.\n */\n type?: string;\n profile?: OptionalExternal<NonNullable<IIdentityData[\"profile\"]>>;\n};\n\n// Generic Idp Provider\nexport interface IIdentityProvider {\n isApplicable(token: string): boolean;\n getIdentity(token: string): Promise<IProviderIdentityData | null>;\n}\n\nexport const IdentityProvider = createAbstraction<IIdentityProvider>(\"IdentityProvider\");\n\nexport namespace IdentityProvider {\n export type Interface = IIdentityProvider;\n export type IdentityData = IProviderIdentityData;\n export type JwtPayload = IJwtPayload;\n}\n\nexport interface IJwtIdentityProvider {\n isApplicable(token: IJwtPayload): boolean;\n getIdentity(token: string, jwt: IJwt): Promise<IProviderIdentityData | null>;\n}\n\nexport const JwtIdentityProvider = createAbstraction<IJwtIdentityProvider>(\"JwtIdentityProvider\");\n\nexport namespace JwtIdentityProvider {\n export type Interface = IJwtIdentityProvider;\n export type Jwt = IJwt;\n export type JwtPayload = IJwtPayload;\n export type JwtHeader = IJwtHeader;\n export type IdentityData = IProviderIdentityData;\n}\n\n// OIDC Provider\nexport interface IOidcIdentityProvider {\n issuer: string;\n clientId: string;\n isApplicable(token: IJwtPayload): boolean;\n getIdentity(jwt: IJwtPayload): Promise<IProviderIdentityData>;\n verifyToken?(token: string): Promise<IJwtPayload | undefined>;\n verifyTokenClaims?(token: IJwtPayload): Promise<void>;\n}\n\nexport const OidcIdentityProvider =\n createAbstraction<IOidcIdentityProvider>(\"OidcIdentityProvider\");\n\nexport namespace OidcIdentityProvider {\n export type Interface = IOidcIdentityProvider;\n export type JwtPayload = IJwtPayload;\n export type IdentityData = IProviderIdentityData;\n}\n\ninterface IJwkCache {\n getKeys(issuer: string): Promise<IJwk[]>;\n}\n\nexport const JwkCache = createAbstraction<IJwkCache>(\"JwkCache\");\nexport namespace JwkCache {\n export type Interface = IJwkCache;\n export type Jwk = IJwk;\n}\n"],"mappings":"AACA,SAASA,iBAAiB,QAAQ,qBAAqB;;AAmBvD;;AAMA,OAAO,MAAMC,gBAAgB,GAAGD,iBAAiB,CAAoB,kBAAkB,CAAC;AAaxF,OAAO,MAAME,mBAAmB,GAAGF,iBAAiB,CAAuB,qBAAqB,CAAC;;AAUjG;;AAUA,OAAO,MAAMG,oBAAoB,GAC7BH,iBAAiB,CAAwB,sBAAsB,CAAC;AAYpE,OAAO,MAAMI,QAAQ,GAAGJ,iBAAiB,CAAY,UAAU,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["createAbstraction","IdentityProvider","JwtIdentityProvider","OidcIdentityProvider","JwkCache"],"sources":["abstractions.ts"],"sourcesContent":["import type { JwtPayload as IJwtPayload, JwtHeader as IJwtHeader } from \"jsonwebtoken\";\nimport { createAbstraction } from \"@webiny/feature/api\";\nimport type { IdentityData as IIdentityData } from \"~/features/security/IdentityContext/Identity.js\";\nimport type { Jwk as IJwk } from \"~/features/security/utils/verifyJwtUsingJwk.js\";\n\nexport type IJwt = {\n header: IJwtHeader;\n payload: IJwtPayload;\n};\n\nexport type OptionalExternal<T> = Omit<T, \"external\"> & { external?: boolean };\n\nexport type IProviderIdentityData = Omit<IIdentityData, \"type\" | \"profile\"> & {\n /**\n * Defaults to `admin` it omitted.\n */\n type?: string;\n profile?: OptionalExternal<NonNullable<IIdentityData[\"profile\"]>>;\n};\n\n// Generic Idp Provider\nexport interface IIdentityProvider {\n isApplicable(token: string): boolean;\n getIdentity(token: string): Promise<IProviderIdentityData | null>;\n}\n\n/** Generic identity provider for token-based authentication. */\nexport const IdentityProvider = createAbstraction<IIdentityProvider>(\"IdentityProvider\");\n\nexport namespace IdentityProvider {\n export type Interface = IIdentityProvider;\n export type IdentityData = IProviderIdentityData;\n export type JwtPayload = IJwtPayload;\n}\n\nexport interface IJwtIdentityProvider {\n isApplicable(token: IJwtPayload): boolean;\n getIdentity(token: string, jwt: IJwt): Promise<IProviderIdentityData | null>;\n}\n\n/** JWT-specific identity provider for token validation. */\nexport const JwtIdentityProvider = createAbstraction<IJwtIdentityProvider>(\"JwtIdentityProvider\");\n\nexport namespace JwtIdentityProvider {\n export type Interface = IJwtIdentityProvider;\n export type Jwt = IJwt;\n export type JwtPayload = IJwtPayload;\n export type JwtHeader = IJwtHeader;\n export type IdentityData = IProviderIdentityData;\n}\n\n// OIDC Provider\nexport interface IOidcIdentityProvider {\n issuer: string;\n clientId: string;\n isApplicable(token: IJwtPayload): boolean;\n getIdentity(jwt: IJwtPayload): Promise<IProviderIdentityData>;\n verifyToken?(token: string): Promise<IJwtPayload | undefined>;\n verifyTokenClaims?(token: IJwtPayload): Promise<void>;\n}\n\n/** OIDC-compliant identity provider with issuer validation. */\nexport const OidcIdentityProvider =\n createAbstraction<IOidcIdentityProvider>(\"OidcIdentityProvider\");\n\nexport namespace OidcIdentityProvider {\n export type Interface = IOidcIdentityProvider;\n export type JwtPayload = IJwtPayload;\n export type IdentityData = IProviderIdentityData;\n}\n\ninterface IJwkCache {\n getKeys(issuer: string): Promise<IJwk[]>;\n}\n\n/** Cache for JSON Web Keys used in JWT verification. */\nexport const JwkCache = createAbstraction<IJwkCache>(\"JwkCache\");\nexport namespace JwkCache {\n export type Interface = IJwkCache;\n export type Jwk = IJwk;\n}\n"],"mappings":"AACA,SAASA,iBAAiB,QAAQ,qBAAqB;;AAmBvD;;AAMA;AACA,OAAO,MAAMC,gBAAgB,GAAGD,iBAAiB,CAAoB,kBAAkB,CAAC;AAaxF;AACA,OAAO,MAAME,mBAAmB,GAAGF,iBAAiB,CAAuB,qBAAqB,CAAC;;AAUjG;;AAUA;AACA,OAAO,MAAMG,oBAAoB,GAC7BH,iBAAiB,CAAwB,sBAAsB,CAAC;AAYpE;AACA,OAAO,MAAMI,QAAQ,GAAGJ,iBAAiB,CAAY,UAAU,CAAC","ignoreList":[]}
package/idp/feature.d.ts CHANGED
@@ -1 +1,4 @@
1
- export declare const IdpAuthenticatorFeature: import("@webiny/feature/api/createFeature.js").FeatureDefinition<unknown>;
1
+ export declare const IdpAuthenticatorFeature: {
2
+ name: string;
3
+ register(container: import("@webiny/di").Container): void;
4
+ };
@@ -1,19 +1,8 @@
1
1
  import { ContextPlugin } from "@webiny/api";
2
- import { RolesProvider, TeamsProvider } from "../../features/security/shared/abstractions.js";
3
- import { SecurityRolePlugin } from "./plugins/SecurityRolePlugin.js";
4
- import { SecurityTeamPlugin } from "./plugins/SecurityTeamPlugin.js";
5
2
  import { LegacyContext } from "./LegacyContext.js";
6
3
  import { createSecurityGraphQL } from "../../graphql/security/index.js";
7
4
  export const createSecurityContext = () => {
8
5
  return new ContextPlugin(async context => {
9
- // Register roles and teams providers for plugin-defined roles/teams
10
- context.container.registerFactory(RolesProvider, () => {
11
- return async () => context.plugins.byType(SecurityRolePlugin.type).map(plugin => plugin.securityRole);
12
- });
13
- context.container.registerFactory(TeamsProvider, () => {
14
- return async () => context.plugins.byType(SecurityTeamPlugin.type).map(plugin => plugin.securityTeam);
15
- });
16
-
17
6
  // Create a legacy context that delegates to new features
18
7
  context.security = new LegacyContext(context.container);
19
8
 
@@ -1 +1 @@
1
- {"version":3,"names":["ContextPlugin","RolesProvider","TeamsProvider","SecurityRolePlugin","SecurityTeamPlugin","LegacyContext","createSecurityGraphQL","createSecurityContext","context","container","registerFactory","plugins","byType","type","map","plugin","securityRole","securityTeam","security","register"],"sources":["createSecurityContext.ts"],"sourcesContent":["import { ContextPlugin } from \"@webiny/api\";\nimport type { ApiCoreContext } from \"~/types/core.js\";\nimport { RolesProvider, TeamsProvider } from \"~/features/security/shared/abstractions.js\";\nimport { SecurityRolePlugin } from \"~/legacy/security/plugins/SecurityRolePlugin.js\";\nimport { SecurityTeamPlugin } from \"~/legacy/security/plugins/SecurityTeamPlugin.js\";\nimport { LegacyContext } from \"~/legacy/security/LegacyContext.js\";\nimport { createSecurityGraphQL } from \"~/graphql/security/index.js\";\n\nexport const createSecurityContext = () => {\n return new ContextPlugin<ApiCoreContext>(async context => {\n // Register roles and teams providers for plugin-defined roles/teams\n context.container.registerFactory(RolesProvider, () => {\n return async () =>\n context.plugins\n .byType<SecurityRolePlugin>(SecurityRolePlugin.type)\n .map(plugin => plugin.securityRole);\n });\n\n context.container.registerFactory(TeamsProvider, () => {\n return async () =>\n context.plugins\n .byType<SecurityTeamPlugin>(SecurityTeamPlugin.type)\n .map(plugin => plugin.securityTeam);\n });\n\n // Create a legacy context that delegates to new features\n context.security = new LegacyContext(context.container);\n\n // Register GraphQL plugins\n context.plugins.register(createSecurityGraphQL());\n });\n};\n"],"mappings":"AAAA,SAASA,aAAa,QAAQ,aAAa;AAE3C,SAASC,aAAa,EAAEC,aAAa;AACrC,SAASC,kBAAkB;AAC3B,SAASC,kBAAkB;AAC3B,SAASC,aAAa;AACtB,SAASC,qBAAqB;AAE9B,OAAO,MAAMC,qBAAqB,GAAGA,CAAA,KAAM;EACvC,OAAO,IAAIP,aAAa,CAAiB,MAAMQ,OAAO,IAAI;IACtD;IACAA,OAAO,CAACC,SAAS,CAACC,eAAe,CAACT,aAAa,EAAE,MAAM;MACnD,OAAO,YACHO,OAAO,CAACG,OAAO,CACVC,MAAM,CAAqBT,kBAAkB,CAACU,IAAI,CAAC,CACnDC,GAAG,CAACC,MAAM,IAAIA,MAAM,CAACC,YAAY,CAAC;IAC/C,CAAC,CAAC;IAEFR,OAAO,CAACC,SAAS,CAACC,eAAe,CAACR,aAAa,EAAE,MAAM;MACnD,OAAO,YACHM,OAAO,CAACG,OAAO,CACVC,MAAM,CAAqBR,kBAAkB,CAACS,IAAI,CAAC,CACnDC,GAAG,CAACC,MAAM,IAAIA,MAAM,CAACE,YAAY,CAAC;IAC/C,CAAC,CAAC;;IAEF;IACAT,OAAO,CAACU,QAAQ,GAAG,IAAIb,aAAa,CAACG,OAAO,CAACC,SAAS,CAAC;;IAEvD;IACAD,OAAO,CAACG,OAAO,CAACQ,QAAQ,CAACb,qBAAqB,CAAC,CAAC,CAAC;EACrD,CAAC,CAAC;AACN,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["ContextPlugin","LegacyContext","createSecurityGraphQL","createSecurityContext","context","security","container","plugins","register"],"sources":["createSecurityContext.ts"],"sourcesContent":["import { ContextPlugin } from \"@webiny/api\";\nimport type { ApiCoreContext } from \"~/types/core.js\";\nimport { LegacyContext } from \"~/legacy/security/LegacyContext.js\";\nimport { createSecurityGraphQL } from \"~/graphql/security/index.js\";\n\nexport const createSecurityContext = () => {\n return new ContextPlugin<ApiCoreContext>(async context => {\n // Create a legacy context that delegates to new features\n context.security = new LegacyContext(context.container);\n\n // Register GraphQL plugins\n context.plugins.register(createSecurityGraphQL());\n });\n};\n"],"mappings":"AAAA,SAASA,aAAa,QAAQ,aAAa;AAE3C,SAASC,aAAa;AACtB,SAASC,qBAAqB;AAE9B,OAAO,MAAMC,qBAAqB,GAAGA,CAAA,KAAM;EACvC,OAAO,IAAIH,aAAa,CAAiB,MAAMI,OAAO,IAAI;IACtD;IACAA,OAAO,CAACC,QAAQ,GAAG,IAAIJ,aAAa,CAACG,OAAO,CAACE,SAAS,CAAC;;IAEvD;IACAF,OAAO,CAACG,OAAO,CAACC,QAAQ,CAACN,qBAAqB,CAAC,CAAC,CAAC;EACrD,CAAC,CAAC;AACN,CAAC","ignoreList":[]}
@@ -2,4 +2,4 @@ import type { ApiCoreContext } from "../../../types/core.js";
2
2
  export interface GetHeader {
3
3
  (context: ApiCoreContext): string | null | undefined;
4
4
  }
5
- export declare const authenticateUsingHttpHeader: () => (import("@webiny/handler").HandlerOnRequestPlugin<import("@webiny/handler/types.js").Context> | import("@webiny/handler").BeforeHandlerPlugin<ApiCoreContext> | (import("@webiny/api/index.js").ContextPlugin<ApiCoreContext> | import("@webiny/handler").BeforeHandlerPlugin<ApiCoreContext>)[])[];
5
+ export declare const authenticateUsingHttpHeader: () => (import("@webiny/handler").BeforeHandlerPlugin<ApiCoreContext> | (import("@webiny/api/index.js").ContextPlugin<ApiCoreContext> | import("@webiny/handler").BeforeHandlerPlugin<ApiCoreContext>)[] | import("@webiny/handler").HandlerOnRequestPlugin<import("@webiny/handler/types.js").Context>)[];
@@ -21,6 +21,9 @@ export declare class LegacyWcpContext implements WcpContextObject {
21
21
  canUseFileManagerThreatDetection(): boolean;
22
22
  canUseWorkflows(): boolean;
23
23
  canUseHcmsFieldPermissions(): boolean;
24
+ canUseAiImageEnrichment(): boolean;
25
+ canUseAiPageGeneration(): boolean;
26
+ canUseAiLexicalGeneration(): boolean;
24
27
  ensureCanUseFeature(featureId: keyof typeof WCP_FEATURE_LABEL): void;
25
28
  incrementSeats(): Promise<void>;
26
29
  decrementSeats(): Promise<void>;
@@ -51,6 +51,15 @@ export class LegacyWcpContext {
51
51
  canUseHcmsFieldPermissions() {
52
52
  return this.getWcpContext().canUseHcmsFieldPermissions();
53
53
  }
54
+ canUseAiImageEnrichment() {
55
+ return this.getWcpContext().canUseAiImageEnrichment();
56
+ }
57
+ canUseAiPageGeneration() {
58
+ return this.getWcpContext().canUseAiPageGeneration();
59
+ }
60
+ canUseAiLexicalGeneration() {
61
+ return this.getWcpContext().canUseAiLexicalGeneration();
62
+ }
54
63
  ensureCanUseFeature(featureId) {
55
64
  this.getWcpContext().ensureCanUseFeature(featureId);
56
65
  }
@@ -1 +1 @@
1
- {"version":3,"names":["WcpContext","LegacyWcpContext","constructor","container","getWcpContext","resolve","getRawLicense","getProject","getProjectWithFeatureFlags","getProjectLicense","getProjectEnvironment","canUseFeature","wcpFeatureId","canUseAacl","canUseTeams","canUseFolderLevelPermissions","canUsePrivateFiles","canUseAuditLogs","canUseRecordLocking","canUseFileManagerThreatDetection","canUseWorkflows","canUseHcmsFieldPermissions","ensureCanUseFeature","featureId","incrementSeats","decrementSeats","incrementTenants","decrementTenants","toDto"],"sources":["LegacyWcpContext.ts"],"sourcesContent":["import { Container } from \"@webiny/di\";\nimport type { WCP_FEATURE_LABEL } from \"@webiny/wcp\";\nimport type {\n DecryptedWcpProjectLicense,\n ILicense,\n WcpProject,\n WcpProjectEnvironment\n} from \"@webiny/wcp/types.js\";\nimport { WcpContextObject } from \"~/features/wcp/WcpContext/types.js\";\nimport { WcpContext } from \"~/features/wcp/WcpContext/index.js\";\n\nexport class LegacyWcpContext implements WcpContextObject {\n constructor(private container: Container) {}\n\n private getWcpContext(): WcpContext.Interface {\n return this.container.resolve(WcpContext);\n }\n\n getRawLicense(): DecryptedWcpProjectLicense | null {\n return this.getWcpContext().getRawLicense();\n }\n\n getProject(): WcpProject | null {\n return this.getWcpContext().getProject();\n }\n\n getProjectWithFeatureFlags(): WcpProject | null {\n return this.getWcpContext().getProjectWithFeatureFlags();\n }\n\n getProjectLicense(): ILicense {\n return this.getWcpContext().getProjectLicense();\n }\n\n getProjectEnvironment(): WcpProjectEnvironment | null {\n return this.getWcpContext().getProjectEnvironment();\n }\n\n canUseFeature(wcpFeatureId: keyof typeof WCP_FEATURE_LABEL): boolean {\n return this.getWcpContext().canUseFeature(wcpFeatureId);\n }\n\n canUseAacl(): boolean {\n return this.getWcpContext().canUseAacl();\n }\n\n canUseTeams(): boolean {\n return this.getWcpContext().canUseTeams();\n }\n\n canUseFolderLevelPermissions(): boolean {\n return this.getWcpContext().canUseFolderLevelPermissions();\n }\n\n canUsePrivateFiles(): boolean {\n return this.getWcpContext().canUsePrivateFiles();\n }\n\n canUseAuditLogs(): boolean {\n return this.getWcpContext().canUseAuditLogs();\n }\n\n canUseRecordLocking(): boolean {\n return this.getWcpContext().canUseRecordLocking();\n }\n\n canUseFileManagerThreatDetection(): boolean {\n return this.getWcpContext().canUseFileManagerThreatDetection();\n }\n\n canUseWorkflows(): boolean {\n return this.getWcpContext().canUseWorkflows();\n }\n\n canUseHcmsFieldPermissions(): boolean {\n return this.getWcpContext().canUseHcmsFieldPermissions();\n }\n\n ensureCanUseFeature(featureId: keyof typeof WCP_FEATURE_LABEL): void {\n this.getWcpContext().ensureCanUseFeature(featureId);\n }\n\n async incrementSeats(): Promise<void> {\n await this.getWcpContext().incrementSeats();\n }\n\n async decrementSeats(): Promise<void> {\n await this.getWcpContext().decrementSeats();\n }\n\n async incrementTenants(): Promise<void> {\n await this.getWcpContext().incrementTenants();\n }\n\n async decrementTenants(): Promise<void> {\n await this.getWcpContext().decrementTenants();\n }\n\n toDto(): DecryptedWcpProjectLicense | null {\n return this.getWcpContext().toDto();\n }\n}\n"],"mappings":"AASA,SAASA,UAAU;AAEnB,OAAO,MAAMC,gBAAgB,CAA6B;EACtDC,WAAWA,CAASC,SAAoB,EAAE;IAAA,KAAtBA,SAAoB,GAApBA,SAAoB;EAAG;EAEnCC,aAAaA,CAAA,EAAyB;IAC1C,OAAO,IAAI,CAACD,SAAS,CAACE,OAAO,CAACL,UAAU,CAAC;EAC7C;EAEAM,aAAaA,CAAA,EAAsC;IAC/C,OAAO,IAAI,CAACF,aAAa,CAAC,CAAC,CAACE,aAAa,CAAC,CAAC;EAC/C;EAEAC,UAAUA,CAAA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AEAC,eAAeA,CAAA,EAAY;IACvB,OAAO,IAAI,CAAChB,aAAa,CAAC,CAAC,CAACgB,eAAe,CAAC,CAAC;EACjD;EAEAC,0BAA0BA,CAAA,EAAY;IAClC,OAAO,IAAI,CAACjB,aAAa,CAAC,CAAC,CAACiB,0BAA0B,CAAC,CAAC;EAC5D;EAEAC,mBAAmBA,CAACC,SAAyC,EAAQ;IACjE,IAAI,CAACnB,aAAa,CAAC,CAAC,CAACkB,mBAAmB,CAACC,SAAS,CAAC;EACvD;EAEA,MAAMC,cAAcA,CAAA,EAAkB;IAClC,MAAM,IAAI,CAACpB,aAAa,CAAC,CAAC,CAACoB,cAAc,CAAC,CAAC;EAC/C;EAEA,MAAMC,cAAcA,CAAA,EAAkB;IAClC,MAAM,IAAI,CAACrB,aAAa,CAAC,CAAC,CAACqB,cAAc,CAAC,CAAC;EAC/C;EAEA,MAAMC,gBAAgBA,CAAA,EAAkB;IACpC,MAAM,IAAI,CAACtB,aAAa,CAAC,CAAC,CAACsB,gBAAgB,CAAC,CAAC;EACjD;EAEA,MAAMC,gBAAgBA,CAAA,EAAkB;IACpC,MAAM,IAAI,CAACvB,aAAa,CAAC,CAAC,CAACuB,gBAAgB,CAAC,CAAC;EACjD;EAEAC,KAAKA,CAAA,EAAsC;IACvC,OAAO,IAAI,CAACxB,aAAa,CAAC,CAAC,CAACwB,KAAK,CAAC,CAAC;EACvC;AACJ","ignoreList":[]}
1
+ {"version":3,"names":["WcpContext","LegacyWcpContext","constructor","container","getWcpContext","resolve","getRawLicense","getProject","getProjectWithFeatureFlags","getProjectLicense","getProjectEnvironment","canUseFeature","wcpFeatureId","canUseAacl","canUseTeams","canUseFolderLevelPermissions","canUsePrivateFiles","canUseAuditLogs","canUseRecordLocking","canUseFileManagerThreatDetection","canUseWorkflows","canUseHcmsFieldPermissions","canUseAiImageEnrichment","canUseAiPageGeneration","canUseAiLexicalGeneration","ensureCanUseFeature","featureId","incrementSeats","decrementSeats","incrementTenants","decrementTenants","toDto"],"sources":["LegacyWcpContext.ts"],"sourcesContent":["import { Container } from \"@webiny/di\";\nimport type { WCP_FEATURE_LABEL } from \"@webiny/wcp\";\nimport type {\n DecryptedWcpProjectLicense,\n ILicense,\n WcpProject,\n WcpProjectEnvironment\n} from \"@webiny/wcp/types.js\";\nimport { WcpContextObject } from \"~/features/wcp/WcpContext/types.js\";\nimport { WcpContext } from \"~/features/wcp/WcpContext/index.js\";\n\nexport class LegacyWcpContext implements WcpContextObject {\n constructor(private container: Container) {}\n\n private getWcpContext(): WcpContext.Interface {\n return this.container.resolve(WcpContext);\n }\n\n getRawLicense(): DecryptedWcpProjectLicense | null {\n return this.getWcpContext().getRawLicense();\n }\n\n getProject(): WcpProject | null {\n return this.getWcpContext().getProject();\n }\n\n getProjectWithFeatureFlags(): WcpProject | null {\n return this.getWcpContext().getProjectWithFeatureFlags();\n }\n\n getProjectLicense(): ILicense {\n return this.getWcpContext().getProjectLicense();\n }\n\n getProjectEnvironment(): WcpProjectEnvironment | null {\n return this.getWcpContext().getProjectEnvironment();\n }\n\n canUseFeature(wcpFeatureId: keyof typeof WCP_FEATURE_LABEL): boolean {\n return this.getWcpContext().canUseFeature(wcpFeatureId);\n }\n\n canUseAacl(): boolean {\n return this.getWcpContext().canUseAacl();\n }\n\n canUseTeams(): boolean {\n return this.getWcpContext().canUseTeams();\n }\n\n canUseFolderLevelPermissions(): boolean {\n return this.getWcpContext().canUseFolderLevelPermissions();\n }\n\n canUsePrivateFiles(): boolean {\n return this.getWcpContext().canUsePrivateFiles();\n }\n\n canUseAuditLogs(): boolean {\n return this.getWcpContext().canUseAuditLogs();\n }\n\n canUseRecordLocking(): boolean {\n return this.getWcpContext().canUseRecordLocking();\n }\n\n canUseFileManagerThreatDetection(): boolean {\n return this.getWcpContext().canUseFileManagerThreatDetection();\n }\n\n canUseWorkflows(): boolean {\n return this.getWcpContext().canUseWorkflows();\n }\n\n canUseHcmsFieldPermissions(): boolean {\n return this.getWcpContext().canUseHcmsFieldPermissions();\n }\n\n canUseAiImageEnrichment(): boolean {\n return this.getWcpContext().canUseAiImageEnrichment();\n }\n\n canUseAiPageGeneration(): boolean {\n return this.getWcpContext().canUseAiPageGeneration();\n }\n\n canUseAiLexicalGeneration(): boolean {\n return this.getWcpContext().canUseAiLexicalGeneration();\n }\n\n ensureCanUseFeature(featureId: keyof typeof WCP_FEATURE_LABEL): void {\n this.getWcpContext().ensureCanUseFeature(featureId);\n }\n\n async incrementSeats(): Promise<void> {\n await this.getWcpContext().incrementSeats();\n }\n\n async decrementSeats(): Promise<void> {\n await this.getWcpContext().decrementSeats();\n }\n\n async incrementTenants(): Promise<void> {\n await this.getWcpContext().incrementTenants();\n }\n\n async decrementTenants(): Promise<void> {\n await this.getWcpContext().decrementTenants();\n }\n\n toDto(): DecryptedWcpProjectLicense | null {\n return this.getWcpContext().toDto();\n }\n}\n"],"mappings":"AASA,SAASA,UAAU;AAEnB,OAAO,MAAMC,gBAAgB,CAA6B;EACtDC,WAAWA,CAASC,SAAoB,EAAE;IAAA,KAAtBA,SAAoB,GAApBA,SAAoB;EAAG;EAEnCC,aAAaA,CAAA,EAAyB;IAC1C,OAAO,IAAI,CAACD,SAAS,CAACE,OAAO,CAACL,UAAU,CAAC;EAC7C;EAEAM,aAAaA,CAAA,EAAsC;IAC/C,OAAO,IAAI,CAACF,aAAa,CAAC,CAAC,CAACE,aAAa,CAAC,CAAC;EAC/C;EAEAC,UAAUA,CAAA,EAAsB;IAC5B,OAAO,IAAI,CAACH,aAAa,CAAC,CAAC,CAACG,UAAU,CAAC,CAAC;EAC5C;EAEAC,0BAA0BA,CAAA,EAAsB;IAC5C,OAAO,IAAI,CAACJ,aAAa,CAAC,CAAC,CAACI,0BAA0B,CAAC,CAAC;EAC5D;EAEAC,iBAAiBA,CAAA,EAAa;IAC1B,OAAO,IAAI,CAACL,aAAa,CAAC,CAAC,CAACK,iBAAiB,CAAC,CAAC;EACnD;EAEAC,qBAAqBA,CAAA,EAAiC;IAClD,OAAO,I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AY;IAC9B,OAAO,IAAI,CAACnB,aAAa,CAAC,CAAC,CAACmB,sBAAsB,CAAC,CAAC;EACxD;EAEAC,yBAAyBA,CAAA,EAAY;IACjC,OAAO,IAAI,CAACpB,aAAa,CAAC,CAAC,CAACoB,yBAAyB,CAAC,CAAC;EAC3D;EAEAC,mBAAmBA,CAACC,SAAyC,EAAQ;IACjE,IAAI,CAACtB,aAAa,CAAC,CAAC,CAACqB,mBAAmB,CAACC,SAAS,CAAC;EACvD;EAEA,MAAMC,cAAcA,CAAA,EAAkB;IAClC,MAAM,IAAI,CAACvB,aAAa,CAAC,CAAC,CAACuB,cAAc,CAAC,CAAC;EAC/C;EAEA,MAAMC,cAAcA,CAAA,EAAkB;IAClC,MAAM,IAAI,CAACxB,aAAa,CAAC,CAAC,CAACwB,cAAc,CAAC,CAAC;EAC/C;EAEA,MAAMC,gBAAgBA,CAAA,EAAkB;IACpC,MAAM,IAAI,CAACzB,aAAa,CAAC,CAAC,CAACyB,gBAAgB,CAAC,CAAC;EACjD;EAEA,MAAMC,gBAAgBA,CAAA,EAAkB;IACpC,MAAM,IAAI,CAAC1B,aAAa,CAAC,CAAC,CAAC0B,gBAAgB,CAAC,CAAC;EACjD;EAEAC,KAAKA,CAAA,EAAsC;IACvC,OAAO,IAAI,CAAC3B,aAAa,CAAC,CAAC,CAAC2B,KAAK,CAAC,CAAC;EACvC;AACJ","ignoreList":[]}
@@ -1,7 +1,5 @@
1
- import { ContextPlugin } from "@webiny/api";
2
1
  import type { DecryptedWcpProjectLicense } from "@webiny/wcp/types.js";
3
- import type { WcpContext } from "../../features/wcp/WcpContext/types.js";
4
2
  export interface CreateWcpContextParams {
5
3
  testProjectLicense?: DecryptedWcpProjectLicense;
6
4
  }
7
- export declare const createWcpContext: (params?: CreateWcpContextParams) => ContextPlugin<WcpContext>;
5
+ export declare const createWcpContext: (params?: CreateWcpContextParams) => import("@webiny/handler/index.js").RegisterExtensionPlugin<import("@webiny/handler/types.js").Context>;
@@ -1,6 +1,6 @@
1
- import { ContextPlugin } from "@webiny/api";
2
1
  import { getWcpProjectLicense, getWcpProjectEnvironment, NullLicense } from "@webiny/wcp";
3
2
  import { License } from "@webiny/wcp";
3
+ import { createRegisterExtensionPlugin } from "@webiny/handler/plugins/RegisterExtensionPlugin.js";
4
4
  import { getWcpProjectLicenseCacheKey } from "../../features/wcp/WcpContext/utils.js";
5
5
  import { WcpFeature } from "../../features/wcp/WcpFeature.js";
6
6
  import { LegacyWcpContext } from "./LegacyWcpContext.js";
@@ -37,9 +37,11 @@ async function loadLicense(testProjectLicense) {
37
37
  return cachedLicense.license;
38
38
  }
39
39
  export const createWcpContext = (params = {}) => {
40
- const plugin = new ContextPlugin(async context => {
40
+ const plugin = createRegisterExtensionPlugin(async context => {
41
41
  const license = await loadLicense(params.testProjectLicense);
42
42
  WcpFeature.register(context.container, license);
43
+
44
+ // @ts-expect-error This is a legacy property
43
45
  context.wcp = new LegacyWcpContext(context.container);
44
46
  context.plugins.register(createWcpGraphQL());
45
47
  });
@@ -1 +1 @@
1
- {"version":3,"names":["ContextPlugin","getWcpProjectLicense","getWcpProjectEnvironment","NullLicense","License","getWcpProjectLicenseCacheKey","WcpFeature","LegacyWcpContext","createWcpGraphQL","wcpProjectEnvironment","cachedLicense","cacheKey","project","license","loadLicense","testProjectLicense","fromLicenseDto","currentCacheKey","decryptedLicenseDto","orgId","org","id","projectId","projectEnvironmentApiKey","apiKey","package","createWcpContext","params","plugin","context","register","container","wcp","plugins","name"],"sources":["context.ts"],"sourcesContent":["import { ContextPlugin } from \"@webiny/api\";\nimport { getWcpProjectLicense, getWcpProjectEnvironment, NullLicense } from \"@webiny/wcp\";\nimport type { DecryptedWcpProjectLicense, ILicense } from \"@webiny/wcp/types.js\";\nimport { License } from \"@webiny/wcp\";\nimport type { CachedWcpProjectLicense, WcpContext } from \"~/features/wcp/WcpContext/types.js\";\nimport { getWcpProjectLicenseCacheKey } from \"~/features/wcp/WcpContext/utils.js\";\nimport { WcpFeature } from \"~/features/wcp/WcpFeature.js\";\nimport { LegacyWcpContext } from \"./LegacyWcpContext.js\";\nimport { createWcpGraphQL } from \"~/graphql/wcp/graphql.js\";\n\nconst wcpProjectEnvironment = getWcpProjectEnvironment();\n\nconst cachedLicense: CachedWcpProjectLicense = {\n cacheKey: null,\n project: null,\n license: new NullLicense()\n};\n\nasync function loadLicense(testProjectLicense?: DecryptedWcpProjectLicense): Promise<ILicense> {\n if (testProjectLicense) {\n cachedLicense.license = License.fromLicenseDto(testProjectLicense);\n } else if (wcpProjectEnvironment) {\n const currentCacheKey = getWcpProjectLicenseCacheKey();\n if (cachedLicense.cacheKey !== currentCacheKey) {\n cachedLicense.cacheKey = currentCacheKey;\n // Pull the project license from the WCP API.\n const decryptedLicenseDto = await getWcpProjectLicense({\n orgId: wcpProjectEnvironment.org.id,\n projectId: wcpProjectEnvironment.project.id,\n projectEnvironmentApiKey: wcpProjectEnvironment.apiKey\n });\n\n if (decryptedLicenseDto) {\n cachedLicense.project = {\n orgId: decryptedLicenseDto.orgId,\n projectId: decryptedLicenseDto.projectId,\n package: decryptedLicenseDto.package\n };\n }\n\n cachedLicense.license = License.fromLicenseDto(decryptedLicenseDto);\n }\n }\n\n return cachedLicense.license;\n}\n\nexport interface CreateWcpContextParams {\n testProjectLicense?: DecryptedWcpProjectLicense;\n}\n\nexport const createWcpContext = (params: CreateWcpContextParams = {}) => {\n const plugin = new ContextPlugin<WcpContext>(async context => {\n const license = await loadLicense(params.testProjectLicense);\n\n WcpFeature.register(context.container, license);\n\n context.wcp = new LegacyWcpContext(context.container);\n\n context.plugins.register(createWcpGraphQL());\n });\n\n plugin.name = \"wcp.context.create\";\n\n return plugin;\n};\n"],"mappings":"AAAA,SAASA,aAAa,QAAQ,aAAa;AAC3C,SAASC,oBAAoB,EAAEC,wBAAwB,EAAEC,WAAW,QAAQ,aAAa;AAEzF,SAASC,OAAO,QAAQ,aAAa;AAErC,SAASC,4BAA4B;AACrC,SAASC,UAAU;AACnB,SAASC,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AAMC,WAAW,CAACa,MAAM,CAACZ,kBAAkB,CAAC;IAE5DT,UAAU,CAACwB,QAAQ,CAACD,OAAO,CAACE,SAAS,EAAElB,OAAO,CAAC;IAE/CgB,OAAO,CAACG,GAAG,GAAG,IAAIzB,gBAAgB,CAACsB,OAAO,CAACE,SAAS,CAAC;IAErDF,OAAO,CAACI,OAAO,CAACH,QAAQ,CAACtB,gBAAgB,CAAC,CAAC,CAAC;EAChD,CAAC,CAAC;EAEFoB,MAAM,CAACM,IAAI,GAAG,oBAAoB;EAElC,OAAON,MAAM;AACjB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["getWcpProjectLicense","getWcpProjectEnvironment","NullLicense","License","createRegisterExtensionPlugin","getWcpProjectLicenseCacheKey","WcpFeature","LegacyWcpContext","createWcpGraphQL","wcpProjectEnvironment","cachedLicense","cacheKey","project","license","loadLicense","testProjectLicense","fromLicenseDto","currentCacheKey","decryptedLicenseDto","orgId","org","id","projectId","projectEnvironmentApiKey","apiKey","package","createWcpContext","params","plugin","context","register","container","wcp","plugins","name"],"sources":["context.ts"],"sourcesContent":["import { getWcpProjectLicense, getWcpProjectEnvironment, NullLicense } from \"@webiny/wcp\";\nimport type { DecryptedWcpProjectLicense, ILicense } from \"@webiny/wcp/types.js\";\nimport { License } from \"@webiny/wcp\";\nimport { createRegisterExtensionPlugin } from \"@webiny/handler/plugins/RegisterExtensionPlugin.js\";\nimport type { CachedWcpProjectLicense } from \"~/features/wcp/WcpContext/types.js\";\nimport { getWcpProjectLicenseCacheKey } from \"~/features/wcp/WcpContext/utils.js\";\nimport { WcpFeature } from \"~/features/wcp/WcpFeature.js\";\nimport { LegacyWcpContext } from \"./LegacyWcpContext.js\";\nimport { createWcpGraphQL } from \"~/graphql/wcp/graphql.js\";\n\nconst wcpProjectEnvironment = getWcpProjectEnvironment();\n\nconst cachedLicense: CachedWcpProjectLicense = {\n cacheKey: null,\n project: null,\n license: new NullLicense()\n};\n\nasync function loadLicense(testProjectLicense?: DecryptedWcpProjectLicense): Promise<ILicense> {\n if (testProjectLicense) {\n cachedLicense.license = License.fromLicenseDto(testProjectLicense);\n } else if (wcpProjectEnvironment) {\n const currentCacheKey = getWcpProjectLicenseCacheKey();\n if (cachedLicense.cacheKey !== currentCacheKey) {\n cachedLicense.cacheKey = currentCacheKey;\n // Pull the project license from the WCP API.\n const decryptedLicenseDto = await getWcpProjectLicense({\n orgId: wcpProjectEnvironment.org.id,\n projectId: wcpProjectEnvironment.project.id,\n projectEnvironmentApiKey: wcpProjectEnvironment.apiKey\n });\n\n if (decryptedLicenseDto) {\n cachedLicense.project = {\n orgId: decryptedLicenseDto.orgId,\n projectId: decryptedLicenseDto.projectId,\n package: decryptedLicenseDto.package\n };\n }\n\n cachedLicense.license = License.fromLicenseDto(decryptedLicenseDto);\n }\n }\n\n return cachedLicense.license;\n}\n\nexport interface CreateWcpContextParams {\n testProjectLicense?: DecryptedWcpProjectLicense;\n}\n\nexport const createWcpContext = (params: CreateWcpContextParams = {}) => {\n const plugin = createRegisterExtensionPlugin(async context => {\n const license = await loadLicense(params.testProjectLicense);\n\n WcpFeature.register(context.container, license);\n\n // @ts-expect-error This is a legacy property\n context.wcp = new LegacyWcpContext(context.container);\n\n context.plugins.register(createWcpGraphQL());\n });\n\n plugin.name = \"wcp.context.create\";\n\n return plugin;\n};\n"],"mappings":"AAAA,SAASA,oBAAoB,EAAEC,wBAAwB,EAAEC,WAAW,QAAQ,aAAa;AAEzF,SAASC,OAAO,QAAQ,aAAa;AACrC,SAASC,6BAA6B,QAAQ,oDAAoD;AAElG,SAASC,4BAA4B;AACrC,SAASC,UAAU;AACnB,SAASC,gBAAgB;AACzB,SAASC,gBAAgB;AAEzB,MAAMC,qBAAqB,GAAGR,wBAAwB,CAAC,CAAC;AAExD,MAAMS,aAAsC,GAAG;EAC3CC,QAAQ,EAAE,IAAI;EACdC,OAAO,EAAE,IAAI;EACbC,OAAO,EAAE,IAAIX,WAAW,CAAC;AAC7B,CAAC;AAED,eAAe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