@webiny/api-core 0.0.0-unstable.e622468070 → 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 (628) hide show
  1. package/ApiCoreFeature.d.ts +5 -1
  2. package/ApiCoreFeature.js +8 -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/{buildParams.d.ts → build-params.d.ts} +1 -0
  11. package/exports/api/build-params.js +4 -0
  12. package/exports/api/build-params.js.map +1 -0
  13. package/exports/api/{eventPublisher.js → event-publisher.d.ts} +1 -2
  14. package/exports/api/event-publisher.js +4 -0
  15. package/exports/api/event-publisher.js.map +1 -0
  16. package/exports/api/{keyValueStore.d.ts → key-value-store.d.ts} +1 -0
  17. package/exports/api/key-value-store.js +4 -0
  18. package/exports/api/key-value-store.js.map +1 -0
  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 +7 -0
  23. package/exports/api/security/api-key.js +9 -0
  24. package/exports/api/security/api-key.js.map +1 -0
  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/FeatureFlags.d.ts +12 -0
  88. package/features/featureFlags/FeatureFlags.js +18 -0
  89. package/features/featureFlags/FeatureFlags.js.map +1 -0
  90. package/features/featureFlags/abstractions.d.ts +8 -0
  91. package/features/featureFlags/abstractions.js +4 -0
  92. package/features/featureFlags/abstractions.js.map +1 -0
  93. package/features/featureFlags/feature.d.ts +5 -0
  94. package/features/featureFlags/feature.js +10 -0
  95. package/features/featureFlags/feature.js.map +1 -0
  96. package/features/keyValueStore/GlobalKeyValueStore.js +3 -1
  97. package/features/keyValueStore/GlobalKeyValueStore.js.map +1 -1
  98. package/features/keyValueStore/KeyValueStoreRepository.d.ts +2 -2
  99. package/features/keyValueStore/KeyValueStoreRepository.js +2 -2
  100. package/features/keyValueStore/KeyValueStoreRepository.js.map +1 -1
  101. package/features/keyValueStore/abstractions.d.ts +10 -2
  102. package/features/keyValueStore/abstractions.js +4 -0
  103. package/features/keyValueStore/abstractions.js.map +1 -1
  104. package/features/keyValueStore/feature.d.ts +4 -1
  105. package/features/keyValueStore/feature.js.map +1 -1
  106. package/features/logger/abstractions.d.ts +1 -0
  107. package/features/logger/abstractions.js +1 -0
  108. package/features/logger/abstractions.js.map +1 -1
  109. package/features/logger/feature.d.ts +4 -1
  110. package/features/masker/Masker.d.ts +8 -0
  111. package/features/masker/Masker.js +21 -0
  112. package/features/masker/Masker.js.map +1 -0
  113. package/features/masker/abstractions.d.ts +11 -0
  114. package/features/masker/abstractions.js +4 -0
  115. package/features/masker/abstractions.js.map +1 -0
  116. package/features/masker/feature.d.ts +4 -0
  117. package/features/masker/feature.js +10 -0
  118. package/features/masker/feature.js.map +1 -0
  119. package/features/masker/index.d.ts +1 -0
  120. package/features/masker/index.js +3 -0
  121. package/features/masker/index.js.map +1 -0
  122. package/features/security/IdentityContext/IdentityContext.js +1 -1
  123. package/features/security/IdentityContext/IdentityContext.js.map +1 -1
  124. package/features/security/IdentityContext/abstractions.d.ts +1 -0
  125. package/features/security/IdentityContext/abstractions.js +1 -0
  126. package/features/security/IdentityContext/abstractions.js.map +1 -1
  127. package/features/security/IdentityContext/feature.d.ts +4 -1
  128. package/features/security/SecurityFeature.d.ts +5 -1
  129. package/features/security/apiKeys/CreateApiKey/CreateApiKeyUseCase.js +1 -1
  130. package/features/security/apiKeys/CreateApiKey/CreateApiKeyUseCase.js.map +1 -1
  131. package/features/security/apiKeys/CreateApiKey/abstractions.d.ts +1 -0
  132. package/features/security/apiKeys/CreateApiKey/abstractions.js +1 -0
  133. package/features/security/apiKeys/CreateApiKey/abstractions.js.map +1 -1
  134. package/features/security/apiKeys/CreateApiKey/events.d.ts +6 -4
  135. package/features/security/apiKeys/CreateApiKey/events.js +8 -4
  136. package/features/security/apiKeys/CreateApiKey/events.js.map +1 -1
  137. package/features/security/apiKeys/CreateApiKey/feature.d.ts +4 -1
  138. package/features/security/apiKeys/DeleteApiKey/abstractions.d.ts +1 -0
  139. package/features/security/apiKeys/DeleteApiKey/abstractions.js +1 -0
  140. package/features/security/apiKeys/DeleteApiKey/abstractions.js.map +1 -1
  141. package/features/security/apiKeys/DeleteApiKey/events.d.ts +6 -4
  142. package/features/security/apiKeys/DeleteApiKey/events.js +8 -4
  143. package/features/security/apiKeys/DeleteApiKey/events.js.map +1 -1
  144. package/features/security/apiKeys/DeleteApiKey/feature.d.ts +4 -1
  145. package/features/security/apiKeys/GetApiKey/abstractions.d.ts +1 -0
  146. package/features/security/apiKeys/GetApiKey/abstractions.js +1 -0
  147. package/features/security/apiKeys/GetApiKey/abstractions.js.map +1 -1
  148. package/features/security/apiKeys/GetApiKey/feature.d.ts +4 -1
  149. package/features/security/apiKeys/GetApiKeyBySlug/abstractions.d.ts +1 -0
  150. package/features/security/apiKeys/GetApiKeyBySlug/abstractions.js +1 -0
  151. package/features/security/apiKeys/GetApiKeyBySlug/abstractions.js.map +1 -1
  152. package/features/security/apiKeys/GetApiKeyBySlug/feature.d.ts +4 -1
  153. package/features/security/apiKeys/GetApiKeyByToken/abstractions.d.ts +1 -0
  154. package/features/security/apiKeys/GetApiKeyByToken/abstractions.js +1 -0
  155. package/features/security/apiKeys/GetApiKeyByToken/abstractions.js.map +1 -1
  156. package/features/security/apiKeys/GetApiKeyByToken/feature.d.ts +4 -1
  157. package/features/security/apiKeys/ListApiKeys/ListApiKeysUseCase.js +1 -1
  158. package/features/security/apiKeys/ListApiKeys/ListApiKeysUseCase.js.map +1 -1
  159. package/features/security/apiKeys/ListApiKeys/abstractions.d.ts +1 -0
  160. package/features/security/apiKeys/ListApiKeys/abstractions.js +1 -0
  161. package/features/security/apiKeys/ListApiKeys/abstractions.js.map +1 -1
  162. package/features/security/apiKeys/ListApiKeys/feature.d.ts +4 -1
  163. package/features/security/apiKeys/UpdateApiKey/UpdateApiKeyUseCase.js +1 -1
  164. package/features/security/apiKeys/UpdateApiKey/UpdateApiKeyUseCase.js.map +1 -1
  165. package/features/security/apiKeys/UpdateApiKey/abstractions.d.ts +1 -0
  166. package/features/security/apiKeys/UpdateApiKey/abstractions.js +1 -0
  167. package/features/security/apiKeys/UpdateApiKey/abstractions.js.map +1 -1
  168. package/features/security/apiKeys/UpdateApiKey/events.d.ts +6 -4
  169. package/features/security/apiKeys/UpdateApiKey/events.js +8 -4
  170. package/features/security/apiKeys/UpdateApiKey/events.js.map +1 -1
  171. package/features/security/apiKeys/UpdateApiKey/feature.d.ts +4 -1
  172. package/features/security/apiKeys/feature.d.ts +4 -1
  173. package/features/security/apiKeys/shared/abstractions.d.ts +5 -2
  174. package/features/security/apiKeys/shared/abstractions.js +3 -0
  175. package/features/security/apiKeys/shared/abstractions.js.map +1 -1
  176. package/features/security/apiKeys/shared/schemas.d.ts +10 -71
  177. package/features/security/apiKeys/shared/schemas.js +4 -4
  178. package/features/security/apiKeys/shared/schemas.js.map +1 -1
  179. package/features/security/authentication/AuthenticationContext/SetIdTokenCookie.d.ts +2 -2
  180. package/features/security/authentication/AuthenticationContext/SetIdTokenCookie.js +2 -2
  181. package/features/security/authentication/AuthenticationContext/SetIdTokenCookie.js.map +1 -1
  182. package/features/security/authentication/AuthenticationContext/abstractions.d.ts +1 -0
  183. package/features/security/authentication/AuthenticationContext/abstractions.js +1 -0
  184. package/features/security/authentication/AuthenticationContext/abstractions.js.map +1 -1
  185. package/features/security/authentication/AuthenticationContext/events.d.ts +6 -4
  186. package/features/security/authentication/AuthenticationContext/events.js +8 -4
  187. package/features/security/authentication/AuthenticationContext/events.js.map +1 -1
  188. package/features/security/authentication/AuthenticationContext/feature.d.ts +4 -1
  189. package/features/security/authentication/Authenticator/abstractions.d.ts +1 -0
  190. package/features/security/authentication/Authenticator/abstractions.js +1 -0
  191. package/features/security/authentication/Authenticator/abstractions.js.map +1 -1
  192. package/features/security/authorization/AuthorizationContext/AuthorizationContext.d.ts +1 -0
  193. package/features/security/authorization/AuthorizationContext/AuthorizationContext.js +14 -2
  194. package/features/security/authorization/AuthorizationContext/AuthorizationContext.js.map +1 -1
  195. package/features/security/authorization/AuthorizationContext/abstractions.d.ts +2 -0
  196. package/features/security/authorization/AuthorizationContext/abstractions.js +2 -0
  197. package/features/security/authorization/AuthorizationContext/abstractions.js.map +1 -1
  198. package/features/security/authorization/AuthorizationContext/feature.d.ts +4 -1
  199. package/features/security/authorization/Authorizer/abstractions.d.ts +1 -0
  200. package/features/security/authorization/Authorizer/abstractions.js +1 -0
  201. package/features/security/authorization/Authorizer/abstractions.js.map +1 -1
  202. package/features/security/authorization/GroupsTeamsAuthorizer/feature.d.ts +4 -1
  203. package/features/security/login/abstractions.d.ts +3 -2
  204. package/features/security/login/abstractions.js +4 -2
  205. package/features/security/login/abstractions.js.map +1 -1
  206. package/features/security/permissions/createPermissionSchema.d.ts +2 -0
  207. package/features/security/permissions/createPermissionSchema.js +8 -0
  208. package/features/security/permissions/createPermissionSchema.js.map +1 -0
  209. package/features/security/permissions/createPermissions.d.ts +8 -0
  210. package/features/security/permissions/createPermissions.js +250 -0
  211. package/features/security/permissions/createPermissions.js.map +1 -0
  212. package/features/security/permissions/index.d.ts +3 -0
  213. package/features/security/permissions/index.js +4 -0
  214. package/features/security/permissions/index.js.map +1 -0
  215. package/features/security/permissions/types.d.ts +137 -0
  216. package/features/security/permissions/types.js +3 -0
  217. package/features/security/permissions/types.js.map +1 -0
  218. package/features/security/roles/CreateRole/CreateRoleUseCase.d.ts +1 -3
  219. package/features/security/roles/CreateRole/CreateRoleUseCase.js +3 -7
  220. package/features/security/roles/CreateRole/CreateRoleUseCase.js.map +1 -1
  221. package/features/security/roles/CreateRole/abstractions.d.ts +1 -0
  222. package/features/security/roles/CreateRole/abstractions.js +1 -0
  223. package/features/security/roles/CreateRole/abstractions.js.map +1 -1
  224. package/features/security/roles/CreateRole/events.d.ts +6 -4
  225. package/features/security/roles/CreateRole/events.js +8 -4
  226. package/features/security/roles/CreateRole/events.js.map +1 -1
  227. package/features/security/roles/CreateRole/feature.d.ts +4 -1
  228. package/features/security/roles/CreateRole/schema.d.ts +2 -20
  229. package/features/security/roles/CreateRole/schema.js +2 -2
  230. package/features/security/roles/CreateRole/schema.js.map +1 -1
  231. package/features/security/roles/DeleteRole/abstractions.d.ts +1 -0
  232. package/features/security/roles/DeleteRole/abstractions.js +1 -0
  233. package/features/security/roles/DeleteRole/abstractions.js.map +1 -1
  234. package/features/security/roles/DeleteRole/events.d.ts +6 -4
  235. package/features/security/roles/DeleteRole/events.js +8 -4
  236. package/features/security/roles/DeleteRole/events.js.map +1 -1
  237. package/features/security/roles/DeleteRole/feature.d.ts +4 -1
  238. package/features/security/roles/GetRole/abstractions.d.ts +1 -0
  239. package/features/security/roles/GetRole/abstractions.js +1 -0
  240. package/features/security/roles/GetRole/abstractions.js.map +1 -1
  241. package/features/security/roles/GetRole/feature.d.ts +4 -1
  242. package/features/security/roles/ListRoles/abstractions.d.ts +1 -0
  243. package/features/security/roles/ListRoles/abstractions.js +1 -0
  244. package/features/security/roles/ListRoles/abstractions.js.map +1 -1
  245. package/features/security/roles/ListRoles/feature.d.ts +4 -1
  246. package/features/security/roles/UpdateRole/UpdateRoleUseCase.js +1 -1
  247. package/features/security/roles/UpdateRole/UpdateRoleUseCase.js.map +1 -1
  248. package/features/security/roles/UpdateRole/abstractions.d.ts +1 -0
  249. package/features/security/roles/UpdateRole/abstractions.js +1 -0
  250. package/features/security/roles/UpdateRole/abstractions.js.map +1 -1
  251. package/features/security/roles/UpdateRole/events.d.ts +6 -4
  252. package/features/security/roles/UpdateRole/events.js +8 -4
  253. package/features/security/roles/UpdateRole/events.js.map +1 -1
  254. package/features/security/roles/UpdateRole/feature.d.ts +4 -1
  255. package/features/security/roles/UpdateRole/schema.d.ts +2 -18
  256. package/features/security/roles/UpdateRole/schema.js +2 -2
  257. package/features/security/roles/UpdateRole/schema.js.map +1 -1
  258. package/features/security/roles/feature.d.ts +4 -1
  259. package/features/security/roles/feature.js +2 -0
  260. package/features/security/roles/feature.js.map +1 -1
  261. package/features/security/roles/shared/RoleProvider.d.ts +13 -0
  262. package/features/security/roles/shared/RoleProvider.js +29 -0
  263. package/features/security/roles/shared/RoleProvider.js.map +1 -0
  264. package/features/security/roles/shared/RolesRepository.d.ts +3 -1
  265. package/features/security/roles/shared/RolesRepository.js +19 -18
  266. package/features/security/roles/shared/RolesRepository.js.map +1 -1
  267. package/features/security/roles/shared/abstractions.d.ts +19 -0
  268. package/features/security/roles/shared/abstractions.js +3 -0
  269. package/features/security/roles/shared/abstractions.js.map +1 -1
  270. package/features/security/shared/abstractions.d.ts +5 -14
  271. package/features/security/shared/abstractions.js +3 -16
  272. package/features/security/shared/abstractions.js.map +1 -1
  273. package/features/security/teams/CreateTeam/CreateTeamUseCase.d.ts +1 -3
  274. package/features/security/teams/CreateTeam/CreateTeamUseCase.js +3 -7
  275. package/features/security/teams/CreateTeam/CreateTeamUseCase.js.map +1 -1
  276. package/features/security/teams/CreateTeam/abstractions.d.ts +1 -0
  277. package/features/security/teams/CreateTeam/abstractions.js +1 -0
  278. package/features/security/teams/CreateTeam/abstractions.js.map +1 -1
  279. package/features/security/teams/CreateTeam/events.d.ts +6 -4
  280. package/features/security/teams/CreateTeam/events.js +8 -4
  281. package/features/security/teams/CreateTeam/events.js.map +1 -1
  282. package/features/security/teams/CreateTeam/feature.d.ts +4 -1
  283. package/features/security/teams/CreateTeam/index.d.ts +1 -1
  284. package/features/security/teams/CreateTeam/index.js +1 -1
  285. package/features/security/teams/CreateTeam/index.js.map +1 -1
  286. package/features/security/teams/CreateTeam/schema.d.ts +2 -12
  287. package/features/security/teams/DeleteTeam/abstractions.d.ts +1 -0
  288. package/features/security/teams/DeleteTeam/abstractions.js +1 -0
  289. package/features/security/teams/DeleteTeam/abstractions.js.map +1 -1
  290. package/features/security/teams/DeleteTeam/events.d.ts +6 -4
  291. package/features/security/teams/DeleteTeam/events.js +8 -4
  292. package/features/security/teams/DeleteTeam/events.js.map +1 -1
  293. package/features/security/teams/DeleteTeam/feature.d.ts +4 -1
  294. package/features/security/teams/GetTeam/abstractions.d.ts +1 -0
  295. package/features/security/teams/GetTeam/abstractions.js +1 -0
  296. package/features/security/teams/GetTeam/abstractions.js.map +1 -1
  297. package/features/security/teams/GetTeam/feature.d.ts +4 -1
  298. package/features/security/teams/ListTeams/abstractions.d.ts +1 -0
  299. package/features/security/teams/ListTeams/abstractions.js +1 -0
  300. package/features/security/teams/ListTeams/abstractions.js.map +1 -1
  301. package/features/security/teams/ListTeams/feature.d.ts +4 -1
  302. package/features/security/teams/UpdateTeam/UpdateTeamUseCase.js +1 -1
  303. package/features/security/teams/UpdateTeam/UpdateTeamUseCase.js.map +1 -1
  304. package/features/security/teams/UpdateTeam/abstractions.d.ts +1 -0
  305. package/features/security/teams/UpdateTeam/abstractions.js +1 -0
  306. package/features/security/teams/UpdateTeam/abstractions.js.map +1 -1
  307. package/features/security/teams/UpdateTeam/events.d.ts +6 -4
  308. package/features/security/teams/UpdateTeam/events.js +8 -4
  309. package/features/security/teams/UpdateTeam/events.js.map +1 -1
  310. package/features/security/teams/UpdateTeam/feature.d.ts +4 -1
  311. package/features/security/teams/UpdateTeam/schema.d.ts +2 -10
  312. package/features/security/teams/feature.d.ts +4 -1
  313. package/features/security/teams/feature.js +6 -0
  314. package/features/security/teams/feature.js.map +1 -1
  315. package/features/security/teams/shared/TeamProvider.d.ts +13 -0
  316. package/features/security/teams/shared/TeamProvider.js +29 -0
  317. package/features/security/teams/shared/TeamProvider.js.map +1 -0
  318. package/features/security/teams/shared/TeamsRepository.js +20 -18
  319. package/features/security/teams/shared/TeamsRepository.js.map +1 -1
  320. package/features/security/teams/shared/abstractions.d.ts +18 -0
  321. package/features/security/teams/shared/abstractions.js +3 -0
  322. package/features/security/teams/shared/abstractions.js.map +1 -1
  323. package/features/security/teams/shared/decorators/TeamsRepositoryCachingDecorator.d.ts +17 -0
  324. package/features/security/teams/shared/decorators/TeamsRepositoryCachingDecorator.js +76 -0
  325. package/features/security/teams/shared/decorators/TeamsRepositoryCachingDecorator.js.map +1 -0
  326. package/features/security/utils/verifyJwtUsingJwk.d.ts +2 -4
  327. package/features/security/utils/verifyJwtUsingJwk.js +1 -1
  328. package/features/security/utils/verifyJwtUsingJwk.js.map +1 -1
  329. package/features/system/InstallSystem/abstractions.d.ts +4 -5
  330. package/features/system/InstallSystem/abstractions.js +3 -4
  331. package/features/system/InstallSystem/abstractions.js.map +1 -1
  332. package/features/system/InstallSystem/events.js +2 -2
  333. package/features/system/InstallSystem/events.js.map +1 -1
  334. package/features/system/InstallSystem/feature.d.ts +5 -1
  335. package/features/system/InstallSystem/index.d.ts +1 -1
  336. package/features/system/InstallSystem/index.js +1 -1
  337. package/features/system/InstallSystem/index.js.map +1 -1
  338. package/features/system/SystemFeature.d.ts +4 -1
  339. package/features/task/TaskController/abstractions.d.ts +1 -0
  340. package/features/task/TaskController/abstractions.js +1 -0
  341. package/features/task/TaskController/abstractions.js.map +1 -1
  342. package/features/task/TaskDefinition/abstractions.d.ts +7 -1
  343. package/features/task/TaskDefinition/abstractions.js +1 -0
  344. package/features/task/TaskDefinition/abstractions.js.map +1 -1
  345. package/features/task/TaskService/abstractions.d.ts +1 -0
  346. package/features/task/TaskService/abstractions.js +1 -0
  347. package/features/task/TaskService/abstractions.js.map +1 -1
  348. package/features/tenancy/CreateTenant/abstractions.d.ts +9 -7
  349. package/features/tenancy/CreateTenant/abstractions.js +7 -5
  350. package/features/tenancy/CreateTenant/abstractions.js.map +1 -1
  351. package/features/tenancy/CreateTenant/events.js +3 -3
  352. package/features/tenancy/CreateTenant/events.js.map +1 -1
  353. package/features/tenancy/CreateTenant/feature.d.ts +5 -1
  354. package/features/tenancy/CreateTenant/index.d.ts +1 -1
  355. package/features/tenancy/CreateTenant/index.js +1 -1
  356. package/features/tenancy/CreateTenant/index.js.map +1 -1
  357. package/features/tenancy/DeleteTenant/abstractions.d.ts +9 -4
  358. package/features/tenancy/DeleteTenant/abstractions.js +7 -2
  359. package/features/tenancy/DeleteTenant/abstractions.js.map +1 -1
  360. package/features/tenancy/DeleteTenant/events.js +3 -3
  361. package/features/tenancy/DeleteTenant/events.js.map +1 -1
  362. package/features/tenancy/DeleteTenant/feature.d.ts +5 -1
  363. package/features/tenancy/DeleteTenant/index.d.ts +1 -1
  364. package/features/tenancy/DeleteTenant/index.js +1 -1
  365. package/features/tenancy/DeleteTenant/index.js.map +1 -1
  366. package/features/tenancy/GetRootTenant/feature.d.ts +5 -1
  367. package/features/tenancy/GetTenantById/abstractions.d.ts +3 -0
  368. package/features/tenancy/GetTenantById/abstractions.js +3 -9
  369. package/features/tenancy/GetTenantById/abstractions.js.map +1 -1
  370. package/features/tenancy/GetTenantById/feature.d.ts +5 -1
  371. package/features/tenancy/InstallTenant/abstractions.d.ts +5 -11
  372. package/features/tenancy/InstallTenant/abstractions.js +4 -13
  373. package/features/tenancy/InstallTenant/abstractions.js.map +1 -1
  374. package/features/tenancy/InstallTenant/events.js +2 -2
  375. package/features/tenancy/InstallTenant/events.js.map +1 -1
  376. package/features/tenancy/InstallTenant/feature.d.ts +5 -1
  377. package/features/tenancy/InstallTenant/index.d.ts +1 -1
  378. package/features/tenancy/InstallTenant/index.js +1 -1
  379. package/features/tenancy/InstallTenant/index.js.map +1 -1
  380. package/features/tenancy/ListTenants/feature.d.ts +5 -1
  381. package/features/tenancy/TenancyFeature.d.ts +4 -1
  382. package/features/tenancy/TenancyFeature.js.map +1 -1
  383. package/features/tenancy/TenantContext/abstractions.d.ts +1 -0
  384. package/features/tenancy/TenantContext/abstractions.js +1 -0
  385. package/features/tenancy/TenantContext/abstractions.js.map +1 -1
  386. package/features/tenancy/TenantContext/feature.d.ts +4 -1
  387. package/features/tenancy/UpdateTenant/abstractions.d.ts +9 -4
  388. package/features/tenancy/UpdateTenant/abstractions.js +7 -2
  389. package/features/tenancy/UpdateTenant/abstractions.js.map +1 -1
  390. package/features/tenancy/UpdateTenant/events.js +3 -3
  391. package/features/tenancy/UpdateTenant/events.js.map +1 -1
  392. package/features/tenancy/UpdateTenant/feature.d.ts +5 -1
  393. package/features/tenancy/UpdateTenant/index.d.ts +1 -1
  394. package/features/tenancy/UpdateTenant/index.js +1 -1
  395. package/features/tenancy/UpdateTenant/index.js.map +1 -1
  396. package/features/users/AdminUsersFeature.d.ts +4 -1
  397. package/features/users/AdminUsersFeature.js.map +1 -1
  398. package/features/users/CreateUser/CreateUserUseCase.js +1 -1
  399. package/features/users/CreateUser/CreateUserUseCase.js.map +1 -1
  400. package/features/users/CreateUser/abstractions.d.ts +1 -0
  401. package/features/users/CreateUser/abstractions.js +1 -1
  402. package/features/users/CreateUser/abstractions.js.map +1 -1
  403. package/features/users/CreateUser/events.d.ts +6 -4
  404. package/features/users/CreateUser/events.js +8 -4
  405. package/features/users/CreateUser/events.js.map +1 -1
  406. package/features/users/CreateUser/feature.d.ts +4 -1
  407. package/features/users/CreateUser/schema.d.ts +4 -36
  408. package/features/users/DeleteUser/abstractions.d.ts +1 -0
  409. package/features/users/DeleteUser/abstractions.js +1 -1
  410. package/features/users/DeleteUser/abstractions.js.map +1 -1
  411. package/features/users/DeleteUser/events.d.ts +6 -4
  412. package/features/users/DeleteUser/events.js +8 -4
  413. package/features/users/DeleteUser/events.js.map +1 -1
  414. package/features/users/DeleteUser/feature.d.ts +4 -1
  415. package/features/users/ExternalIdpUserSync/ExternalIdpUserSyncHandler.d.ts +3 -3
  416. package/features/users/ExternalIdpUserSync/ExternalIdpUserSyncHandler.js +2 -2
  417. package/features/users/ExternalIdpUserSync/ExternalIdpUserSyncHandler.js.map +1 -1
  418. package/features/users/ExternalIdpUserSync/feature.d.ts +4 -1
  419. package/features/users/GetIdentityProfile/feature.d.ts +4 -1
  420. package/features/users/GetUser/abstractions.d.ts +1 -0
  421. package/features/users/GetUser/abstractions.js +1 -1
  422. package/features/users/GetUser/abstractions.js.map +1 -1
  423. package/features/users/GetUser/feature.d.ts +4 -1
  424. package/features/users/ListUserTeams/abstractions.d.ts +1 -0
  425. package/features/users/ListUserTeams/abstractions.js +1 -1
  426. package/features/users/ListUserTeams/abstractions.js.map +1 -1
  427. package/features/users/ListUserTeams/feature.d.ts +4 -1
  428. package/features/users/ListUsers/abstractions.d.ts +1 -0
  429. package/features/users/ListUsers/abstractions.js +1 -1
  430. package/features/users/ListUsers/abstractions.js.map +1 -1
  431. package/features/users/ListUsers/feature.d.ts +4 -1
  432. package/features/users/UpdateUser/UpdateUserUseCase.js +1 -1
  433. package/features/users/UpdateUser/UpdateUserUseCase.js.map +1 -1
  434. package/features/users/UpdateUser/abstractions.d.ts +1 -0
  435. package/features/users/UpdateUser/abstractions.js +1 -1
  436. package/features/users/UpdateUser/abstractions.js.map +1 -1
  437. package/features/users/UpdateUser/events.d.ts +6 -4
  438. package/features/users/UpdateUser/events.js +8 -4
  439. package/features/users/UpdateUser/events.js.map +1 -1
  440. package/features/users/UpdateUser/feature.d.ts +4 -1
  441. package/features/users/UpdateUser/schema.d.ts +4 -30
  442. package/features/users/shared/abstractions.d.ts +1 -0
  443. package/features/users/shared/abstractions.js +1 -1
  444. package/features/users/shared/abstractions.js.map +1 -1
  445. package/features/wcp/WcpContext/WcpContext.d.ts +5 -0
  446. package/features/wcp/WcpContext/WcpContext.js +15 -0
  447. package/features/wcp/WcpContext/WcpContext.js.map +1 -1
  448. package/features/wcp/WcpContext/abstractions.d.ts +1 -0
  449. package/features/wcp/WcpContext/abstractions.js.map +1 -1
  450. package/features/wcp/WcpContext/decorators/WcpContextWithFeatureFlagsDecorator.d.ts +94 -0
  451. package/features/wcp/WcpContext/decorators/WcpContextWithFeatureFlagsDecorator.js +142 -0
  452. package/features/wcp/WcpContext/decorators/WcpContextWithFeatureFlagsDecorator.js.map +1 -0
  453. package/features/wcp/WcpContext/feature.d.ts +5 -1
  454. package/features/wcp/WcpFeature.d.ts +4 -1
  455. package/features/wcp/WcpFeature.js +2 -0
  456. package/features/wcp/WcpFeature.js.map +1 -1
  457. package/graphql/security/NotAuthorizedResponse.d.ts +1 -0
  458. package/graphql/security/NotAuthorizedResponse.js +1 -0
  459. package/graphql/security/NotAuthorizedResponse.js.map +1 -1
  460. package/graphql/wcp/graphql.js +2 -1
  461. package/graphql/wcp/graphql.js.map +1 -1
  462. package/idp/abstractions.d.ts +4 -0
  463. package/idp/abstractions.js +4 -0
  464. package/idp/abstractions.js.map +1 -1
  465. package/idp/feature.d.ts +4 -1
  466. package/legacy/security/createSecurityContext.js +0 -11
  467. package/legacy/security/createSecurityContext.js.map +1 -1
  468. package/legacy/security/plugins/authenticateUsingHttpHeader.d.ts +1 -1
  469. package/legacy/wcp/LegacyWcpContext.d.ts +5 -0
  470. package/legacy/wcp/LegacyWcpContext.js +15 -0
  471. package/legacy/wcp/LegacyWcpContext.js.map +1 -1
  472. package/legacy/wcp/context.d.ts +1 -3
  473. package/legacy/wcp/context.js +4 -2
  474. package/legacy/wcp/context.js.map +1 -1
  475. package/models/base/BaseModel.js +2 -2
  476. package/models/base/BaseModel.js.map +1 -1
  477. package/models/base/ModelBuilder.d.ts +2 -2
  478. package/models/base/ModelBuilder.js +21 -2
  479. package/models/base/ModelBuilder.js.map +1 -1
  480. package/models/cms/FieldBuilder.d.ts +4 -3
  481. package/models/cms/FieldBuilder.js +17 -22
  482. package/models/cms/FieldBuilder.js.map +1 -1
  483. package/models/cms/FieldBuilderRegistry.d.ts +1 -1
  484. package/models/cms/FieldBuilderRegistry.js.map +1 -1
  485. package/models/cms/FieldDefinitionsBuilder.d.ts +1 -0
  486. package/models/cms/FieldDefinitionsBuilder.js +15 -17
  487. package/models/cms/FieldDefinitionsBuilder.js.map +1 -1
  488. package/models/cms/PrivateCmsModelBuilder.js +1 -1
  489. package/models/cms/PrivateCmsModelBuilder.js.map +1 -1
  490. package/models/cms/abstractions.d.ts +1 -1
  491. package/models/cms/abstractions.js.map +1 -1
  492. package/models/cms/fieldsBuilder.md +6 -4
  493. package/models/cms/types.d.ts +2 -2
  494. package/models/cms/types.js.map +1 -1
  495. package/models/simple/Page/abstractions.d.ts +1 -11
  496. package/package.json +28 -70
  497. package/types/security.d.ts +13 -10
  498. package/types/security.js.map +1 -1
  499. package/exports/api/buildParams.js +0 -3
  500. package/exports/api/buildParams.js.map +0 -1
  501. package/exports/api/eventPublisher.d.ts +0 -1
  502. package/exports/api/eventPublisher.js.map +0 -1
  503. package/exports/api/keyValueStore.js +0 -3
  504. package/exports/api/keyValueStore.js.map +0 -1
  505. package/exports/api/security/apiKey.d.ts +0 -7
  506. package/exports/api/security/apiKey.js +0 -9
  507. package/exports/api/security/apiKey.js.map +0 -1
  508. package/extensions/BuildParam.d.ts +0 -11
  509. package/extensions/BuildParam.js +0 -119
  510. package/extensions/BuildParam.js.map +0 -1
  511. package/extensions/GenericExtension.d.ts +0 -10
  512. package/extensions/GenericExtension.js +0 -7
  513. package/extensions/GenericExtension.js.map +0 -1
  514. package/extensions/eventHandlers/AfterAuthentication.d.ts +0 -10
  515. package/extensions/eventHandlers/AfterAuthentication.js +0 -9
  516. package/extensions/eventHandlers/AfterAuthentication.js.map +0 -1
  517. package/extensions/eventHandlers/ApiKeyAfterCreate.d.ts +0 -10
  518. package/extensions/eventHandlers/ApiKeyAfterCreate.js +0 -9
  519. package/extensions/eventHandlers/ApiKeyAfterCreate.js.map +0 -1
  520. package/extensions/eventHandlers/ApiKeyAfterDelete.d.ts +0 -10
  521. package/extensions/eventHandlers/ApiKeyAfterDelete.js +0 -9
  522. package/extensions/eventHandlers/ApiKeyAfterDelete.js.map +0 -1
  523. package/extensions/eventHandlers/ApiKeyAfterUpdate.d.ts +0 -10
  524. package/extensions/eventHandlers/ApiKeyAfterUpdate.js +0 -9
  525. package/extensions/eventHandlers/ApiKeyAfterUpdate.js.map +0 -1
  526. package/extensions/eventHandlers/ApiKeyBeforeCreate.d.ts +0 -10
  527. package/extensions/eventHandlers/ApiKeyBeforeCreate.js +0 -9
  528. package/extensions/eventHandlers/ApiKeyBeforeCreate.js.map +0 -1
  529. package/extensions/eventHandlers/ApiKeyBeforeDelete.d.ts +0 -10
  530. package/extensions/eventHandlers/ApiKeyBeforeDelete.js +0 -9
  531. package/extensions/eventHandlers/ApiKeyBeforeDelete.js.map +0 -1
  532. package/extensions/eventHandlers/ApiKeyBeforeUpdate.d.ts +0 -10
  533. package/extensions/eventHandlers/ApiKeyBeforeUpdate.js +0 -9
  534. package/extensions/eventHandlers/ApiKeyBeforeUpdate.js.map +0 -1
  535. package/extensions/eventHandlers/BeforeAuthentication.d.ts +0 -10
  536. package/extensions/eventHandlers/BeforeAuthentication.js +0 -9
  537. package/extensions/eventHandlers/BeforeAuthentication.js.map +0 -1
  538. package/extensions/eventHandlers/RoleAfterCreate.d.ts +0 -10
  539. package/extensions/eventHandlers/RoleAfterCreate.js +0 -9
  540. package/extensions/eventHandlers/RoleAfterCreate.js.map +0 -1
  541. package/extensions/eventHandlers/RoleAfterDelete.d.ts +0 -10
  542. package/extensions/eventHandlers/RoleAfterDelete.js +0 -9
  543. package/extensions/eventHandlers/RoleAfterDelete.js.map +0 -1
  544. package/extensions/eventHandlers/RoleAfterUpdate.d.ts +0 -10
  545. package/extensions/eventHandlers/RoleAfterUpdate.js +0 -9
  546. package/extensions/eventHandlers/RoleAfterUpdate.js.map +0 -1
  547. package/extensions/eventHandlers/RoleBeforeCreate.d.ts +0 -10
  548. package/extensions/eventHandlers/RoleBeforeCreate.js +0 -9
  549. package/extensions/eventHandlers/RoleBeforeCreate.js.map +0 -1
  550. package/extensions/eventHandlers/RoleBeforeDelete.d.ts +0 -10
  551. package/extensions/eventHandlers/RoleBeforeDelete.js +0 -9
  552. package/extensions/eventHandlers/RoleBeforeDelete.js.map +0 -1
  553. package/extensions/eventHandlers/RoleBeforeUpdate.d.ts +0 -10
  554. package/extensions/eventHandlers/RoleBeforeUpdate.js +0 -9
  555. package/extensions/eventHandlers/RoleBeforeUpdate.js.map +0 -1
  556. package/extensions/eventHandlers/SystemInstalled.d.ts +0 -10
  557. package/extensions/eventHandlers/SystemInstalled.js +0 -9
  558. package/extensions/eventHandlers/SystemInstalled.js.map +0 -1
  559. package/extensions/eventHandlers/TeamAfterCreate.d.ts +0 -10
  560. package/extensions/eventHandlers/TeamAfterCreate.js +0 -9
  561. package/extensions/eventHandlers/TeamAfterCreate.js.map +0 -1
  562. package/extensions/eventHandlers/TeamAfterDelete.d.ts +0 -10
  563. package/extensions/eventHandlers/TeamAfterDelete.js +0 -9
  564. package/extensions/eventHandlers/TeamAfterDelete.js.map +0 -1
  565. package/extensions/eventHandlers/TeamAfterUpdate.d.ts +0 -10
  566. package/extensions/eventHandlers/TeamAfterUpdate.js +0 -9
  567. package/extensions/eventHandlers/TeamAfterUpdate.js.map +0 -1
  568. package/extensions/eventHandlers/TeamBeforeCreate.d.ts +0 -10
  569. package/extensions/eventHandlers/TeamBeforeCreate.js +0 -9
  570. package/extensions/eventHandlers/TeamBeforeCreate.js.map +0 -1
  571. package/extensions/eventHandlers/TeamBeforeDelete.d.ts +0 -10
  572. package/extensions/eventHandlers/TeamBeforeDelete.js +0 -9
  573. package/extensions/eventHandlers/TeamBeforeDelete.js.map +0 -1
  574. package/extensions/eventHandlers/TeamBeforeUpdate.d.ts +0 -10
  575. package/extensions/eventHandlers/TeamBeforeUpdate.js +0 -9
  576. package/extensions/eventHandlers/TeamBeforeUpdate.js.map +0 -1
  577. package/extensions/eventHandlers/TenantAfterCreate.d.ts +0 -10
  578. package/extensions/eventHandlers/TenantAfterCreate.js +0 -9
  579. package/extensions/eventHandlers/TenantAfterCreate.js.map +0 -1
  580. package/extensions/eventHandlers/TenantAfterDelete.d.ts +0 -10
  581. package/extensions/eventHandlers/TenantAfterDelete.js +0 -9
  582. package/extensions/eventHandlers/TenantAfterDelete.js.map +0 -1
  583. package/extensions/eventHandlers/TenantAfterUpdate.d.ts +0 -10
  584. package/extensions/eventHandlers/TenantAfterUpdate.js +0 -9
  585. package/extensions/eventHandlers/TenantAfterUpdate.js.map +0 -1
  586. package/extensions/eventHandlers/TenantBeforeCreate.d.ts +0 -10
  587. package/extensions/eventHandlers/TenantBeforeCreate.js +0 -9
  588. package/extensions/eventHandlers/TenantBeforeCreate.js.map +0 -1
  589. package/extensions/eventHandlers/TenantBeforeDelete.d.ts +0 -10
  590. package/extensions/eventHandlers/TenantBeforeDelete.js +0 -9
  591. package/extensions/eventHandlers/TenantBeforeDelete.js.map +0 -1
  592. package/extensions/eventHandlers/TenantBeforeUpdate.d.ts +0 -10
  593. package/extensions/eventHandlers/TenantBeforeUpdate.js +0 -9
  594. package/extensions/eventHandlers/TenantBeforeUpdate.js.map +0 -1
  595. package/extensions/eventHandlers/TenantInstalled.d.ts +0 -10
  596. package/extensions/eventHandlers/TenantInstalled.js +0 -9
  597. package/extensions/eventHandlers/TenantInstalled.js.map +0 -1
  598. package/extensions/eventHandlers/UserAfterCreate.d.ts +0 -10
  599. package/extensions/eventHandlers/UserAfterCreate.js +0 -9
  600. package/extensions/eventHandlers/UserAfterCreate.js.map +0 -1
  601. package/extensions/eventHandlers/UserAfterDelete.d.ts +0 -10
  602. package/extensions/eventHandlers/UserAfterDelete.js +0 -9
  603. package/extensions/eventHandlers/UserAfterDelete.js.map +0 -1
  604. package/extensions/eventHandlers/UserAfterUpdate.d.ts +0 -10
  605. package/extensions/eventHandlers/UserAfterUpdate.js +0 -9
  606. package/extensions/eventHandlers/UserAfterUpdate.js.map +0 -1
  607. package/extensions/eventHandlers/UserBeforeCreate.d.ts +0 -10
  608. package/extensions/eventHandlers/UserBeforeCreate.js +0 -9
  609. package/extensions/eventHandlers/UserBeforeCreate.js.map +0 -1
  610. package/extensions/eventHandlers/UserBeforeDelete.d.ts +0 -10
  611. package/extensions/eventHandlers/UserBeforeDelete.js +0 -9
  612. package/extensions/eventHandlers/UserBeforeDelete.js.map +0 -1
  613. package/extensions/eventHandlers/UserBeforeUpdate.d.ts +0 -10
  614. package/extensions/eventHandlers/UserBeforeUpdate.js +0 -9
  615. package/extensions/eventHandlers/UserBeforeUpdate.js.map +0 -1
  616. package/extensions/eventHandlers/index.d.ts +0 -34
  617. package/extensions/eventHandlers/index.js +0 -49
  618. package/extensions/eventHandlers/index.js.map +0 -1
  619. package/extensions/index.d.ts +0 -58
  620. package/extensions/index.js +0 -49
  621. package/extensions/index.js.map +0 -1
  622. package/features/security/shared/abstractions.ts.bak +0 -52
  623. package/legacy/security/plugins/SecurityRolePlugin.d.ts +0 -16
  624. package/legacy/security/plugins/SecurityRolePlugin.js +0 -33
  625. package/legacy/security/plugins/SecurityRolePlugin.js.map +0 -1
  626. package/legacy/security/plugins/SecurityTeamPlugin.d.ts +0 -16
  627. package/legacy/security/plugins/SecurityTeamPlugin.js +0 -33
  628. package/legacy/security/plugins/SecurityTeamPlugin.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"names":["z","FieldDefinitionsBuilder","createImplementation","FieldBuilderRegistry","PrivateCmsModelBuilder","BuilderAbstraction","ModelBuilder","PrivateCmsModelBuilderImpl","constructor","fieldBuilderRegistry","create","modelId","fieldDefinitions","builder","fieldShape","factory","fieldDefinitionsBuilder","__fromObject","PrivateCmsModelConfiguration","metadata","modelMethods","extensionFields","Map","withMethods","methods","Object","assign","extendFields","fieldId","fieldBuilder","entries","config","toConfig","zodSchema","getZodSchema","set","build","baseSchema","__toZodSchema","finalSchema","size","extensionsShape","optional","extensionsSchema","object","extend","extensions","modelBuilder","keys","length","ModelClass","allFields","__getFields","type","label","validation","settings","fromEntries","Array","from","map","id","fields","values","f","modelType","Model","name","icon","description","schema","getSchema","data","abstraction","implementation","dependencies"],"sources":["PrivateCmsModelBuilder.ts"],"sourcesContent":["import { z } from \"zod\";\nimport {\n FieldDefinitionsBuilder,\n type FieldDefinitionsFactory\n} from \"./FieldDefinitionsBuilder.js\";\nimport type { BaseModel } from \"../base/BaseModel.js\";\nimport type { IModelData } from \"../base/abstractions.js\";\nimport type { PrivateCmsModel, CmsModelMetadata, FieldBuilderConfig } from \"./types.js\";\n// Import your existing ModelBuilder\nimport { FieldBuilder } from \"./FieldBuilder.js\";\nimport { createImplementation } from \"@webiny/di\";\nimport {\n FieldBuilderRegistry,\n type IFieldBuilderRegistry,\n PrivateCmsModelBuilder as BuilderAbstraction\n} from \"~/models/cms/abstractions.js\";\nimport { ModelBuilder } from \"~/models/base/ModelBuilder.js\";\n\nexport interface IPrivateCmsModelBuilder {\n create<TModel extends BaseModel<any>, TFields extends z.ZodRawShape = any>(\n modelId: string,\n fieldDefinitions: FieldDefinitionsFactory<TFields>\n ): IPrivateCmsModelConfiguration<TModel>;\n}\n\nexport interface IPrivateCmsModelConfiguration<TModel extends BaseModel<any>> {\n withMethods<TMethods extends object>(\n methods: TMethods & ThisType<TModel & TMethods>\n ): IPrivateCmsModelConfiguration<TModel>;\n extendFields(\n factory: (fields: IFieldBuilderRegistry) => Record<string, FieldBuilder<any>>\n ): IPrivateCmsModelConfiguration<TModel>;\n build(): PrivateCmsModel<TModel>;\n}\n\nclass PrivateCmsModelBuilderImpl implements IPrivateCmsModelBuilder {\n constructor(private fieldBuilderRegistry: IFieldBuilderRegistry) {}\n\n create<TModel extends BaseModel<any>, TFields extends z.ZodRawShape = any>(\n modelId: string,\n fieldDefinitions: FieldDefinitionsFactory<TFields>\n ): IPrivateCmsModelConfiguration<TModel> {\n const builder = new FieldDefinitionsBuilder(this.fieldBuilderRegistry);\n const fieldShape = fieldDefinitions.factory(this.fieldBuilderRegistry);\n const fieldDefinitionsBuilder = builder.__fromObject(fieldShape);\n\n return new PrivateCmsModelConfiguration<TModel>(\n modelId,\n this.fieldBuilderRegistry,\n fieldDefinitionsBuilder\n );\n }\n}\n\nclass PrivateCmsModelConfiguration<TModel extends BaseModel<any>>\n implements IPrivateCmsModelConfiguration<TModel>\n{\n private metadata: CmsModelMetadata = {};\n // eslint-disable-next-line\n private modelMethods: Record<string, Function> = {};\n private extensionFields = new Map<string, FieldBuilderConfig>();\n\n constructor(\n private modelId: string,\n private fieldBuilderRegistry: IFieldBuilderRegistry,\n private fieldDefinitionsBuilder: FieldDefinitionsBuilder\n ) {}\n\n withMethods<TMethods extends object>(\n methods: TMethods & ThisType<TModel & TMethods>\n ): IPrivateCmsModelConfiguration<TModel> {\n Object.assign(this.modelMethods, methods);\n return this as any;\n }\n\n extendFields(\n factory: (fields: IFieldBuilderRegistry) => Record<string, FieldBuilder<any>>\n ): IPrivateCmsModelConfiguration<TModel> {\n // Use the factory to get field shape - same as createFieldDefinitions!\n const fieldShape = factory(this.fieldBuilderRegistry);\n\n // Convert to field configs\n for (const [fieldId, fieldBuilder] of Object.entries(fieldShape)) {\n const config = fieldBuilder.toConfig();\n config.fieldId = fieldId;\n const zodSchema = fieldBuilder.getZodSchema();\n\n this.extensionFields.set(fieldId, {\n fieldId,\n config,\n zodSchema\n });\n }\n\n return this as any;\n }\n\n build(): PrivateCmsModel<TModel> {\n const baseSchema = this.fieldDefinitionsBuilder.__toZodSchema();\n let finalSchema = baseSchema;\n\n if (this.extensionFields.size > 0) {\n const extensionsShape: z.ZodRawShape = {};\n\n for (const [fieldId, { zodSchema }] of this.extensionFields) {\n // Make each extension field optional\n extensionsShape[fieldId] = zodSchema.optional();\n }\n\n const extensionsSchema = z.object(extensionsShape).optional();\n\n finalSchema = baseSchema.extend({\n extensions: extensionsSchema\n }) as any;\n }\n\n let modelBuilder = new ModelBuilder<any>(this.modelId, finalSchema);\n\n if (Object.keys(this.modelMethods).length > 0) {\n modelBuilder = modelBuilder.withMethods(this.modelMethods);\n }\n\n const ModelClass = modelBuilder.build();\n\n const allFields = [\n ...this.fieldDefinitionsBuilder.__getFields(),\n ...(this.extensionFields.size > 0\n ? [\n {\n fieldId: \"extensions\",\n type: \"object\",\n label: \"Extensions\",\n validation: [],\n settings: {},\n zodSchema: z\n .object(\n Object.fromEntries(\n Array.from(this.extensionFields.entries()).map(\n ([id, { zodSchema }]) => [id, zodSchema.optional()]\n )\n )\n )\n .optional(),\n fields: Array.from(this.extensionFields.values()).map(f => f.config)\n }\n ]\n : [])\n ];\n\n return {\n type: \"private\" as const,\n modelType: \"private\" as const,\n Model: ModelClass as any,\n modelId: this.modelId,\n name: this.modelId,\n icon: this.metadata.icon,\n description: this.metadata.description,\n fields: allFields,\n schema: modelBuilder.getSchema() as TModel[\"__schema\"],\n create: (data: IModelData<TModel>) => ModelClass.create(data) as TModel\n };\n }\n}\n\nexport const PrivateCmsModelBuilder = createImplementation({\n abstraction: BuilderAbstraction,\n implementation: PrivateCmsModelBuilderImpl,\n dependencies: [FieldBuilderRegistry]\n});\n"],"mappings":"AAAA,SAASA,CAAC,QAAQ,KAAK;AACvB,SACIC,uBAAuB;;AAM3B;;AAEA,SAASC,oBAAoB,QAAQ,YAAY;AACjD,SACIC,oBAAoB,EAEpBC,sBAAsB,IAAIC,kBAAkB;AAEhD,SAASC,YAAY;AAmBrB,MAAMC,0BAA0B,CAAoC;EAChEC,WAAWA,CAASC,oBAA2C,EAAE;IAAA,KAA7CA,oBAA2C,GAA3CA,oBAA2C;EAAG;EAEl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initionsBuilder","createImplementation","FieldBuilderRegistry","PrivateCmsModelBuilder","BuilderAbstraction","ModelBuilder","PrivateCmsModelBuilderImpl","constructor","fieldBuilderRegistry","create","modelId","fieldDefinitions","builder","fieldShape","factory","fieldDefinitionsBuilder","__fromObject","PrivateCmsModelConfiguration","metadata","modelMethods","extensionFields","Map","withMethods","methods","Object","assign","extendFields","fieldId","fieldBuilder","entries","config","toConfig","zodSchema","getZodSchema","set","build","baseSchema","__toZodSchema","finalSchema","size","extensionsShape","optional","extensionsSchema","object","extend","extensions","modelBuilder","keys","length","ModelClass","allFields","__getFields","type","label","validation","settings","fromEntries","Array","from","map","id","fields","values","f","modelType","Model","name","icon","description","schema","getSchema","data","abstraction","implementation","dependencies"],"sources":["PrivateCmsModelBuilder.ts"],"sourcesContent":["import { z } from \"zod\";\nimport {\n FieldDefinitionsBuilder,\n type FieldDefinitionsFactory\n} from \"./FieldDefinitionsBuilder.js\";\nimport type { BaseModel } from \"../base/BaseModel.js\";\nimport type { IModelData } from \"../base/abstractions.js\";\nimport type { PrivateCmsModel, CmsModelMetadata, FieldBuilderConfig } from \"./types.js\";\n// Import your existing ModelBuilder\nimport { FieldBuilder } from \"./FieldBuilder.js\";\nimport { createImplementation } from \"@webiny/di\";\nimport {\n FieldBuilderRegistry,\n type IFieldBuilderRegistry,\n PrivateCmsModelBuilder as BuilderAbstraction\n} from \"~/models/cms/abstractions.js\";\nimport { ModelBuilder } from \"~/models/base/ModelBuilder.js\";\n\nexport interface IPrivateCmsModelBuilder {\n create<TModel extends BaseModel<any>, TFields extends z.ZodRawShape = any>(\n modelId: string,\n fieldDefinitions: FieldDefinitionsFactory<TFields>\n ): IPrivateCmsModelConfiguration<TModel>;\n}\n\nexport interface IPrivateCmsModelConfiguration<TModel extends BaseModel<any>> {\n withMethods<TMethods extends object>(\n methods: TMethods & ThisType<TModel & TMethods>\n ): IPrivateCmsModelConfiguration<TModel>;\n extendFields(\n factory: (fields: IFieldBuilderRegistry) => Record<string, FieldBuilder<any>>\n ): IPrivateCmsModelConfiguration<TModel>;\n build(): PrivateCmsModel<TModel>;\n}\n\nclass PrivateCmsModelBuilderImpl implements IPrivateCmsModelBuilder {\n constructor(private fieldBuilderRegistry: IFieldBuilderRegistry) {}\n\n create<TModel extends BaseModel<any>, TFields extends z.ZodRawShape = any>(\n modelId: string,\n fieldDefinitions: FieldDefinitionsFactory<TFields>\n ): IPrivateCmsModelConfiguration<TModel> {\n const builder = new FieldDefinitionsBuilder(this.fieldBuilderRegistry);\n const fieldShape = fieldDefinitions.factory(this.fieldBuilderRegistry);\n const fieldDefinitionsBuilder = builder.__fromObject(fieldShape);\n\n return new PrivateCmsModelConfiguration<TModel>(\n modelId,\n this.fieldBuilderRegistry,\n fieldDefinitionsBuilder\n );\n }\n}\n\nclass PrivateCmsModelConfiguration<\n TModel extends BaseModel<any>\n> implements IPrivateCmsModelConfiguration<TModel> {\n private metadata: CmsModelMetadata = {};\n // oxlint-disable-next-line\n private modelMethods: Record<string, Function> = {};\n private extensionFields = new Map<string, FieldBuilderConfig>();\n\n constructor(\n private modelId: string,\n private fieldBuilderRegistry: IFieldBuilderRegistry,\n private fieldDefinitionsBuilder: FieldDefinitionsBuilder\n ) {}\n\n withMethods<TMethods extends object>(\n methods: TMethods & ThisType<TModel & TMethods>\n ): IPrivateCmsModelConfiguration<TModel> {\n Object.assign(this.modelMethods, methods);\n return this as any;\n }\n\n extendFields(\n factory: (fields: IFieldBuilderRegistry) => Record<string, FieldBuilder<any>>\n ): IPrivateCmsModelConfiguration<TModel> {\n // Use the factory to get field shape - same as createFieldDefinitions!\n const fieldShape = factory(this.fieldBuilderRegistry);\n\n // Convert to field configs\n for (const [fieldId, fieldBuilder] of Object.entries(fieldShape)) {\n const config = fieldBuilder.toConfig();\n config.fieldId = fieldId;\n const zodSchema = fieldBuilder.getZodSchema();\n\n this.extensionFields.set(fieldId, {\n fieldId,\n config,\n zodSchema\n });\n }\n\n return this as any;\n }\n\n build(): PrivateCmsModel<TModel> {\n const baseSchema = this.fieldDefinitionsBuilder.__toZodSchema();\n let finalSchema = baseSchema;\n\n if (this.extensionFields.size > 0) {\n const extensionsShape: Record<string, z.ZodTypeAny> = {};\n\n for (const [fieldId, { zodSchema }] of this.extensionFields) {\n // Make each extension field optional\n extensionsShape[fieldId] = zodSchema.optional();\n }\n\n const extensionsSchema = z.object(extensionsShape).optional();\n\n finalSchema = baseSchema.extend({\n extensions: extensionsSchema\n }) as any;\n }\n\n let modelBuilder = new ModelBuilder<any>(this.modelId, finalSchema);\n\n if (Object.keys(this.modelMethods).length > 0) {\n modelBuilder = modelBuilder.withMethods(this.modelMethods);\n }\n\n const ModelClass = modelBuilder.build();\n\n const allFields = [\n ...this.fieldDefinitionsBuilder.__getFields(),\n ...(this.extensionFields.size > 0\n ? [\n {\n fieldId: \"extensions\",\n type: \"object\",\n label: \"Extensions\",\n validation: [],\n settings: {},\n zodSchema: z\n .object(\n Object.fromEntries(\n Array.from(this.extensionFields.entries()).map(\n ([id, { zodSchema }]) => [id, zodSchema.optional()]\n )\n )\n )\n .optional(),\n fields: Array.from(this.extensionFields.values()).map(f => f.config)\n }\n ]\n : [])\n ];\n\n return {\n type: \"private\" as const,\n modelType: \"private\" as const,\n Model: ModelClass as any,\n modelId: this.modelId,\n name: this.modelId,\n icon: this.metadata.icon,\n description: this.metadata.description,\n fields: allFields,\n schema: modelBuilder.getSchema() as TModel[\"__schema\"],\n create: (data: IModelData<TModel>) => ModelClass.create(data) as TModel\n };\n }\n}\n\nexport const PrivateCmsModelBuilder = createImplementation({\n abstraction: BuilderAbstraction,\n implementation: PrivateCmsModelBuilderImpl,\n dependencies: [FieldBuilderRegistry]\n});\n"],"mappings":"AAAA,SAASA,CAAC,QAAQ,KAAK;AACvB,SACIC,uBAAuB;;AAM3B;;AAEA,SAASC,oBAAoB,QAAQ,YAAY;AACjD,SACIC,oBAAoB,EAEpBC,sBAAsB,IAAIC,kBAAkB;AAEhD,SAASC,YAAY;AAmBrB,MAAMC,0B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AA0B;EAC1CoE,YAAY,EAAE,CAACxE,oBAAoB;AACvC,CAAC,CAAC","ignoreList":[]}
@@ -9,7 +9,7 @@ import type { BaseModel, IModelData } from "../../models/base/BaseModel.js";
9
9
  */
10
10
  export interface IFieldBuilderRegistry {
11
11
  text(): TextFieldBuilder<z.ZodString>;
12
- object<TShape extends z.ZodRawShape>(fields: (registry: IFieldBuilderRegistry) => {
12
+ object<TShape extends Record<string, z.ZodTypeAny>>(fields: (registry: IFieldBuilderRegistry) => {
13
13
  [K in keyof TShape]: FieldBuilder<TShape[K]>;
14
14
  }): ObjectFieldBuilder<TShape>;
15
15
  }
@@ -1 +1 @@
1
- {"version":3,"names":["Abstraction","FieldBuilderRegistry","PrivateCmsModelBuilder"],"sources":["abstractions.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { Abstraction } from \"@webiny/di\";\nimport type { IPrivateCmsModelConfiguration } from \"./PrivateCmsModelBuilder.js\";\nimport type { FieldDefinitionsFactory } from \"./FieldDefinitionsBuilder.js\";\nimport { type TextFieldBuilder, type ObjectFieldBuilder, FieldBuilder } from \"./FieldBuilder.js\";\nimport type { BaseModel, IModelData } from \"~/models/base/BaseModel.js\";\n\n/**\n * Field Builder Registry - provides field builders\n */\nexport interface IFieldBuilderRegistry {\n text(): TextFieldBuilder<z.ZodString>;\n object<TShape extends z.ZodRawShape>(\n fields: (registry: IFieldBuilderRegistry) => {\n [K in keyof TShape]: FieldBuilder<TShape[K]>;\n }\n ): ObjectFieldBuilder<TShape>;\n}\n\nexport const FieldBuilderRegistry = new Abstraction<IFieldBuilderRegistry>(\"FieldBuilderRegistry\");\n\n/**\n * Private CMS Model Builder - builds CMS model configurations\n */\nexport interface IPrivateCmsModelBuilder {\n create<TModel extends BaseModel<any>>(\n modelId: string,\n fieldDefinitions: FieldDefinitionsFactory<any>\n ): IPrivateCmsModelConfiguration<TModel>;\n}\n\nexport const PrivateCmsModelBuilder = new Abstraction<IPrivateCmsModelBuilder>(\n \"PrivateCmsModelBuilder\"\n);\n\nexport namespace PrivateCmsModelBuilder {\n export type Interface = IPrivateCmsModelBuilder;\n}\n\n/**\n * CMS Model Builder - builds the model configuration for a specific model\n */\nexport interface ICmsModelBuilder<TModel extends BaseModel<any>> {\n buildCmsModel(): Promise<IPrivateCmsModelConfiguration<TModel>>;\n}\n\n/**\n * CMS Model Factory - creates model instances\n */\nexport interface ICmsModelFactory<TModel extends BaseModel<any>> {\n create(data: IModelData<TModel>): Promise<TModel>;\n}\n"],"mappings":"AACA,SAASA,WAAW,QAAQ,YAAY;;AAMxC;AACA;AACA;;AAUA,OAAO,MAAMC,oBAAoB,GAAG,IAAID,WAAW,CAAwB,sBAAsB,CAAC;;AAElG;AACA;AACA;;AAQA,OAAO,MAAME,sBAAsB,GAAG,IAAIF,WAAW,CACjD,wBACJ,CAAC;;AAMD;AACA;AACA;;AAKA;AACA;AACA","ignoreList":[]}
1
+ {"version":3,"names":["Abstraction","FieldBuilderRegistry","PrivateCmsModelBuilder"],"sources":["abstractions.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { Abstraction } from \"@webiny/di\";\nimport type { IPrivateCmsModelConfiguration } from \"./PrivateCmsModelBuilder.js\";\nimport type { FieldDefinitionsFactory } from \"./FieldDefinitionsBuilder.js\";\nimport { type TextFieldBuilder, type ObjectFieldBuilder, FieldBuilder } from \"./FieldBuilder.js\";\nimport type { BaseModel, IModelData } from \"~/models/base/BaseModel.js\";\n\n/**\n * Field Builder Registry - provides field builders\n */\nexport interface IFieldBuilderRegistry {\n text(): TextFieldBuilder<z.ZodString>;\n object<TShape extends Record<string, z.ZodTypeAny>>(\n fields: (registry: IFieldBuilderRegistry) => {\n [K in keyof TShape]: FieldBuilder<TShape[K]>;\n }\n ): ObjectFieldBuilder<TShape>;\n}\n\nexport const FieldBuilderRegistry = new Abstraction<IFieldBuilderRegistry>(\"FieldBuilderRegistry\");\n\n/**\n * Private CMS Model Builder - builds CMS model configurations\n */\nexport interface IPrivateCmsModelBuilder {\n create<TModel extends BaseModel<any>>(\n modelId: string,\n fieldDefinitions: FieldDefinitionsFactory<any>\n ): IPrivateCmsModelConfiguration<TModel>;\n}\n\nexport const PrivateCmsModelBuilder = new Abstraction<IPrivateCmsModelBuilder>(\n \"PrivateCmsModelBuilder\"\n);\n\nexport namespace PrivateCmsModelBuilder {\n export type Interface = IPrivateCmsModelBuilder;\n}\n\n/**\n * CMS Model Builder - builds the model configuration for a specific model\n */\nexport interface ICmsModelBuilder<TModel extends BaseModel<any>> {\n buildCmsModel(): Promise<IPrivateCmsModelConfiguration<TModel>>;\n}\n\n/**\n * CMS Model Factory - creates model instances\n */\nexport interface ICmsModelFactory<TModel extends BaseModel<any>> {\n create(data: IModelData<TModel>): Promise<TModel>;\n}\n"],"mappings":"AACA,SAASA,WAAW,QAAQ,YAAY;;AAMxC;AACA;AACA;;AAUA,OAAO,MAAMC,oBAAoB,GAAG,IAAID,WAAW,CAAwB,sBAAsB,CAAC;;AAElG;AACA;AACA;;AAQA,OAAO,MAAME,sBAAsB,GAAG,IAAIF,WAAW,CACjD,wBACJ,CAAC;;AAMD;AACA;AACA;;AAKA;AACA;AACA","ignoreList":[]}
@@ -41,7 +41,7 @@ export interface ITextFieldBuilder extends FieldBuilder<z.ZodString> {
41
41
  email(): this;
42
42
  url(): this;
43
43
  unique(): this;
44
- helpText(text: string): this;
44
+ help(text: string): this;
45
45
  placeholder(text: string): this;
46
46
  }
47
47
 
@@ -194,8 +194,10 @@ import type { FieldBuilder } from "./FieldBuilder.js";
194
194
  export interface IFieldBuilderRegistry {
195
195
  text(): ITextFieldBuilder;
196
196
  // object is special - needs registry reference
197
- object<TShape extends z.ZodRawShape>(
198
- fields: (registry: IFieldBuilderRegistry) => { [K in keyof TShape]: FieldBuilder<TShape[K]> }
197
+ object<TShape extends Record<string, z.ZodTypeAny>>(
198
+ fields: (registry: IFieldBuilderRegistry) => {
199
+ [K in keyof TShape]: FieldBuilder<TShape[K]>;
200
+ }
199
201
  ): FieldBuilder<z.ZodObject<TShape>>;
200
202
  }
201
203
 
@@ -219,7 +221,7 @@ export interface IColorFieldBuilder extends FieldBuilder<z.ZodString> {
219
221
  default(hex: string): this;
220
222
  allowAlpha(): this;
221
223
  palette(colors: string[]): this;
222
- helpText(text: string): this;
224
+ help(text: string): this;
223
225
  }
224
226
 
225
227
  class ColorFieldBuilder extends FieldBuilder<z.ZodString> implements IColorFieldBuilder {
@@ -6,8 +6,8 @@ export interface FieldConfig {
6
6
  fieldId: string;
7
7
  type: string;
8
8
  label?: string;
9
- helpText?: string;
10
- placeholderText?: string;
9
+ help?: string;
10
+ placeholder?: string;
11
11
  validation?: ValidationRule[];
12
12
  settings?: Record<string, any>;
13
13
  zodSchema: z.ZodTypeAny;
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import { z } from \"zod\";\nimport type { ModelClass } from \"~/models/base/ModelBuilder.js\";\nimport type { BaseModel } from \"~/models/base/BaseModel.js\";\nimport type { IModelData } from \"~/models/base/abstractions.js\";\n\nexport interface FieldConfig {\n fieldId: string;\n type: string;\n label?: string;\n helpText?: string;\n placeholderText?: string;\n validation?: ValidationRule[];\n settings?: Record<string, any>;\n zodSchema: z.ZodTypeAny;\n fields?: FieldConfig[]; // For nested object fields\n}\n\nexport interface ValidationRule {\n name: string;\n message: string;\n settings: Record<string, any>;\n}\n\nexport interface CmsModelMetadata {\n icon?: string;\n description?: string;\n titleFieldId?: string;\n descriptionFieldId?: string;\n imageFieldId?: string;\n tags?: string[];\n}\n\n// Make PrivateCmsModel generic!\nexport interface PrivateCmsModel<TModel extends BaseModel<any>> {\n type: \"private\";\n modelType: \"private\";\n Model: ModelClass<TModel>;\n modelId: string;\n name: string;\n icon?: string;\n description?: string;\n fields: FieldConfig[];\n schema: TModel[\"__schema\"];\n create: (data: IModelData<TModel>) => TModel;\n}\n\nexport interface FieldBuilderConfig {\n fieldId: string;\n config: FieldConfig;\n zodSchema: z.ZodTypeAny;\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import { z } from \"zod\";\nimport type { ModelClass } from \"~/models/base/ModelBuilder.js\";\nimport type { BaseModel } from \"~/models/base/BaseModel.js\";\nimport type { IModelData } from \"~/models/base/abstractions.js\";\n\nexport interface FieldConfig {\n fieldId: string;\n type: string;\n label?: string;\n help?: string;\n placeholder?: string;\n validation?: ValidationRule[];\n settings?: Record<string, any>;\n zodSchema: z.ZodTypeAny;\n fields?: FieldConfig[]; // For nested object fields\n}\n\nexport interface ValidationRule {\n name: string;\n message: string;\n settings: Record<string, any>;\n}\n\nexport interface CmsModelMetadata {\n icon?: string;\n description?: string;\n titleFieldId?: string;\n descriptionFieldId?: string;\n imageFieldId?: string;\n tags?: string[];\n}\n\n// Make PrivateCmsModel generic!\nexport interface PrivateCmsModel<TModel extends BaseModel<any>> {\n type: \"private\";\n modelType: \"private\";\n Model: ModelClass<TModel>;\n modelId: string;\n name: string;\n icon?: string;\n description?: string;\n fields: FieldConfig[];\n schema: TModel[\"__schema\"];\n create: (data: IModelData<TModel>) => TModel;\n}\n\nexport interface FieldBuilderConfig {\n fieldId: string;\n config: FieldConfig;\n zodSchema: z.ZodTypeAny;\n}\n"],"mappings":"","ignoreList":[]}
@@ -5,17 +5,7 @@ export declare const PageSchema: import("zod").ZodObject<{
5
5
  title: import("zod").ZodString;
6
6
  content: import("zod").ZodString;
7
7
  publishedAt: import("zod").ZodNullable<import("zod").ZodDate>;
8
- }, "strip", import("zod").ZodTypeAny, {
9
- id: string;
10
- title: string;
11
- publishedAt: Date | null;
12
- content: string;
13
- }, {
14
- id: string;
15
- title: string;
16
- publishedAt: Date | null;
17
- content: string;
18
- }>;
8
+ }, import("zod/v4/core").$strip>;
19
9
  export interface IPageExtensions {
20
10
  }
21
11
  export interface IPage extends IModel<typeof PageSchema> {
package/package.json CHANGED
@@ -1,98 +1,56 @@
1
1
  {
2
2
  "name": "@webiny/api-core",
3
- "version": "0.0.0-unstable.e622468070",
3
+ "version": "0.0.0-unstable.e6f0dc8ca7",
4
4
  "type": "module",
5
- "main": "index.js",
6
5
  "repository": {
7
6
  "type": "git",
8
7
  "url": "https://github.com/webiny/webiny-js.git"
9
8
  },
10
9
  "description": "Core package for developing API-related features. Includes tenancy, security, system, and admin users.",
11
10
  "author": "Webiny Ltd.",
11
+ "license": "MIT",
12
12
  "exports": {
13
13
  ".": "./index.js",
14
- "./features/EventPublisher": "./features/eventPublisher/index.js",
15
- "./features/LoggerService": "./features/logger/index.js",
16
- "./features/IdentityContext": "./features/security/IdentityContext/index.js",
17
- "./features/WcpContext": "./features/wcp/WcpContext/index.js",
18
- "./features/TaskService": "./features/task/TaskService/index.js",
19
- "./features/CreateApiKey": "./features/security/apiKeys/CreateApiKey/index.js",
20
- "./features/DeleteApiKey": "./features/security/apiKeys/DeleteApiKey/index.js",
21
- "./features/GetApiKey": "./features/security/apiKeys/GetApiKey/index.js",
22
- "./features/GetApiKeyByToken": "./features/security/apiKeys/GetApiKeyByToken/index.js",
23
- "./features/ListApiKeys": "./features/security/apiKeys/ListApiKeys/index.js",
24
- "./features/UpdateApiKey": "./features/security/apiKeys/UpdateApiKey/index.js",
25
- "./features/AuthenticationContext": "./features/security/authentication/AuthenticationContext/index.js",
26
- "./features/Authenticator": "./features/security/authentication/Authenticator/index.js",
27
- "./features/AuthorizationContext": "./features/security/authorization/AuthorizationContext/index.js",
28
- "./features/Authorizer": "./features/security/authorization/Authorizer/index.js",
29
- "./features/CreateRole": "./features/security/roles/CreateRole/index.js",
30
- "./features/DeleteRole": "./features/security/roles/DeleteRole/index.js",
31
- "./features/GetRole": "./features/security/roles/GetRole/index.js",
32
- "./features/ListRoles": "./features/security/roles/ListRoles/index.js",
33
- "./features/UpdateRole": "./features/security/roles/UpdateRole/index.js",
34
- "./features/CreateTeam": "./features/security/teams/CreateTeam/index.js",
35
- "./features/DeleteTeam": "./features/security/teams/DeleteTeam/index.js",
36
- "./features/GetTeam": "./features/security/teams/GetTeam/index.js",
37
- "./features/ListTeams": "./features/security/teams/ListTeams/index.js",
38
- "./features/UpdateTeam": "./features/security/teams/UpdateTeam/index.js",
39
- "./features/CreateTenantLinks": "./features/security/tenantLinks/CreateTenantLinks/index.js",
40
- "./features/DeleteTenantLinks": "./features/security/tenantLinks/DeleteTenantLinks/index.js",
41
- "./features/GetTenantLinkByIdentity": "./features/security/tenantLinks/GetTenantLinkByIdentity/index.js",
42
- "./features/ListTenantLinksByIdentity": "./features/security/tenantLinks/ListTenantLinksByIdentity/index.js",
43
- "./features/ListTenantLinksByTenant": "./features/security/tenantLinks/ListTenantLinksByTenant/index.js",
44
- "./features/ListTenantLinksByType": "./features/security/tenantLinks/ListTenantLinksByType/index.js",
45
- "./features/UpdateTenantLinks": "./features/security/tenantLinks/UpdateTenantLinks/index.js",
46
- "./features/InstallSystem": "./features/system/InstallSystem/index.js",
47
- "./features/InstallTenant": "./features/tenancy/InstallTenant/index.js",
48
- "./features/TenantContext": "./features/tenancy/TenantContext/index.js",
49
- "./features/CreateUser": "./features/users/CreateUser/index.js",
50
- "./features/DeleteUser": "./features/users/DeleteUser/index.js",
51
- "./features/UpdateUser": "./features/users/UpdateUser/index.js",
52
- "./features/GetUser": "./features/users/GetUser/index.js",
53
- "./features/ListUsers": "./features/users/ListUsers/index.js",
54
- "./features/ListUserTeams": "./features/users/ListUserTeams/index.js",
55
- "./features/ExternalIdpUserSync": "./features/users/ExternalIdpUserSync/index.js",
56
14
  "./*": "./*"
57
15
  },
58
- "license": "MIT",
59
16
  "dependencies": {
60
- "@webiny/api": "0.0.0-unstable.e622468070",
17
+ "@ai-sdk/anthropic": "3.0.76",
18
+ "@ai-sdk/openai": "3.0.63",
19
+ "@webiny/api": "0.0.0-unstable.e6f0dc8ca7",
61
20
  "@webiny/di": "0.2.3",
62
- "@webiny/error": "0.0.0-unstable.e622468070",
63
- "@webiny/feature": "0.0.0-unstable.e622468070",
64
- "@webiny/handler": "0.0.0-unstable.e622468070",
65
- "@webiny/handler-db": "0.0.0-unstable.e622468070",
66
- "@webiny/handler-graphql": "0.0.0-unstable.e622468070",
67
- "@webiny/plugins": "0.0.0-unstable.e622468070",
68
- "@webiny/project": "0.0.0-unstable.e622468070",
69
- "@webiny/utils": "0.0.0-unstable.e622468070",
70
- "@webiny/wcp": "0.0.0-unstable.e622468070",
21
+ "@webiny/error": "0.0.0-unstable.e6f0dc8ca7",
22
+ "@webiny/feature": "0.0.0-unstable.e6f0dc8ca7",
23
+ "@webiny/feature-flags": "0.0.0-unstable.e6f0dc8ca7",
24
+ "@webiny/handler": "0.0.0-unstable.e6f0dc8ca7",
25
+ "@webiny/handler-db": "0.0.0-unstable.e6f0dc8ca7",
26
+ "@webiny/handler-graphql": "0.0.0-unstable.e6f0dc8ca7",
27
+ "@webiny/plugins": "0.0.0-unstable.e6f0dc8ca7",
28
+ "@webiny/utils": "0.0.0-unstable.e6f0dc8ca7",
29
+ "@webiny/wcp": "0.0.0-unstable.e6f0dc8ca7",
30
+ "ai": "6.0.177",
71
31
  "dataloader": "2.2.3",
72
- "jose": "5.10.0",
32
+ "jose": "6.2.3",
73
33
  "jsonwebtoken": "9.0.3",
74
- "lodash": "4.17.23",
75
- "minimatch": "5.1.6",
76
- "pino": "9.14.0",
34
+ "lodash": "4.18.1",
35
+ "minimatch": "10.2.5",
36
+ "pino": "10.3.1",
77
37
  "pino-lambda": "4.4.1",
78
- "ts-morph": "27.0.2",
79
- "zod": "3.25.76"
38
+ "zod": "4.4.3"
80
39
  },
81
40
  "devDependencies": {
82
41
  "@types/jsonwebtoken": "9.0.10",
83
- "@types/md5": "2.3.6",
84
- "@webiny/build-tools": "0.0.0-unstable.e622468070",
85
- "@webiny/db-dynamodb": "0.0.0-unstable.e622468070",
86
- "@webiny/handler-aws": "0.0.0-unstable.e622468070",
87
- "@webiny/project-utils": "0.0.0-unstable.e622468070",
42
+ "@webiny/build-tools": "0.0.0-unstable.e6f0dc8ca7",
43
+ "@webiny/db-dynamodb": "0.0.0-unstable.e6f0dc8ca7",
44
+ "@webiny/handler-aws": "0.0.0-unstable.e6f0dc8ca7",
45
+ "@webiny/project-utils": "0.0.0-unstable.e6f0dc8ca7",
88
46
  "jest-dynalite": "3.6.1",
89
- "rimraf": "6.1.2",
90
- "typescript": "5.9.3",
91
- "vitest": "3.2.4"
47
+ "rimraf": "6.1.3",
48
+ "typescript": "6.0.3",
49
+ "vitest": "4.1.5"
92
50
  },
93
51
  "publishConfig": {
94
52
  "access": "public",
95
53
  "directory": "dist"
96
54
  },
97
- "gitHead": "e622468070839dc3f9552c85bf2bbac12d2ef88f"
55
+ "gitHead": "e6f0dc8ca741c1fcc3fec9a5b9e86fdd49544641"
98
56
  }
@@ -3,7 +3,6 @@ import type { LegacyContext } from "../legacy/security/LegacyContext.js";
3
3
  import { Identity } from "../features/security/IdentityContext/index.js";
4
4
  export type { Jwk, Jwt } from "../features/security/utils/verifyJwtUsingJwk.js";
5
5
  export type SecurityIdentity = Identity;
6
- export type GetPermissions = <T extends SecurityPermission = SecurityPermission>(name: string) => Promise<T[]>;
7
6
  export interface GetGroupWhere {
8
7
  id?: string;
9
8
  slug?: string;
@@ -49,7 +48,6 @@ export interface CreatedBy {
49
48
  type: string;
50
49
  }
51
50
  export interface Role {
52
- tenant: string | null;
53
51
  createdOn: string | null;
54
52
  createdBy: CreatedBy | null;
55
53
  id: string;
@@ -72,17 +70,19 @@ export interface ListRolesParams {
72
70
  };
73
71
  sort?: string[];
74
72
  }
73
+ export type StorageRole = Role & {
74
+ tenant: string;
75
+ };
75
76
  export interface CreateRoleParams {
76
- role: Role;
77
+ role: StorageRole;
77
78
  }
78
79
  export interface UpdateRoleParams {
79
- role: Role;
80
+ role: StorageRole;
80
81
  }
81
82
  export interface DeleteRoleParams {
82
- role: Role;
83
+ role: StorageRole;
83
84
  }
84
85
  export interface Team {
85
- tenant: string | null;
86
86
  createdOn: string | null;
87
87
  createdBy: CreatedBy | null;
88
88
  id: string;
@@ -106,15 +106,18 @@ export interface ListTeamsParams {
106
106
  };
107
107
  sort?: string[];
108
108
  }
109
+ export type StorageTeam = Team & {
110
+ tenant: string;
111
+ };
109
112
  export interface CreateTeamParams {
110
- team: Team;
113
+ team: StorageTeam;
111
114
  }
112
115
  export interface UpdateTeamParams {
113
- original: Team;
114
- team: Team;
116
+ original: StorageTeam;
117
+ team: StorageTeam;
115
118
  }
116
119
  export interface DeleteTeamParams {
117
- team: Team;
120
+ team: StorageTeam;
118
121
  }
119
122
  export interface ApiKey {
120
123
  id: string;
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["security.ts"],"sourcesContent":["import type { TenancyContext } from \"~/types/tenancy.js\";\nimport type { LegacyContext } from \"~/legacy/security/LegacyContext.js\";\nimport { Identity } from \"~/features/security/IdentityContext/index.js\";\n\nexport type { Jwk, Jwt } from \"~/features/security/utils/verifyJwtUsingJwk.js\";\n\nexport type SecurityIdentity = Identity;\n\nexport type GetPermissions = <T extends SecurityPermission = SecurityPermission>(\n name: string\n) => Promise<T[]>;\n\nexport interface GetGroupWhere {\n id?: string;\n slug?: string;\n tenant?: string;\n}\n\nexport interface GetTeamWhere {\n id?: string;\n slug?: string;\n tenant?: string;\n}\n\nexport type Security = LegacyContext;\n\nexport interface SecurityStorageOperations {\n getRole(params: StorageOperationsGetRoleParams): Promise<Role | null>;\n\n listRoles(params: StorageOperationsListRolesParams): Promise<Role[]>;\n\n createRole(params: StorageOperationsCreateRoleParams): Promise<void>;\n\n updateRole(params: StorageOperationsUpdateRoleParams): Promise<void>;\n\n deleteRole(params: StorageOperationsDeleteRoleParams): Promise<void>;\n\n getTeam(params: StorageOperationsGetTeamParams): Promise<Team | null>;\n\n listTeams(params: StorageOperationsListTeamsParams): Promise<Team[]>;\n\n createTeam(params: StorageOperationsCreateTeamParams): Promise<void>;\n\n updateTeam(params: StorageOperationsUpdateTeamParams): Promise<void>;\n\n deleteTeam(params: StorageOperationsDeleteTeamParams): Promise<void>;\n\n getApiKey(params: StorageOperationsGetApiKeyParams): Promise<StorageApiKey | null>;\n\n getApiKeyByToken(\n params: StorageOperationsGetApiKeyByTokenParams\n ): Promise<StorageApiKey | null>;\n\n getApiKeyBySlug(params: StorageOperationsGetApiKeyBySlugParams): Promise<StorageApiKey | null>;\n\n listApiKeys(params: StorageOperationsListApiKeysParams): Promise<StorageApiKey[]>;\n\n createApiKey(params: StorageOperationsCreateApiKeyParams): Promise<void>;\n\n updateApiKey(params: StorageOperationsUpdateApiKeyParams): Promise<void>;\n\n deleteApiKey(params: StorageOperationsDeleteApiKeyParams): Promise<void>;\n}\n\nexport type SecurityPermission<T = Record<string, any>> = T & {\n name: string;\n};\n\nexport interface SecurityContext extends TenancyContext {\n security: Security;\n}\n\nexport interface FullAccessPermission {\n name: \"*\";\n}\n\nexport interface CreatedBy {\n id: string;\n displayName: string | null;\n type: string;\n}\n\nexport interface Role {\n // Roles defined via plugins might not have `tenant` specified (meaning they are global).\n tenant: string | null;\n\n // Roles defined via plugins don't have `createdOn` and `createdBy` specified.\n createdOn: string | null;\n createdBy: CreatedBy | null;\n\n id: string;\n name: string;\n slug: string;\n description: string;\n system: boolean;\n permissions: SecurityPermission[];\n\n // Set to `true` when a role is defined via a plugin.\n plugin?: boolean;\n}\n\nexport type SecurityRole = Role;\nexport type SecurityTeam = Team;\n\nexport interface GetRoleParams {\n where: GetGroupWhere;\n}\n\nexport interface ListRolesParams {\n where?: {\n id_in?: string[];\n slug_in?: string[];\n };\n sort?: string[];\n}\n\nexport interface CreateRoleParams {\n role: Role;\n}\n\nexport interface UpdateRoleParams {\n role: Role;\n}\n\nexport interface DeleteRoleParams {\n role: Role;\n}\n\nexport interface Team {\n // Teams defined via plugins might not have `tenant` specified (meaning they are global).\n tenant: string | null;\n\n // Teams defined via plugins don't have `createdOn` and `createdBy` specified.\n createdOn: string | null;\n createdBy: CreatedBy | null;\n\n id: string;\n name: string;\n slug: string;\n description: string;\n system: boolean;\n roles: string[];\n\n // Set to `true` when a role is defined via a plugin.\n plugin?: boolean;\n}\n\nexport type TeamInput = Pick<Team, \"name\" | \"slug\" | \"description\" | \"roles\"> & {\n system?: boolean;\n};\n\nexport interface GetTeamParams {\n where: GetTeamWhere;\n}\n\nexport interface ListTeamsParams {\n where?: {\n id_in?: string[];\n slug_in?: string[];\n };\n sort?: string[];\n}\n\nexport interface CreateTeamParams {\n team: Team;\n}\n\nexport interface UpdateTeamParams {\n original: Team;\n team: Team;\n}\n\nexport interface DeleteTeamParams {\n team: Team;\n}\n\nexport interface ApiKey {\n id: string;\n name: string;\n slug: string;\n description: string;\n token: string;\n permissions: SecurityPermission[];\n createdBy: CreatedBy;\n createdOn: string;\n}\n\nexport interface StorageApiKey {\n id: string;\n tenant: string;\n name: string;\n slug: string;\n description: string;\n token: string;\n permissions: SecurityPermission[];\n createdBy: CreatedBy;\n createdOn: string;\n}\n\nexport interface ApiKeyPermission extends SecurityPermission {\n name: \"security.apiKey\";\n}\n\nexport interface GetApiKeyParams {\n tenant: string;\n id: string;\n}\n\nexport interface ListApiKeysParams {\n sort?: string[];\n}\n\nexport interface GetApiKeyByTokenParams {\n tenant: string;\n token: string;\n}\n\nexport interface GetApiKeyBySlugParams {\n tenant: string;\n slug: string;\n}\n\nexport interface CreateApiKeyParams {\n apiKey: StorageApiKey;\n}\n\nexport interface UpdateApiKeyParams {\n apiKey: StorageApiKey;\n}\n\nexport interface DeleteApiKeyParams {\n apiKey: StorageApiKey;\n}\n\nexport interface StorageOperationsListApiKeysParams extends ListApiKeysParams {\n where: {\n tenant: string;\n };\n}\n\nexport interface StorageOperationsGetRoleParams extends GetRoleParams {\n where: GetRoleParams[\"where\"] & {\n tenant: string;\n };\n}\n\nexport interface StorageOperationsListRolesParams extends ListRolesParams {\n where: ListRolesParams[\"where\"] & {\n tenant: string;\n };\n}\n\nexport type StorageOperationsCreateRoleParams = CreateRoleParams;\nexport type StorageOperationsUpdateRoleParams = UpdateRoleParams;\nexport type StorageOperationsDeleteRoleParams = DeleteRoleParams;\n\nexport interface StorageOperationsGetTeamParams extends GetTeamParams {\n where: GetTeamParams[\"where\"] & {\n tenant: string;\n };\n}\n\nexport interface StorageOperationsListTeamsParams extends ListTeamsParams {\n where: ListTeamsParams[\"where\"] & {\n tenant: string;\n };\n}\n\nexport type StorageOperationsCreateTeamParams = CreateTeamParams;\nexport type StorageOperationsUpdateTeamParams = UpdateTeamParams;\nexport type StorageOperationsDeleteTeamParams = DeleteTeamParams;\nexport type StorageOperationsGetApiKeyParams = GetApiKeyParams;\nexport type StorageOperationsGetApiKeyByTokenParams = GetApiKeyByTokenParams;\nexport type StorageOperationsGetApiKeyBySlugParams = GetApiKeyBySlugParams;\nexport type StorageOperationsCreateApiKeyParams = CreateApiKeyParams;\nexport type StorageOperationsUpdateApiKeyParams = UpdateApiKeyParams;\nexport type StorageOperationsDeleteApiKeyParams = DeleteApiKeyParams;\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["security.ts"],"sourcesContent":["import type { TenancyContext } from \"~/types/tenancy.js\";\nimport type { LegacyContext } from \"~/legacy/security/LegacyContext.js\";\nimport { Identity } from \"~/features/security/IdentityContext/index.js\";\n\nexport type { Jwk, Jwt } from \"~/features/security/utils/verifyJwtUsingJwk.js\";\n\nexport type SecurityIdentity = Identity;\n\nexport interface GetGroupWhere {\n id?: string;\n slug?: string;\n tenant?: string;\n}\n\nexport interface GetTeamWhere {\n id?: string;\n slug?: string;\n tenant?: string;\n}\n\nexport type Security = LegacyContext;\n\nexport interface SecurityStorageOperations {\n getRole(params: StorageOperationsGetRoleParams): Promise<Role | null>;\n\n listRoles(params: StorageOperationsListRolesParams): Promise<Role[]>;\n\n createRole(params: StorageOperationsCreateRoleParams): Promise<void>;\n\n updateRole(params: StorageOperationsUpdateRoleParams): Promise<void>;\n\n deleteRole(params: StorageOperationsDeleteRoleParams): Promise<void>;\n\n getTeam(params: StorageOperationsGetTeamParams): Promise<Team | null>;\n\n listTeams(params: StorageOperationsListTeamsParams): Promise<Team[]>;\n\n createTeam(params: StorageOperationsCreateTeamParams): Promise<void>;\n\n updateTeam(params: StorageOperationsUpdateTeamParams): Promise<void>;\n\n deleteTeam(params: StorageOperationsDeleteTeamParams): Promise<void>;\n\n getApiKey(params: StorageOperationsGetApiKeyParams): Promise<StorageApiKey | null>;\n\n getApiKeyByToken(\n params: StorageOperationsGetApiKeyByTokenParams\n ): Promise<StorageApiKey | null>;\n\n getApiKeyBySlug(params: StorageOperationsGetApiKeyBySlugParams): Promise<StorageApiKey | null>;\n\n listApiKeys(params: StorageOperationsListApiKeysParams): Promise<StorageApiKey[]>;\n\n createApiKey(params: StorageOperationsCreateApiKeyParams): Promise<void>;\n\n updateApiKey(params: StorageOperationsUpdateApiKeyParams): Promise<void>;\n\n deleteApiKey(params: StorageOperationsDeleteApiKeyParams): Promise<void>;\n}\n\nexport type SecurityPermission<T = Record<string, any>> = T & {\n name: string;\n};\n\nexport interface SecurityContext extends TenancyContext {\n security: Security;\n}\n\nexport interface FullAccessPermission {\n name: \"*\";\n}\n\nexport interface CreatedBy {\n id: string;\n displayName: string | null;\n type: string;\n}\n\nexport interface Role {\n // Roles defined via plugins don't have `createdOn` and `createdBy` specified.\n createdOn: string | null;\n createdBy: CreatedBy | null;\n\n id: string;\n name: string;\n slug: string;\n description: string;\n system: boolean;\n permissions: SecurityPermission[];\n\n // Set to `true` when a role is defined via a plugin.\n plugin?: boolean;\n}\n\nexport type SecurityRole = Role;\nexport type SecurityTeam = Team;\n\nexport interface GetRoleParams {\n where: GetGroupWhere;\n}\n\nexport interface ListRolesParams {\n where?: {\n id_in?: string[];\n slug_in?: string[];\n };\n sort?: string[];\n}\n\nexport type StorageRole = Role & { tenant: string };\n\nexport interface CreateRoleParams {\n role: StorageRole;\n}\n\nexport interface UpdateRoleParams {\n role: StorageRole;\n}\n\nexport interface DeleteRoleParams {\n role: StorageRole;\n}\n\nexport interface Team {\n // Teams defined via plugins don't have `createdOn` and `createdBy` specified.\n createdOn: string | null;\n createdBy: CreatedBy | null;\n\n id: string;\n name: string;\n slug: string;\n description: string;\n system: boolean;\n roles: string[];\n\n // Set to `true` when a role is defined via a plugin.\n plugin?: boolean;\n}\n\nexport type TeamInput = Pick<Team, \"name\" | \"slug\" | \"description\" | \"roles\"> & {\n system?: boolean;\n};\n\nexport interface GetTeamParams {\n where: GetTeamWhere;\n}\n\nexport interface ListTeamsParams {\n where?: {\n id_in?: string[];\n slug_in?: string[];\n };\n sort?: string[];\n}\n\nexport type StorageTeam = Team & { tenant: string };\n\nexport interface CreateTeamParams {\n team: StorageTeam;\n}\n\nexport interface UpdateTeamParams {\n original: StorageTeam;\n team: StorageTeam;\n}\n\nexport interface DeleteTeamParams {\n team: StorageTeam;\n}\n\nexport interface ApiKey {\n id: string;\n name: string;\n slug: string;\n description: string;\n token: string;\n permissions: SecurityPermission[];\n createdBy: CreatedBy;\n createdOn: string;\n}\n\nexport interface StorageApiKey {\n id: string;\n tenant: string;\n name: string;\n slug: string;\n description: string;\n token: string;\n permissions: SecurityPermission[];\n createdBy: CreatedBy;\n createdOn: string;\n}\n\nexport interface ApiKeyPermission extends SecurityPermission {\n name: \"security.apiKey\";\n}\n\nexport interface GetApiKeyParams {\n tenant: string;\n id: string;\n}\n\nexport interface ListApiKeysParams {\n sort?: string[];\n}\n\nexport interface GetApiKeyByTokenParams {\n tenant: string;\n token: string;\n}\n\nexport interface GetApiKeyBySlugParams {\n tenant: string;\n slug: string;\n}\n\nexport interface CreateApiKeyParams {\n apiKey: StorageApiKey;\n}\n\nexport interface UpdateApiKeyParams {\n apiKey: StorageApiKey;\n}\n\nexport interface DeleteApiKeyParams {\n apiKey: StorageApiKey;\n}\n\nexport interface StorageOperationsListApiKeysParams extends ListApiKeysParams {\n where: {\n tenant: string;\n };\n}\n\nexport interface StorageOperationsGetRoleParams extends GetRoleParams {\n where: GetRoleParams[\"where\"] & {\n tenant: string;\n };\n}\n\nexport interface StorageOperationsListRolesParams extends ListRolesParams {\n where: ListRolesParams[\"where\"] & {\n tenant: string;\n };\n}\n\nexport type StorageOperationsCreateRoleParams = CreateRoleParams;\nexport type StorageOperationsUpdateRoleParams = UpdateRoleParams;\nexport type StorageOperationsDeleteRoleParams = DeleteRoleParams;\n\nexport interface StorageOperationsGetTeamParams extends GetTeamParams {\n where: GetTeamParams[\"where\"] & {\n tenant: string;\n };\n}\n\nexport interface StorageOperationsListTeamsParams extends ListTeamsParams {\n where: ListTeamsParams[\"where\"] & {\n tenant: string;\n };\n}\n\nexport type StorageOperationsCreateTeamParams = CreateTeamParams;\nexport type StorageOperationsUpdateTeamParams = UpdateTeamParams;\nexport type StorageOperationsDeleteTeamParams = DeleteTeamParams;\nexport type StorageOperationsGetApiKeyParams = GetApiKeyParams;\nexport type StorageOperationsGetApiKeyByTokenParams = GetApiKeyByTokenParams;\nexport type StorageOperationsGetApiKeyBySlugParams = GetApiKeyBySlugParams;\nexport type StorageOperationsCreateApiKeyParams = CreateApiKeyParams;\nexport type StorageOperationsUpdateApiKeyParams = UpdateApiKeyParams;\nexport type StorageOperationsDeleteApiKeyParams = DeleteApiKeyParams;\n"],"mappings":"","ignoreList":[]}
@@ -1,3 +0,0 @@
1
- export { BuildParam, BuildParams } from "../../features/buildParams/index.js";
2
-
3
- //# sourceMappingURL=buildParams.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["BuildParam","BuildParams"],"sources":["buildParams.ts"],"sourcesContent":["export { BuildParam, BuildParams } from \"~/features/buildParams/index.js\";\n"],"mappings":"AAAA,SAASA,UAAU,EAAEC,WAAW","ignoreList":[]}
@@ -1 +0,0 @@
1
- export { DomainEvent, EventPublisher } from "../../features/eventPublisher/index.js";
@@ -1 +0,0 @@
1
- {"version":3,"names":["DomainEvent","EventPublisher"],"sources":["eventPublisher.ts"],"sourcesContent":["export { DomainEvent, EventPublisher } from \"~/features/eventPublisher/index.js\";\n"],"mappings":"AAAA,SAASA,WAAW,EAAEC,cAAc","ignoreList":[]}
@@ -1,3 +0,0 @@
1
- export { GlobalKeyValueStore, KeyValueStore } from "../../features/keyValueStore/index.js";
2
-
3
- //# sourceMappingURL=keyValueStore.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["GlobalKeyValueStore","KeyValueStore"],"sources":["keyValueStore.ts"],"sourcesContent":["export { GlobalKeyValueStore, KeyValueStore } from \"~/features/keyValueStore/index.js\";\n"],"mappings":"AAAA,SAASA,mBAAmB,EAAEC,aAAa","ignoreList":[]}
@@ -1,7 +0,0 @@
1
- export { ApiKeyAfterCreateHandler, ApiKeyBeforeCreateHandler, CreateApiKeyUseCase } from "../../../features/security/apiKeys/CreateApiKey/index.js";
2
- export { ApiKeyAfterDeleteHandler, ApiKeyBeforeDeleteHandler, DeleteApiKeyUseCase } from "../../../features/security/apiKeys/DeleteApiKey/index.js";
3
- export { GetApiKeyUseCase } from "../../../features/security/apiKeys/GetApiKey/index.js";
4
- export { GetApiKeyByTokenUseCase } from "../../../features/security/apiKeys/GetApiKeyByToken/index.js";
5
- export { ListApiKeysUseCase } from "../../../features/security/apiKeys/ListApiKeys/index.js";
6
- export { ApiKeyAfterUpdateHandler, ApiKeyBeforeUpdateHandler, UpdateApiKeyUseCase } from "../../../features/security/apiKeys/UpdateApiKey/index.js";
7
- export { ApiKeyFactory } from "../../../features/security/apiKeys/shared/abstractions.js";
@@ -1,9 +0,0 @@
1
- export { ApiKeyAfterCreateHandler, ApiKeyBeforeCreateHandler, CreateApiKeyUseCase } from "../../../features/security/apiKeys/CreateApiKey/index.js";
2
- export { ApiKeyAfterDeleteHandler, ApiKeyBeforeDeleteHandler, DeleteApiKeyUseCase } from "../../../features/security/apiKeys/DeleteApiKey/index.js";
3
- export { GetApiKeyUseCase } from "../../../features/security/apiKeys/GetApiKey/index.js";
4
- export { GetApiKeyByTokenUseCase } from "../../../features/security/apiKeys/GetApiKeyByToken/index.js";
5
- export { ListApiKeysUseCase } from "../../../features/security/apiKeys/ListApiKeys/index.js";
6
- export { ApiKeyAfterUpdateHandler, ApiKeyBeforeUpdateHandler, UpdateApiKeyUseCase } from "../../../features/security/apiKeys/UpdateApiKey/index.js";
7
- export { ApiKeyFactory } from "../../../features/security/apiKeys/shared/abstractions.js";
8
-
9
- //# sourceMappingURL=apiKey.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["ApiKeyAfterCreateHandler","ApiKeyBeforeCreateHandler","CreateApiKeyUseCase","ApiKeyAfterDeleteHandler","ApiKeyBeforeDeleteHandler","DeleteApiKeyUseCase","GetApiKeyUseCase","GetApiKeyByTokenUseCase","ListApiKeysUseCase","ApiKeyAfterUpdateHandler","ApiKeyBeforeUpdateHandler","UpdateApiKeyUseCase","ApiKeyFactory"],"sources":["apiKey.ts"],"sourcesContent":["export {\n ApiKeyAfterCreateHandler,\n ApiKeyBeforeCreateHandler,\n CreateApiKeyUseCase\n} from \"~/features/security/apiKeys/CreateApiKey/index.js\";\n\nexport {\n ApiKeyAfterDeleteHandler,\n ApiKeyBeforeDeleteHandler,\n DeleteApiKeyUseCase\n} from \"~/features/security/apiKeys/DeleteApiKey/index.js\";\n\nexport { GetApiKeyUseCase } from \"~/features/security/apiKeys/GetApiKey/index.js\";\nexport { GetApiKeyByTokenUseCase } from \"~/features/security/apiKeys/GetApiKeyByToken/index.js\";\nexport { ListApiKeysUseCase } from \"~/features/security/apiKeys/ListApiKeys/index.js\";\nexport {\n ApiKeyAfterUpdateHandler,\n ApiKeyBeforeUpdateHandler,\n UpdateApiKeyUseCase\n} from \"~/features/security/apiKeys/UpdateApiKey/index.js\";\nexport { ApiKeyFactory } from \"~/features/security/apiKeys/shared/abstractions.js\";\n"],"mappings":"AAAA,SACIA,wBAAwB,EACxBC,yBAAyB,EACzBC,mBAAmB;AAGvB,SACIC,wBAAwB,EACxBC,yBAAyB,EACzBC,mBAAmB;AAGvB,SAASC,gBAAgB;AACzB,SAASC,uBAAuB;AAChC,SAASC,kBAAkB;AAC3B,SACIC,wBAAwB,EACxBC,yBAAyB,EACzBC,mBAAmB;AAEvB,SAASC,aAAa","ignoreList":[]}
@@ -1,11 +0,0 @@
1
- import { z } from "zod";
2
- export declare const BuildParam: import("@webiny/project/defineExtension").ExtensionComponent<z.ZodObject<{
3
- paramName: z.ZodString;
4
- value: z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>, z.ZodArray<z.ZodAny, "many">, z.ZodNumber, z.ZodBoolean]>;
5
- }, "strip", z.ZodTypeAny, {
6
- value: string | number | boolean | any[] | Record<string, any>;
7
- paramName: string;
8
- }, {
9
- value: string | number | boolean | any[] | Record<string, any>;
10
- paramName: string;
11
- }>>;
@@ -1,119 +0,0 @@
1
- import { z } from "zod";
2
- import { Node, Project } from "ts-morph";
3
- import { defineExtension } from "@webiny/project/defineExtension";
4
- import crypto from "crypto";
5
- import path from "path";
6
- import fs from "fs";
7
- export const BuildParam = defineExtension({
8
- type: "Api/BuildParam",
9
- tags: {
10
- runtimeContext: "app-build",
11
- appName: "api"
12
- },
13
- description: "Add build-time parameter to API app.",
14
- multiple: true,
15
- paramsSchema: () => {
16
- return z.object({
17
- paramName: z.string(),
18
- value: z.union([z.string(), z.record(z.any()), z.array(z.any()), z.number(), z.boolean()])
19
- });
20
- },
21
- async build(params, ctx) {
22
- const extensionsTsFilePath = ctx.project.paths.workspaceFolder.join("apps", "api", "graphql", "src", "extensions.ts").toString();
23
- const buildParamsDir = ctx.project.paths.workspaceFolder.join("apps", "api", "graphql", "src", "buildParams").toString();
24
- const {
25
- paramName,
26
- value
27
- } = params;
28
-
29
- // Serialize value to a TypeScript literal.
30
- const valueStr = JSON.stringify(value, null, 4);
31
-
32
- // Generate a unique class name based on the paramName.
33
- const hash = crypto.createHash("sha256").update(paramName).digest("hex");
34
- const className = `BuildParam_${hash.slice(-10)}`;
35
- const fileName = `${className}.ts`;
36
- const filePath = path.join(buildParamsDir, fileName);
37
-
38
- // Ensure buildParams directory exists.
39
- if (!fs.existsSync(buildParamsDir)) {
40
- fs.mkdirSync(buildParamsDir, {
41
- recursive: true
42
- });
43
- }
44
-
45
- // Check if file already exists.
46
- if (fs.existsSync(filePath)) {
47
- // File exists, just ensure it's imported in extensions.ts
48
- } else {
49
- // Create the BuildParam implementation file.
50
- const fileContent = `import { BuildParam } from "webiny/api/buildParams";
51
-
52
- class ${className} implements BuildParam.Interface {
53
- key = "${paramName}";
54
- value = ${valueStr};
55
- }
56
-
57
- export default BuildParam.createImplementation({
58
- implementation: ${className},
59
- dependencies: []
60
- });
61
- `;
62
- fs.writeFileSync(filePath, fileContent, "utf8");
63
- }
64
-
65
- // Now update extensions.ts to import and register this BuildParam.
66
- const project = new Project();
67
- project.addSourceFileAtPath(extensionsTsFilePath);
68
- const source = project.getSourceFileOrThrow(extensionsTsFilePath);
69
-
70
- // Calculate import path relative to extensions.ts.
71
- let importPath = path.relative(path.dirname(extensionsTsFilePath), filePath).replace(/\.tsx?$/, ".js");
72
-
73
- // Ensure the path starts with ./
74
- if (!importPath.startsWith(".")) {
75
- importPath = "./" + importPath;
76
- }
77
-
78
- // Check if import already exists.
79
- const existingImportDeclaration = source.getImportDeclaration(importPath);
80
- if (existingImportDeclaration) {
81
- return;
82
- }
83
- let index = 1;
84
- const importDeclarations = source.getImportDeclarations();
85
- if (importDeclarations.length) {
86
- const last = importDeclarations[importDeclarations.length - 1];
87
- index = last.getChildIndex() + 1;
88
- }
89
-
90
- // Add import for the BuildParam implementation.
91
- source.insertImportDeclaration(index, {
92
- defaultImport: className,
93
- moduleSpecifier: importPath
94
- });
95
-
96
- // Add the registration to the plugins array.
97
- const pluginsArray = source.getFirstDescendant(node => Node.isArrayLiteralExpression(node));
98
- pluginsArray.addElement(`\ncreateContextPlugin(ctx => {\n\tregisterExtension(ctx.container, ${className});\n})`);
99
- {
100
- let index = 1;
101
- const importDeclarations = source.getImportDeclarations();
102
- if (importDeclarations.length) {
103
- const last = importDeclarations[importDeclarations.length - 1];
104
- index = last.getChildIndex() + 1;
105
- }
106
- const contextPluginImportPath = "@webiny/api/plugins/ContextPlugin";
107
- const existingContextPluginImport = source.getImportDeclaration(contextPluginImportPath);
108
- if (!existingContextPluginImport) {
109
- source.insertImportDeclaration(index, {
110
- namedImports: ["createContextPlugin"],
111
- moduleSpecifier: contextPluginImportPath
112
- });
113
- }
114
- }
115
- await source.save();
116
- }
117
- });
118
-
119
- //# sourceMappingURL=BuildParam.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["z","Node","Project","defineExtension","crypto","path","fs","BuildParam","type","tags","runtimeContext","appName","description","multiple","paramsSchema","object","paramName","string","value","union","record","any","array","number","boolean","build","params","ctx","extensionsTsFilePath","project","paths","workspaceFolder","join","toString","buildParamsDir","valueStr","JSON","stringify","hash","createHash","update","digest","className","slice","fileName","filePath","existsSync","mkdirSync","recursive","fileContent","writeFileSync","addSourceFileAtPath","source","getSourceFileOrThrow","importPath","relative","dirname","replace","startsWith","existingImportDeclaration","getImportDeclaration","index","importDeclarations","getImportDeclarations","length","last","getChildIndex","insertImportDeclaration","defaultImport","moduleSpecifier","pluginsArray","getFirstDescendant","node","isArrayLiteralExpression","addElement","contextPluginImportPath","existingContextPluginImport","namedImports","save"],"sources":["BuildParam.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { Node, Project, ArrayLiteralExpression } from \"ts-morph\";\nimport { defineExtension } from \"@webiny/project/defineExtension\";\nimport crypto from \"crypto\";\nimport path from \"path\";\nimport fs from \"fs\";\n\nexport const BuildParam = defineExtension({\n type: \"Api/BuildParam\",\n tags: { runtimeContext: \"app-build\", appName: \"api\" },\n description: \"Add build-time parameter to API app.\",\n multiple: true,\n paramsSchema: () => {\n return z.object({\n paramName: z.string(),\n value: z.union([\n z.string(),\n z.record(z.any()),\n z.array(z.any()),\n z.number(),\n z.boolean()\n ])\n });\n },\n async build(params, ctx) {\n const extensionsTsFilePath = ctx.project.paths.workspaceFolder\n .join(\"apps\", \"api\", \"graphql\", \"src\", \"extensions.ts\")\n .toString();\n\n const buildParamsDir = ctx.project.paths.workspaceFolder\n .join(\"apps\", \"api\", \"graphql\", \"src\", \"buildParams\")\n .toString();\n\n const { paramName, value } = params;\n\n // Serialize value to a TypeScript literal.\n const valueStr = JSON.stringify(value, null, 4);\n\n // Generate a unique class name based on the paramName.\n const hash = crypto.createHash(\"sha256\").update(paramName).digest(\"hex\");\n const className = `BuildParam_${hash.slice(-10)}`;\n const fileName = `${className}.ts`;\n const filePath = path.join(buildParamsDir, fileName);\n\n // Ensure buildParams directory exists.\n if (!fs.existsSync(buildParamsDir)) {\n fs.mkdirSync(buildParamsDir, { recursive: true });\n }\n\n // Check if file already exists.\n if (fs.existsSync(filePath)) {\n // File exists, just ensure it's imported in extensions.ts\n } else {\n // Create the BuildParam implementation file.\n const fileContent = `import { BuildParam } from \"webiny/api/buildParams\";\n\nclass ${className} implements BuildParam.Interface {\n key = \"${paramName}\";\n value = ${valueStr};\n}\n\nexport default BuildParam.createImplementation({\n implementation: ${className},\n dependencies: []\n});\n`;\n fs.writeFileSync(filePath, fileContent, \"utf8\");\n }\n\n // Now update extensions.ts to import and register this BuildParam.\n const project = new Project();\n project.addSourceFileAtPath(extensionsTsFilePath);\n\n const source = project.getSourceFileOrThrow(extensionsTsFilePath);\n\n // Calculate import path relative to extensions.ts.\n let importPath = path\n .relative(path.dirname(extensionsTsFilePath), filePath)\n .replace(/\\.tsx?$/, \".js\");\n\n // Ensure the path starts with ./\n if (!importPath.startsWith(\".\")) {\n importPath = \"./\" + importPath;\n }\n\n // Check if import already exists.\n const existingImportDeclaration = source.getImportDeclaration(importPath);\n if (existingImportDeclaration) {\n return;\n }\n\n let index = 1;\n\n const importDeclarations = source.getImportDeclarations();\n if (importDeclarations.length) {\n const last = importDeclarations[importDeclarations.length - 1];\n index = last.getChildIndex() + 1;\n }\n\n // Add import for the BuildParam implementation.\n source.insertImportDeclaration(index, {\n defaultImport: className,\n moduleSpecifier: importPath\n });\n\n // Add the registration to the plugins array.\n const pluginsArray = source.getFirstDescendant(node =>\n Node.isArrayLiteralExpression(node)\n ) as ArrayLiteralExpression;\n\n pluginsArray.addElement(\n `\\ncreateContextPlugin(ctx => {\\n\\tregisterExtension(ctx.container, ${className});\\n})`\n );\n\n {\n let index = 1;\n\n const importDeclarations = source.getImportDeclarations();\n if (importDeclarations.length) {\n const last = importDeclarations[importDeclarations.length - 1];\n index = last.getChildIndex() + 1;\n }\n\n const contextPluginImportPath = \"@webiny/api/plugins/ContextPlugin\";\n const existingContextPluginImport =\n source.getImportDeclaration(contextPluginImportPath);\n if (!existingContextPluginImport) {\n source.insertImportDeclaration(index, {\n namedImports: [\"createContextPlugin\"],\n moduleSpecifier: contextPluginImportPath\n });\n }\n }\n\n await source.save();\n }\n});\n"],"mappings":"AAAA,SAASA,CAAC,QAAQ,KAAK;AACvB,SAASC,IAAI,EAAEC,OAAO,QAAgC,UAAU;AAChE,SAASC,eAAe,QAAQ,iCAAiC;AACjE,OAAOC,MAAM,MAAM,QAAQ;AAC3B,OAAOC,IAAI,MAAM,MAAM;AACvB,OAAOC,EAAE,MAAM,IAAI;AAEnB,OAAO,MAAMC,UAAU,GAAGJ,eAAe,CAAC;EACtCK,IAAI,EAAE,gBAAgB;EACtBC,IAAI,EAAE;IAAEC,cAAc,EAAE,WAAW;IAAEC,OAAO,EAAE;EAAM,CAAC;EACrDC,WAAW,EAAE,sCAAsC;EACnDC,QAAQ,EAAE,IAAI;EACdC,YAAY,EAAEA,CAAA,KAAM;IAChB,OAAOd,CAAC,CAACe,MAAM,CAAC;MACZC,SAAS,EAAEhB,CAAC,CAACiB,MAAM,CAAC,CAAC;MACrBC,KAAK,EAAElB,CAAC,CAACmB,KAAK,CAAC,CACXnB,CAAC,CAACiB,MAAM,CAAC,CAAC,EACVjB,CAAC,CAACoB,MAAM,CAACpB,CAAC,CAACqB,GAAG,CAAC,CAAC,CAAC,EACjBrB,CAAC,CAACsB,KAAK,CAACtB,CAAC,CAACqB,GAAG,CAAC,CAAC,CAAC,EAChBrB,CAAC,CAACuB,MAAM,CAAC,CAAC,EACVvB,CAAC,CAACwB,OAAO,CAAC,CAAC,CACd;IACL,CAAC,CAAC;EACN,CAAC;EACD,MAAMC,KAAKA,CAACC,MA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AA2B;IAE3BF,YAAY,CAACI,UAAU,CACnB,sEAAsEhC,SAAS,QACnF,CAAC;IAED;MACI,IAAImB,KAAK,GAAG,CAAC;MAEb,MAAMC,kBAAkB,GAAGV,MAAM,CAACW,qBAAqB,CAAC,CAAC;MACzD,IAAID,kBAAkB,CAACE,MAAM,EAAE;QAC3B,MAAMC,IAAI,GAAGH,kBAAkB,CAACA,kBAAkB,CAACE,MAAM,GAAG,CAAC,CAAC;QAC9DH,KAAK,GAAGI,IAAI,CAACC,aAAa,CAAC,CAAC,GAAG,CAAC;MACpC;MAEA,MAAMS,uBAAuB,GAAG,mCAAmC;MACnE,MAAMC,2BAA2B,GAC7BxB,MAAM,CAACQ,oBAAoB,CAACe,uBAAuB,CAAC;MACxD,IAAI,CAACC,2BAA2B,EAAE;QAC9BxB,MAAM,CAACe,uBAAuB,CAACN,KAAK,EAAE;UAClCgB,YAAY,EAAE,CAAC,qBAAqB,CAAC;UACrCR,eAAe,EAAEM;QACrB,CAAC,CAAC;MACN;IACJ;IAEA,MAAMvB,MAAM,CAAC0B,IAAI,CAAC,CAAC;EACvB;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -1,10 +0,0 @@
1
- export declare const GenericExtension: import("@webiny/project/defineExtension").ExtensionComponent<import("zod").ZodObject<{
2
- src: import("zod").ZodEffects<import("zod").ZodEffects<import("zod").ZodString, string, string>, string, string>;
3
- exportName: import("zod").ZodOptional<import("zod").ZodString>;
4
- }, "strip", import("zod").ZodTypeAny, {
5
- src: string;
6
- exportName?: string | undefined;
7
- }, {
8
- src: string;
9
- exportName?: string | undefined;
10
- }>>;
@@ -1,7 +0,0 @@
1
- import { defineApiExtension } from "@webiny/project/defineExtension";
2
- export const GenericExtension = defineApiExtension({
3
- type: "Api/Extension",
4
- description: "Add any API extension."
5
- });
6
-
7
- //# sourceMappingURL=GenericExtension.js.map