@webiny/api-core 6.4.5-beta.0 → 6.6.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (198) hide show
  1. package/ApiCoreFeature.d.ts +2 -2
  2. package/ApiCoreFeature.js +23 -5
  3. package/ApiCoreFeature.js.map +1 -1
  4. package/exports/api.d.ts +2 -1
  5. package/exports/api.js +2 -1
  6. package/features/ai/feature.js +4 -0
  7. package/features/ai/feature.js.map +1 -1
  8. package/features/ai/index.d.ts +2 -0
  9. package/features/ai/index.js +1 -0
  10. package/features/ai/toolPipeline/AiOutputToolRegistry.d.ts +11 -0
  11. package/features/ai/toolPipeline/AiOutputToolRegistry.js +31 -0
  12. package/features/ai/toolPipeline/AiOutputToolRegistry.js.map +1 -0
  13. package/features/ai/toolPipeline/AiToolPipelineRunner.d.ts +10 -0
  14. package/features/ai/toolPipeline/AiToolPipelineRunner.js +36 -0
  15. package/features/ai/toolPipeline/AiToolPipelineRunner.js.map +1 -0
  16. package/features/ai/toolPipeline/abstractions.d.ts +23 -0
  17. package/features/ai/toolPipeline/abstractions.js +7 -0
  18. package/features/ai/toolPipeline/abstractions.js.map +1 -0
  19. package/features/ai/toolPipeline/index.d.ts +2 -0
  20. package/features/ai/toolPipeline/index.js +1 -0
  21. package/features/hashing/ScryptHasher.d.ts +11 -0
  22. package/features/hashing/ScryptHasher.js +74 -0
  23. package/features/hashing/ScryptHasher.js.map +1 -0
  24. package/features/hashing/abstractions.d.ts +18 -0
  25. package/features/hashing/abstractions.js +5 -0
  26. package/features/hashing/abstractions.js.map +1 -0
  27. package/features/hashing/feature.d.ts +4 -0
  28. package/features/hashing/feature.js +11 -0
  29. package/features/hashing/feature.js.map +1 -0
  30. package/features/hashing/index.d.ts +2 -0
  31. package/features/hashing/index.js +1 -0
  32. package/features/requestContext/RawAuthToken.d.ts +14 -0
  33. package/features/requestContext/RawAuthToken.js +19 -0
  34. package/features/requestContext/RawAuthToken.js.map +1 -0
  35. package/features/requestContext/RawTenantId.d.ts +14 -0
  36. package/features/requestContext/RawTenantId.js +19 -0
  37. package/features/requestContext/RawTenantId.js.map +1 -0
  38. package/features/requestContext/RequestIdentityLoader.d.ts +19 -0
  39. package/features/requestContext/RequestIdentityLoader.js +26 -0
  40. package/features/requestContext/RequestIdentityLoader.js.map +1 -0
  41. package/features/requestContext/RequestTenantLoader.d.ts +18 -0
  42. package/features/requestContext/RequestTenantLoader.js +52 -0
  43. package/features/requestContext/RequestTenantLoader.js.map +1 -0
  44. package/features/requestContext/abstractions.d.ts +53 -0
  45. package/features/requestContext/abstractions.js +8 -0
  46. package/features/requestContext/abstractions.js.map +1 -0
  47. package/features/requestContext/feature.d.ts +11 -0
  48. package/features/requestContext/feature.js +17 -0
  49. package/features/requestContext/feature.js.map +1 -0
  50. package/features/requestContext/index.d.ts +2 -0
  51. package/features/requestContext/index.js +2 -0
  52. package/features/security/apiKeys/ApiKeyAuthenticator.d.ts +14 -0
  53. package/features/security/apiKeys/ApiKeyAuthenticator.js +36 -0
  54. package/features/security/apiKeys/ApiKeyAuthenticator.js.map +1 -0
  55. package/features/security/apiKeys/ApiKeyAuthorizer.d.ts +10 -0
  56. package/features/security/apiKeys/ApiKeyAuthorizer.js +15 -0
  57. package/features/security/apiKeys/ApiKeyAuthorizer.js.map +1 -0
  58. package/features/security/apiKeys/feature.js +4 -0
  59. package/features/security/apiKeys/feature.js.map +1 -1
  60. package/features/security/authorization/GroupsTeamsAuthorizer/GetPermissionsFromIdentity.d.ts +1 -1
  61. package/features/security/utils/getPermissionsFromRoles.d.ts +1 -1
  62. package/features/serviceDiscovery/ServiceDiscovery.d.ts +17 -0
  63. package/features/serviceDiscovery/ServiceDiscovery.js +22 -0
  64. package/features/serviceDiscovery/ServiceDiscovery.js.map +1 -0
  65. package/features/serviceDiscovery/__tests__/ServiceDiscovery.test.d.ts +1 -0
  66. package/features/serviceDiscovery/__tests__/ServiceDiscovery.test.js +111 -0
  67. package/features/serviceDiscovery/__tests__/ServiceDiscovery.test.js.map +1 -0
  68. package/features/serviceDiscovery/index.d.ts +3 -0
  69. package/features/serviceDiscovery/index.js +1 -0
  70. package/features/storageOperations/abstractions.d.ts +21 -0
  71. package/features/storageOperations/abstractions.js +10 -0
  72. package/features/storageOperations/abstractions.js.map +1 -0
  73. package/features/tenancy/CreateTenant/CreateTenantUseCase.d.ts +1 -1
  74. package/features/tenancy/InstallTenant/InstallTenantUseCase.d.ts +1 -1
  75. package/features/tenancy/UpdateTenant/UpdateTenantUseCase.d.ts +2 -2
  76. package/features/users/CreateUser/decorators/CreateUserWithWcpIncrement.d.ts +1 -1
  77. package/features/wcp/WcpContext/WcpContext.d.ts +4 -5
  78. package/features/wcp/WcpContext/WcpContext.js +5 -2
  79. package/features/wcp/WcpContext/WcpContext.js.map +1 -1
  80. package/features/wcp/WcpContext/decorators/WcpContextWithFeatureFlagsDecorator.d.ts +8 -8
  81. package/features/wcp/WcpContext/feature.d.ts +1 -2
  82. package/features/wcp/WcpContext/feature.js +2 -2
  83. package/features/wcp/WcpContext/feature.js.map +1 -1
  84. package/features/wcp/WcpContext/index.d.ts +0 -1
  85. package/features/wcp/WcpContext/types.d.ts +0 -4
  86. package/features/wcp/WcpFeature.d.ts +1 -1
  87. package/features/wcp/WcpFeature.js +5 -2
  88. package/features/wcp/WcpFeature.js.map +1 -1
  89. package/features/wcp/WcpLicenseProvider.d.ts +29 -0
  90. package/features/wcp/WcpLicenseProvider.js +18 -0
  91. package/features/wcp/WcpLicenseProvider.js.map +1 -0
  92. package/features/wcp/loadWcpLicense.d.ts +2 -0
  93. package/{legacy/wcp/context.js → features/wcp/loadWcpLicense.js} +24 -19
  94. package/features/wcp/loadWcpLicense.js.map +1 -0
  95. package/graphql/ApiCoreSchemaFactory.d.ts +15 -0
  96. package/graphql/ApiCoreSchemaFactory.js +52 -0
  97. package/graphql/ApiCoreSchemaFactory.js.map +1 -0
  98. package/graphql/security/NotAuthorizedResponse.d.ts +1 -1
  99. package/graphql/security/NotAuthorizedResponse.js +1 -1
  100. package/graphql/security/NotAuthorizedResponse.js.map +1 -1
  101. package/graphql/security/SecuritySchemaFactory.d.ts +14 -0
  102. package/graphql/security/SecuritySchemaFactory.js +23 -0
  103. package/graphql/security/SecuritySchemaFactory.js.map +1 -0
  104. package/graphql/security/addApiKeySchema.d.ts +2 -0
  105. package/graphql/security/{apiKey.gql.js → addApiKeySchema.js} +45 -27
  106. package/graphql/security/addApiKeySchema.js.map +1 -0
  107. package/graphql/security/addIdentitySchema.d.ts +2 -0
  108. package/graphql/security/{identity.gql.js → addIdentitySchema.js} +52 -35
  109. package/graphql/security/addIdentitySchema.js.map +1 -0
  110. package/graphql/security/addRoleSchema.d.ts +2 -0
  111. package/graphql/security/addRoleSchema.js +137 -0
  112. package/graphql/security/addRoleSchema.js.map +1 -0
  113. package/graphql/security/addSecurityBaseSchema.d.ts +2 -0
  114. package/graphql/security/{base.gql.js → addSecurityBaseSchema.js} +14 -16
  115. package/graphql/security/addSecurityBaseSchema.js.map +1 -0
  116. package/graphql/security/addTeamSchema.d.ts +2 -0
  117. package/graphql/security/addTeamSchema.js +157 -0
  118. package/graphql/security/addTeamSchema.js.map +1 -0
  119. package/graphql/system/SystemSchemaFactory.d.ts +9 -0
  120. package/graphql/system/SystemSchemaFactory.js +66 -0
  121. package/graphql/system/SystemSchemaFactory.js.map +1 -0
  122. package/graphql/users/UsersSchemaFactory.d.ts +9 -0
  123. package/graphql/users/UsersSchemaFactory.js +191 -0
  124. package/graphql/users/UsersSchemaFactory.js.map +1 -0
  125. package/graphql/wcp/WcpSchemaFactory.d.ts +9 -0
  126. package/graphql/wcp/{graphql.js → WcpSchemaFactory.js} +26 -18
  127. package/graphql/wcp/WcpSchemaFactory.js.map +1 -0
  128. package/index.d.ts +3 -1
  129. package/index.js +3 -1
  130. package/package.json +19 -22
  131. package/types/core.d.ts +17 -5
  132. package/types/security.d.ts +0 -6
  133. package/types/tenancy.d.ts +0 -17
  134. package/types/users.d.ts +0 -13
  135. package/createApiCore.d.ts +0 -7
  136. package/createApiCore.js +0 -22
  137. package/createApiCore.js.map +0 -1
  138. package/graphql/security/apiKey.gql.d.ts +0 -4
  139. package/graphql/security/apiKey.gql.js.map +0 -1
  140. package/graphql/security/base.gql.d.ts +0 -4
  141. package/graphql/security/base.gql.js.map +0 -1
  142. package/graphql/security/identity.gql.d.ts +0 -4
  143. package/graphql/security/identity.gql.js.map +0 -1
  144. package/graphql/security/index.d.ts +0 -1
  145. package/graphql/security/index.js +0 -15
  146. package/graphql/security/index.js.map +0 -1
  147. package/graphql/security/role.gql.d.ts +0 -4
  148. package/graphql/security/role.gql.js +0 -106
  149. package/graphql/security/role.gql.js.map +0 -1
  150. package/graphql/security/team.gql.d.ts +0 -4
  151. package/graphql/security/team.gql.js +0 -119
  152. package/graphql/security/team.gql.js.map +0 -1
  153. package/graphql/system/createSystemGraphQL.d.ts +0 -2
  154. package/graphql/system/createSystemGraphQL.js +0 -54
  155. package/graphql/system/createSystemGraphQL.js.map +0 -1
  156. package/graphql/users/user.gql.d.ts +0 -3
  157. package/graphql/users/user.gql.js +0 -167
  158. package/graphql/users/user.gql.js.map +0 -1
  159. package/graphql/wcp/graphql.d.ts +0 -2
  160. package/graphql/wcp/graphql.js.map +0 -1
  161. package/legacy/security/LegacyContext.d.ts +0 -36
  162. package/legacy/security/LegacyContext.js +0 -152
  163. package/legacy/security/LegacyContext.js.map +0 -1
  164. package/legacy/security/createSecurityContext.d.ts +0 -3
  165. package/legacy/security/createSecurityContext.js +0 -10
  166. package/legacy/security/createSecurityContext.js.map +0 -1
  167. package/legacy/security/plugins/apiKeyAuthentication.d.ts +0 -7
  168. package/legacy/security/plugins/apiKeyAuthentication.js +0 -20
  169. package/legacy/security/plugins/apiKeyAuthentication.js.map +0 -1
  170. package/legacy/security/plugins/apiKeyAuthorization.d.ts +0 -6
  171. package/legacy/security/plugins/apiKeyAuthorization.js +0 -13
  172. package/legacy/security/plugins/apiKeyAuthorization.js.map +0 -1
  173. package/legacy/security/plugins/authenticateUsingCookie.d.ts +0 -5
  174. package/legacy/security/plugins/authenticateUsingCookie.js +0 -23
  175. package/legacy/security/plugins/authenticateUsingCookie.js.map +0 -1
  176. package/legacy/security/plugins/authenticateUsingHttpHeader.d.ts +0 -5
  177. package/legacy/security/plugins/authenticateUsingHttpHeader.js +0 -20
  178. package/legacy/security/plugins/authenticateUsingHttpHeader.js.map +0 -1
  179. package/legacy/security/plugins/secureHeaders.d.ts +0 -1
  180. package/legacy/security/plugins/secureHeaders.js +0 -30
  181. package/legacy/security/plugins/secureHeaders.js.map +0 -1
  182. package/legacy/tenancy/LegacyContext.d.ts +0 -15
  183. package/legacy/tenancy/LegacyContext.js +0 -57
  184. package/legacy/tenancy/LegacyContext.js.map +0 -1
  185. package/legacy/tenancy/createTenancyContext.d.ts +0 -3
  186. package/legacy/tenancy/createTenancyContext.js +0 -31
  187. package/legacy/tenancy/createTenancyContext.js.map +0 -1
  188. package/legacy/users/LegacyContext.d.ts +0 -13
  189. package/legacy/users/LegacyContext.js +0 -55
  190. package/legacy/users/LegacyContext.js.map +0 -1
  191. package/legacy/users/createAdminUsersContext.d.ts +0 -3
  192. package/legacy/users/createAdminUsersContext.js +0 -12
  193. package/legacy/users/createAdminUsersContext.js.map +0 -1
  194. package/legacy/wcp/LegacyWcpContext.d.ts +0 -33
  195. package/legacy/wcp/LegacyWcpContext.js +0 -84
  196. package/legacy/wcp/LegacyWcpContext.js.map +0 -1
  197. package/legacy/wcp/context.d.ts +0 -5
  198. package/legacy/wcp/context.js.map +0 -1
@@ -0,0 +1,191 @@
1
+ import { CoreGraphQLSchemaFactory } from "@webiny/api-graphql/graphql/abstractions.js";
2
+ import { ErrorResponse, ListErrorResponse, ListResponse, NotFoundResponse, Response } from "@webiny/api-graphql/responses.js";
3
+ import { GetUserUseCase } from "../../features/users/GetUser/index.js";
4
+ import NotAuthorizedResponse from "../security/NotAuthorizedResponse.js";
5
+ import { ListUsersUseCase } from "../../features/users/ListUsers/index.js";
6
+ import { IdentityContext } from "../../features/security/IdentityContext/abstractions.js";
7
+ import { ListRolesUseCase } from "../../features/security/roles/ListRoles/index.js";
8
+ import { ListTeamsUseCase } from "../../features/security/teams/ListTeams/index.js";
9
+ class UsersSchemaFactoryImpl {
10
+ async execute(builder) {
11
+ builder.addTypeDefs(`
12
+ type AdminUsersQuery {
13
+ _empty: String
14
+ }
15
+
16
+ type AdminUsersMutation {
17
+ _empty: String
18
+ }
19
+
20
+ extend type Query {
21
+ adminUsers: AdminUsersQuery
22
+ }
23
+
24
+ extend type Mutation {
25
+ adminUsers: AdminUsersMutation
26
+ }
27
+
28
+ type AdminUsersCreatedBy {
29
+ id: ID
30
+ displayName: String
31
+ }
32
+
33
+ type AdminUsersError {
34
+ code: String
35
+ message: String
36
+ data: JSON
37
+ stack: String
38
+ }
39
+
40
+ type AdminUsersBooleanResponse {
41
+ data: Boolean
42
+ error: AdminUsersError
43
+ }
44
+
45
+ type AdminUser {
46
+ id: ID!
47
+ displayName: String!
48
+ email: String!
49
+
50
+ roles: [SecurityRole]
51
+ firstName: String
52
+ lastName: String
53
+ avatar: JSON
54
+ external: Boolean
55
+ createdOn: DateTime
56
+ }
57
+
58
+ type AdminUsersResponse {
59
+ data: AdminUser
60
+ error: AdminUsersError
61
+ }
62
+
63
+ type AdminUsersListResponse {
64
+ data: [AdminUser]
65
+ error: AdminUsersError
66
+ }
67
+
68
+ input AdminUsersGetUserWhereInput {
69
+ id: ID
70
+ email: String
71
+ }
72
+
73
+ extend type AdminUsersQuery {
74
+ getUser(where: AdminUsersGetUserWhereInput): AdminUsersResponse
75
+ getCurrentUser: AdminUsersResponse
76
+ listUsers: AdminUsersListResponse
77
+ }
78
+
79
+ extend type AdminUser {
80
+ teams: [SecurityTeam]
81
+ }
82
+ `);
83
+ builder.addResolver({
84
+ path: "Query.adminUsers",
85
+ resolver: ()=>async ()=>({})
86
+ });
87
+ builder.addResolver({
88
+ path: "Mutation.adminUsers",
89
+ resolver: ()=>async ()=>({})
90
+ });
91
+ builder.addResolver({
92
+ path: "AdminUser.roles",
93
+ dependencies: [
94
+ ListRolesUseCase
95
+ ],
96
+ resolver: (listRoles)=>async ({ parent })=>{
97
+ if (!parent.roles) return null;
98
+ const result = await listRoles.execute({
99
+ where: {
100
+ id_in: parent.roles
101
+ }
102
+ });
103
+ if (result.isFail()) throw result.error;
104
+ return result.value;
105
+ }
106
+ });
107
+ builder.addResolver({
108
+ path: "AdminUser.teams",
109
+ dependencies: [
110
+ ListTeamsUseCase
111
+ ],
112
+ resolver: (listTeams)=>async ({ parent })=>{
113
+ const hasTeams = Array.isArray(parent.teams) && parent.teams.length > 0;
114
+ if (!hasTeams) return [];
115
+ const result = await listTeams.execute({
116
+ where: {
117
+ id_in: parent.teams
118
+ }
119
+ });
120
+ if (result.isFail()) throw result.error;
121
+ return result.value;
122
+ }
123
+ });
124
+ builder.addResolver({
125
+ path: "AdminUsersQuery.getUser",
126
+ dependencies: [
127
+ GetUserUseCase
128
+ ],
129
+ resolver: (getUser)=>async ({ args })=>{
130
+ const { where } = args;
131
+ const userResult = await getUser.execute({
132
+ id: where.id,
133
+ email: where.email
134
+ });
135
+ if (userResult.isFail()) {
136
+ const error = userResult.error;
137
+ if ("AdminUser/NotFound" === error.code) return new NotFoundResponse(`User "${JSON.stringify(where)}" was not found!`);
138
+ return new ErrorResponse({
139
+ message: error.message,
140
+ code: error.code,
141
+ data: error.data
142
+ });
143
+ }
144
+ return new Response(userResult.value);
145
+ }
146
+ });
147
+ builder.addResolver({
148
+ path: "AdminUsersQuery.getCurrentUser",
149
+ dependencies: [
150
+ IdentityContext,
151
+ GetUserUseCase
152
+ ],
153
+ resolver: (identityContext, getUser)=>async ()=>{
154
+ const identity = identityContext.getIdentity();
155
+ if (!identity.isAdmin()) throw new NotAuthorizedResponse();
156
+ const userResponse = await identityContext.withoutAuthorization(async ()=>await getUser.execute({
157
+ id: identity.id
158
+ }));
159
+ if (userResponse.isFail()) {
160
+ const error = userResponse.error;
161
+ if ("AdminUser/NotFound" === error.code) return new NotFoundResponse(`User with ID ${identity.id} was not found!`);
162
+ return new ErrorResponse({
163
+ message: error.message,
164
+ code: error.code,
165
+ data: error.data
166
+ });
167
+ }
168
+ return new Response(userResponse.value);
169
+ }
170
+ });
171
+ builder.addResolver({
172
+ path: "AdminUsersQuery.listUsers",
173
+ dependencies: [
174
+ ListUsersUseCase
175
+ ],
176
+ resolver: (listUsers)=>async ()=>{
177
+ const users = await listUsers.execute();
178
+ if (users.isFail()) return new ListErrorResponse(users.error);
179
+ return new ListResponse(users.value);
180
+ }
181
+ });
182
+ return builder;
183
+ }
184
+ }
185
+ const UsersSchemaFactory = CoreGraphQLSchemaFactory.createImplementation({
186
+ implementation: UsersSchemaFactoryImpl,
187
+ dependencies: []
188
+ });
189
+ export { UsersSchemaFactory };
190
+
191
+ //# sourceMappingURL=UsersSchemaFactory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graphql/users/UsersSchemaFactory.js","sources":["../../../src/graphql/users/UsersSchemaFactory.ts"],"sourcesContent":["import { CoreGraphQLSchemaFactory } from \"@webiny/api-graphql/graphql/abstractions.js\";\nimport {\n ErrorResponse,\n ListErrorResponse,\n ListResponse,\n NotFoundResponse,\n Response\n} from \"@webiny/api-graphql/responses.js\";\nimport type { IGraphQLSchemaBuilder } from \"@webiny/api-graphql/features/GraphQLSchemaBuilder/abstractions.js\";\nimport type { AdminUser } from \"~/types/users.js\";\nimport { GetUserUseCase } from \"~/features/users/GetUser/index.js\";\nimport NotAuthorizedResponse from \"~/graphql/security/NotAuthorizedResponse.js\";\nimport { ListUsersUseCase } from \"~/features/users/ListUsers/index.js\";\nimport { IdentityContext } from \"~/features/security/IdentityContext/abstractions.js\";\nimport { ListRolesUseCase } from \"~/features/security/roles/ListRoles/index.js\";\nimport { ListTeamsUseCase } from \"~/features/security/teams/ListTeams/index.js\";\n\nclass UsersSchemaFactoryImpl implements CoreGraphQLSchemaFactory.Interface {\n async execute(builder: IGraphQLSchemaBuilder): Promise<IGraphQLSchemaBuilder> {\n builder.addTypeDefs(/* GraphQL */ `\n type AdminUsersQuery {\n _empty: String\n }\n\n type AdminUsersMutation {\n _empty: String\n }\n\n extend type Query {\n adminUsers: AdminUsersQuery\n }\n\n extend type Mutation {\n adminUsers: AdminUsersMutation\n }\n\n type AdminUsersCreatedBy {\n id: ID\n displayName: String\n }\n\n type AdminUsersError {\n code: String\n message: String\n data: JSON\n stack: String\n }\n\n type AdminUsersBooleanResponse {\n data: Boolean\n error: AdminUsersError\n }\n\n type AdminUser {\n id: ID!\n displayName: String!\n email: String!\n\n roles: [SecurityRole]\n firstName: String\n lastName: String\n avatar: JSON\n external: Boolean\n createdOn: DateTime\n }\n\n type AdminUsersResponse {\n data: AdminUser\n error: AdminUsersError\n }\n\n type AdminUsersListResponse {\n data: [AdminUser]\n error: AdminUsersError\n }\n\n input AdminUsersGetUserWhereInput {\n id: ID\n email: String\n }\n\n extend type AdminUsersQuery {\n getUser(where: AdminUsersGetUserWhereInput): AdminUsersResponse\n getCurrentUser: AdminUsersResponse\n listUsers: AdminUsersListResponse\n }\n\n extend type AdminUser {\n teams: [SecurityTeam]\n }\n `);\n\n builder.addResolver({\n path: \"Query.adminUsers\",\n resolver: () => async () => ({})\n });\n\n builder.addResolver({\n path: \"Mutation.adminUsers\",\n resolver: () => async () => ({})\n });\n\n builder.addResolver({\n path: \"AdminUser.roles\",\n dependencies: [ListRolesUseCase],\n resolver:\n (listRoles: ListRolesUseCase.Interface) =>\n async ({ parent }: { parent: AdminUser }) => {\n if (!parent.roles) {\n return null;\n }\n\n const result = await listRoles.execute({ where: { id_in: parent.roles } });\n if (result.isFail()) {\n throw result.error;\n }\n return result.value;\n }\n });\n\n builder.addResolver({\n path: \"AdminUser.teams\",\n dependencies: [ListTeamsUseCase],\n resolver:\n (listTeams: ListTeamsUseCase.Interface) =>\n async ({ parent }: { parent: AdminUser }) => {\n const hasTeams = Array.isArray(parent.teams) && parent.teams.length > 0;\n if (!hasTeams) {\n return [];\n }\n\n const result = await listTeams.execute({ where: { id_in: parent.teams } });\n if (result.isFail()) {\n throw result.error;\n }\n return result.value;\n }\n });\n\n builder.addResolver<{ where: any }>({\n path: \"AdminUsersQuery.getUser\",\n dependencies: [GetUserUseCase],\n resolver:\n (getUser: GetUserUseCase.Interface) =>\n async ({ args }) => {\n const { where } = args;\n const userResult = await getUser.execute({\n id: where.id,\n email: where.email\n });\n\n if (userResult.isFail()) {\n const error = userResult.error;\n if (error.code === \"AdminUser/NotFound\") {\n return new NotFoundResponse(\n `User \"${JSON.stringify(where)}\" was not found!`\n );\n }\n\n return new ErrorResponse({\n message: error.message,\n code: error.code,\n data: error.data\n });\n }\n\n return new Response(userResult.value);\n }\n });\n\n builder.addResolver({\n path: \"AdminUsersQuery.getCurrentUser\",\n dependencies: [IdentityContext, GetUserUseCase],\n resolver:\n (identityContext: IdentityContext.Interface, getUser: GetUserUseCase.Interface) =>\n async () => {\n const identity = identityContext.getIdentity();\n\n if (!identity.isAdmin()) {\n throw new NotAuthorizedResponse();\n }\n\n // Current user might not have permissions to execute `getUser` (this method can load any user in the system),\n // but loading your own user record should be allowed. For that reason, let's temporarily disable authorization.\n const userResponse = await identityContext.withoutAuthorization(async () => {\n // Get user record using the identity ID.\n return await getUser.execute({ id: identity.id });\n });\n\n if (userResponse.isFail()) {\n const error = userResponse.error;\n if (error.code === \"AdminUser/NotFound\") {\n return new NotFoundResponse(\n `User with ID ${identity.id} was not found!`\n );\n }\n\n return new ErrorResponse({\n message: error.message,\n code: error.code,\n data: error.data\n });\n }\n\n return new Response(userResponse.value);\n }\n });\n\n builder.addResolver({\n path: \"AdminUsersQuery.listUsers\",\n dependencies: [ListUsersUseCase],\n resolver: (listUsers: ListUsersUseCase.Interface) => async () => {\n const users = await listUsers.execute();\n\n if (users.isFail()) {\n return new ListErrorResponse(users.error);\n }\n\n return new ListResponse(users.value);\n }\n });\n\n return builder;\n }\n}\n\nexport const UsersSchemaFactory = CoreGraphQLSchemaFactory.createImplementation({\n implementation: UsersSchemaFactoryImpl,\n dependencies: []\n});\n"],"names":["UsersSchemaFactoryImpl","builder","ListRolesUseCase","listRoles","parent","result","ListTeamsUseCase","listTeams","hasTeams","Array","GetUserUseCase","getUser","args","where","userResult","error","NotFoundResponse","JSON","ErrorResponse","Response","IdentityContext","identityContext","identity","NotAuthorizedResponse","userResponse","ListUsersUseCase","listUsers","users","ListErrorResponse","ListResponse","UsersSchemaFactory","CoreGraphQLSchemaFactory"],"mappings":"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"}
@@ -0,0 +1,9 @@
1
+ import { CoreGraphQLSchemaFactory } from "@webiny/api-graphql/graphql/abstractions.js";
2
+ import type { IGraphQLSchemaBuilder } from "@webiny/api-graphql/features/GraphQLSchemaBuilder/abstractions.js";
3
+ declare class WcpSchemaFactoryImpl implements CoreGraphQLSchemaFactory.Interface {
4
+ execute(builder: IGraphQLSchemaBuilder): Promise<IGraphQLSchemaBuilder>;
5
+ }
6
+ export declare const WcpSchemaFactory: typeof WcpSchemaFactoryImpl & {
7
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-graphql/graphql/abstractions.core").ICoreGraphQLSchemaFactory>;
8
+ };
9
+ export {};
@@ -1,9 +1,9 @@
1
- import { GraphQLSchemaPlugin } from "@webiny/handler-graphql/plugins/index.js";
2
- import { ErrorResponse, Response } from "@webiny/handler-graphql/responses.js";
1
+ import { CoreGraphQLSchemaFactory } from "@webiny/api-graphql/graphql/abstractions.js";
2
+ import { ErrorResponse, Response } from "@webiny/api-graphql/responses.js";
3
3
  import { WcpContext } from "../../features/wcp/WcpContext/index.js";
4
- const emptyResolver = ()=>({});
5
- const createWcpGraphQL = ()=>new GraphQLSchemaPlugin({
6
- typeDefs: `
4
+ class WcpSchemaFactoryImpl {
5
+ async execute(builder) {
6
+ builder.addTypeDefs(`
7
7
  type WcpProjectPackageFeaturesFeature {
8
8
  enabled: Boolean
9
9
  options: JSON
@@ -57,15 +57,18 @@ const createWcpGraphQL = ()=>new GraphQLSchemaPlugin({
57
57
  extend type Mutation {
58
58
  wcp: WcpMutation
59
59
  }
60
- `,
61
- resolvers: {
62
- Query: {
63
- wcp: emptyResolver
64
- },
65
- WcpQuery: {
66
- getProject: async (_, __, context)=>{
60
+ `);
61
+ builder.addResolver({
62
+ path: "Query.wcp",
63
+ resolver: ()=>async ()=>({})
64
+ });
65
+ builder.addResolver({
66
+ path: "WcpQuery.getProject",
67
+ dependencies: [
68
+ WcpContext
69
+ ],
70
+ resolver: (wcpContext)=>async ()=>{
67
71
  try {
68
- const wcpContext = context.container.resolve(WcpContext);
69
72
  const project = wcpContext.getProjectWithFeatureFlags();
70
73
  if (!project) throw Error("Could not get project!");
71
74
  return new Response(project);
@@ -78,9 +81,14 @@ const createWcpGraphQL = ()=>new GraphQLSchemaPlugin({
78
81
  });
79
82
  }
80
83
  }
81
- }
82
- }
83
- });
84
- export { createWcpGraphQL };
84
+ });
85
+ return builder;
86
+ }
87
+ }
88
+ const WcpSchemaFactory = CoreGraphQLSchemaFactory.createImplementation({
89
+ implementation: WcpSchemaFactoryImpl,
90
+ dependencies: []
91
+ });
92
+ export { WcpSchemaFactory };
85
93
 
86
- //# sourceMappingURL=graphql.js.map
94
+ //# sourceMappingURL=WcpSchemaFactory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graphql/wcp/WcpSchemaFactory.js","sources":["../../../src/graphql/wcp/WcpSchemaFactory.ts"],"sourcesContent":["import { CoreGraphQLSchemaFactory } from \"@webiny/api-graphql/graphql/abstractions.js\";\nimport type { IGraphQLSchemaBuilder } from \"@webiny/api-graphql/features/GraphQLSchemaBuilder/abstractions.js\";\nimport { ErrorResponse, Response } from \"@webiny/api-graphql/responses.js\";\nimport { WcpContext } from \"~/features/wcp/WcpContext/index.js\";\n\nclass WcpSchemaFactoryImpl implements CoreGraphQLSchemaFactory.Interface {\n async execute(builder: IGraphQLSchemaBuilder): Promise<IGraphQLSchemaBuilder> {\n builder.addTypeDefs(/* GraphQL */ `\n type WcpProjectPackageFeaturesFeature {\n enabled: Boolean\n options: JSON\n }\n\n type WcpProjectPackageFeatures {\n seats: WcpProjectPackageFeaturesFeature\n multiTenancy: WcpProjectPackageFeaturesFeature\n advancedPublishingWorkflow: WcpProjectPackageFeaturesFeature\n advancedAccessControlLayer: WcpProjectPackageFeaturesFeature\n auditLogs: WcpProjectPackageFeaturesFeature\n recordLocking: WcpProjectPackageFeaturesFeature\n fileManager: WcpProjectPackageFeaturesFeature\n aiPowerups: WcpProjectPackageFeaturesFeature\n }\n\n type WcpProjectPackage {\n features: WcpProjectPackageFeatures\n }\n\n type WcpProject {\n orgId: ID\n projectId: ID\n package: WcpProjectPackage\n }\n\n type WcpError {\n code: String\n message: String\n data: JSON\n stack: String\n }\n\n type WcpProjectResponse {\n data: WcpProject\n error: WcpError\n }\n\n type WcpQuery {\n getProject: WcpProjectResponse\n }\n\n type WcpMutation {\n updateProject: WcpProjectResponse\n }\n\n extend type Query {\n wcp: WcpQuery\n }\n\n extend type Mutation {\n wcp: WcpMutation\n }\n `);\n\n builder.addResolver({\n path: \"Query.wcp\",\n resolver: () => async () => ({})\n });\n\n builder.addResolver({\n path: \"WcpQuery.getProject\",\n dependencies: [WcpContext],\n resolver: (wcpContext: WcpContext.Interface) => async () => {\n try {\n const project = wcpContext.getProjectWithFeatureFlags();\n\n if (!project) {\n throw Error(`Could not get project!`);\n }\n\n return new Response(project);\n } catch (e) {\n return new ErrorResponse({\n code: \"COULD_NOT_GET_PROJECT\",\n message: e.message,\n data: null,\n stack: e.stack\n });\n }\n }\n });\n\n return builder;\n }\n}\n\nexport const WcpSchemaFactory = CoreGraphQLSchemaFactory.createImplementation({\n implementation: WcpSchemaFactoryImpl,\n dependencies: []\n});\n"],"names":["WcpSchemaFactoryImpl","builder","WcpContext","wcpContext","project","Error","Response","e","ErrorResponse","WcpSchemaFactory","CoreGraphQLSchemaFactory"],"mappings":";;;AAKA,MAAMA;IACF,MAAM,QAAQC,OAA8B,EAAkC;QAC1EA,QAAQ,WAAW,CAAe,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAsDnC,CAAC;QAEDA,QAAQ,WAAW,CAAC;YAChB,MAAM;YACN,UAAU,IAAM,UAAa,EAAC;QAClC;QAEAA,QAAQ,WAAW,CAAC;YAChB,MAAM;YACN,cAAc;gBAACC;aAAW;YAC1B,UAAU,CAACC,aAAqC;oBAC5C,IAAI;wBACA,MAAMC,UAAUD,WAAW,0BAA0B;wBAErD,IAAI,CAACC,SACD,MAAMC,MAAM;wBAGhB,OAAO,IAAIC,SAASF;oBACxB,EAAE,OAAOG,GAAG;wBACR,OAAO,IAAIC,cAAc;4BACrB,MAAM;4BACN,SAASD,EAAE,OAAO;4BAClB,MAAM;4BACN,OAAOA,EAAE,KAAK;wBAClB;oBACJ;gBACJ;QACJ;QAEA,OAAON;IACX;AACJ;AAEO,MAAMQ,mBAAmBC,yBAAyB,oBAAoB,CAAC;IAC1E,gBAAgBV;IAChB,cAAc,EAAE;AACpB"}
package/index.d.ts CHANGED
@@ -1 +1,3 @@
1
- export { createApiCore } from "./createApiCore.js";
1
+ export { ApiCoreFeature } from "./ApiCoreFeature.js";
2
+ export { ApiCoreStorageOperationsFactory, registerApiCoreStorageOperations } from "./features/storageOperations/abstractions.js";
3
+ export { WcpLicenseProvider } from "./features/wcp/WcpLicenseProvider.js";
package/index.js CHANGED
@@ -1 +1,3 @@
1
- export { createApiCore } from "./createApiCore.js";
1
+ export { ApiCoreFeature } from "./ApiCoreFeature.js";
2
+ export { ApiCoreStorageOperationsFactory, registerApiCoreStorageOperations } from "./features/storageOperations/abstractions.js";
3
+ export { WcpLicenseProvider } from "./features/wcp/WcpLicenseProvider.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webiny/api-core",
3
- "version": "6.4.5-beta.0",
3
+ "version": "6.6.0-alpha.0",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -14,38 +14,35 @@
14
14
  "./*": "./*"
15
15
  },
16
16
  "dependencies": {
17
- "@ai-sdk/anthropic": "4.0.10",
18
- "@ai-sdk/openai": "4.0.9",
19
- "@webiny/api": "6.4.5-beta.0",
17
+ "@ai-sdk/anthropic": "4.0.23",
18
+ "@ai-sdk/openai": "4.0.22",
19
+ "@webiny/api": "6.6.0-alpha.0",
20
+ "@webiny/api-graphql": "6.6.0-alpha.0",
20
21
  "@webiny/di": "1.0.2",
21
- "@webiny/error": "6.4.5-beta.0",
22
- "@webiny/feature": "6.4.5-beta.0",
23
- "@webiny/feature-flags": "6.4.5-beta.0",
24
- "@webiny/handler": "6.4.5-beta.0",
25
- "@webiny/handler-db": "6.4.5-beta.0",
26
- "@webiny/handler-graphql": "6.4.5-beta.0",
27
- "@webiny/plugins": "6.4.5-beta.0",
28
- "@webiny/utils": "6.4.5-beta.0",
29
- "@webiny/wcp": "6.4.5-beta.0",
30
- "ai": "7.0.18",
22
+ "@webiny/error": "6.6.0-alpha.0",
23
+ "@webiny/feature": "6.6.0-alpha.0",
24
+ "@webiny/feature-flags": "6.6.0-alpha.0",
25
+ "@webiny/handler": "6.6.0-alpha.0",
26
+ "@webiny/utils": "6.6.0-alpha.0",
27
+ "@webiny/wcp": "6.6.0-alpha.0",
28
+ "ai": "7.0.40",
31
29
  "dataloader": "2.2.3",
32
- "jose": "6.2.3",
30
+ "graphql": "16.14.2",
31
+ "jose": "6.2.4",
33
32
  "jsonwebtoken": "9.0.3",
34
33
  "lodash": "4.18.1",
35
- "minimatch": "10.2.5",
34
+ "minimatch": "10.2.6",
36
35
  "pino": "10.3.1",
37
36
  "pino-lambda": "4.4.1",
38
37
  "zod": "4.4.3"
39
38
  },
40
39
  "devDependencies": {
41
40
  "@types/jsonwebtoken": "9.0.10",
42
- "@webiny/build-tools": "6.4.5-beta.0",
43
- "@webiny/db-dynamodb": "6.4.5-beta.0",
44
- "@webiny/handler-aws": "6.4.5-beta.0",
45
- "@webiny/project-utils": "6.4.5-beta.0",
46
- "jest-dynalite": "3.6.1",
41
+ "@webiny/build-tools": "6.6.0-alpha.0",
42
+ "@webiny/event-handler-core": "6.6.0-alpha.0",
43
+ "@webiny/project-utils": "6.6.0-alpha.0",
47
44
  "rimraf": "6.1.3",
48
- "typescript": "6.0.3",
45
+ "typescript": "7.0.2",
49
46
  "vitest": "4.1.10"
50
47
  },
51
48
  "publishConfig": {
package/types/core.d.ts CHANGED
@@ -1,13 +1,25 @@
1
1
  import { Context as BaseContext } from "@webiny/api/types.js";
2
- import type { SecurityContext, SecurityStorageOperations } from "../types/security.js";
3
- import type { TenancyContext, TenancyStorageOperations } from "../types/tenancy.js";
4
- import type { WcpContext } from "../features/wcp/WcpContext/types.js";
5
- import type { AdminUsersContext, AdminUsersStorageOperations } from "../types/users.js";
2
+ import type { SecurityStorageOperations } from "../types/security.js";
3
+ import type { TenancyStorageOperations } from "../types/tenancy.js";
4
+ import type { AdminUsersStorageOperations } from "../types/users.js";
6
5
  import { KeyValueStorageOperations } from "../features/keyValueStore/index.js";
7
- export type ApiCoreContext = BaseContext & SecurityContext & TenancyContext & WcpContext & AdminUsersContext;
6
+ import type { ILicense } from "@webiny/wcp/types.js";
7
+ /**
8
+ * The base handler context available to all api-core GraphQL resolvers and event handlers.
9
+ * Services are accessed via `context.container.resolve(...)`, not via context properties.
10
+ */
11
+ export type ApiCoreContext = BaseContext;
8
12
  export type ApiCoreStorageOperations = {
9
13
  usersStorageOperations: AdminUsersStorageOperations;
10
14
  tenancyStorageOperations: TenancyStorageOperations;
11
15
  securityStorageOperations: SecurityStorageOperations;
12
16
  keyValueStorageOperations: KeyValueStorageOperations.Interface;
13
17
  };
18
+ /**
19
+ * Config for `ApiCoreFeature.register` — runtime options only (e.g. the WCP license). Storage
20
+ * operations are no longer passed here; they are resolved from `ApiCoreStorageOperationsFactory`
21
+ * inside the feature (registered by a storage adapter or `registerApiCoreStorageOperations`).
22
+ */
23
+ export type ApiCoreConfig = {
24
+ wcpLicense?: ILicense;
25
+ };
@@ -1,5 +1,3 @@
1
- import type { TenancyContext } from "../types/tenancy.js";
2
- import type { LegacyContext } from "../legacy/security/LegacyContext.js";
3
1
  import { Identity } from "../features/security/IdentityContext/index.js";
4
2
  export type { Jwk, Jwt } from "../features/security/utils/verifyJwtUsingJwk.js";
5
3
  export type SecurityIdentity = Identity;
@@ -13,7 +11,6 @@ export interface GetTeamWhere {
13
11
  slug?: string;
14
12
  tenant?: string;
15
13
  }
16
- export type Security = LegacyContext;
17
14
  export interface SecurityStorageOperations {
18
15
  getRole(params: StorageOperationsGetRoleParams): Promise<Role | null>;
19
16
  listRoles(params: StorageOperationsListRolesParams): Promise<Role[]>;
@@ -36,9 +33,6 @@ export interface SecurityStorageOperations {
36
33
  export type SecurityPermission<T = Record<string, any>> = T & {
37
34
  name: string;
38
35
  };
39
- export interface SecurityContext extends TenancyContext {
40
- security: Security;
41
- }
42
36
  export interface FullAccessPermission {
43
37
  name: "*";
44
38
  }
@@ -1,6 +1,3 @@
1
- import { DbContext } from "@webiny/handler-db/types.js";
2
- import { Context as BaseContext } from "@webiny/handler/types.js";
3
- import { WcpContext } from "../features/wcp/WcpContext/index.js";
4
1
  export type TenantSettings = Record<string, any>;
5
2
  export type TenantStatus = "enabled" | "disabled";
6
3
  export interface Tenant {
@@ -33,17 +30,3 @@ export interface TenancyStorageOperations {
33
30
  updateTenant(data: Tenant): Promise<Tenant>;
34
31
  deleteTenant(id: string): Promise<void>;
35
32
  }
36
- export interface TenancyContext extends BaseContext, DbContext, WcpContext.Interface {
37
- tenancy: Tenancy;
38
- }
39
- export interface Tenancy {
40
- getCurrentTenant(): Tenant;
41
- setCurrentTenant(tenant: Tenant): void;
42
- getRootTenant(): Promise<Tenant>;
43
- getTenantById(id: string): Promise<Tenant>;
44
- listTenants(params?: ListTenantsParams): Promise<Tenant[]>;
45
- createTenant(data: CreateTenantInput): Promise<Tenant>;
46
- withRootTenant<T>(cb: () => T): Promise<T>;
47
- withEachTenant<TReturn>(tenants: Tenant[], cb: (tenant: Tenant) => Promise<TReturn>): Promise<TReturn[]>;
48
- withTenant<TReturn>(tenant: Tenant, cb: (tenant: Tenant) => Promise<TReturn>): Promise<TReturn>;
49
- }
package/types/users.d.ts CHANGED
@@ -1,8 +1,3 @@
1
- import type { SecurityContext, Team } from "../types/security.js";
2
- import type { TenancyContext } from "../types/tenancy.js";
3
- export interface AdminUsersContext extends SecurityContext, TenancyContext {
4
- adminUsers: AdminUsers;
5
- }
6
1
  export interface CreatedBy {
7
2
  id: string;
8
3
  displayName: string | null;
@@ -45,14 +40,6 @@ export interface ListUsersParams {
45
40
  };
46
41
  sort?: string[];
47
42
  }
48
- export interface AdminUsers {
49
- getUser<TUser extends AdminUser = AdminUser>(params: GetUserParams): Promise<TUser>;
50
- listUsers<TUser extends AdminUser = AdminUser>(params?: ListUsersParams): Promise<TUser[]>;
51
- listUserTeams(id: string): Promise<Team[]>;
52
- createUser<TUser extends AdminUser = AdminUser>(data: CreateUserInput): Promise<TUser>;
53
- updateUser<TUser extends AdminUser = AdminUser>(id: string, data: UpdateUserInput): Promise<TUser>;
54
- deleteUser(id: string): Promise<void>;
55
- }
56
43
  export interface StorageOperationsListUsersParams extends ListUsersParams {
57
44
  where: ListUsersParams["where"] & {
58
45
  tenant: string;
@@ -1,7 +0,0 @@
1
- import type { DecryptedWcpProjectLicense } from "@webiny/wcp/types.js";
2
- import type { ApiCoreStorageOperations } from "./types/core.js";
3
- export interface ApiCoreConfig {
4
- storageOperations: ApiCoreStorageOperations;
5
- testProjectLicense?: DecryptedWcpProjectLicense;
6
- }
7
- export declare const createApiCore: (config: ApiCoreConfig) => (import("@webiny/handler-graphql/index.js").GraphQLSchemaPlugin<import("@webiny/api/types.js").Context> | import("@webiny/handler/index.js").RegisterExtensionPlugin<import("@webiny/handler/types.js").Context> | import("@webiny/api/index.js").ContextPlugin<import("~/types/core.js").ApiCoreContext> | import("@webiny/api/index.js").ContextPlugin<import("~/types/core.js").ApiCoreContext>[])[];
package/createApiCore.js DELETED
@@ -1,22 +0,0 @@
1
- import { createRegisterExtensionPlugin } from "@webiny/handler/plugins/RegisterExtensionPlugin.js";
2
- import { ApiCoreFeature } from "./ApiCoreFeature.js";
3
- import { createWcpContext } from "./legacy/wcp/context.js";
4
- import { createSecurityContext } from "./legacy/security/createSecurityContext.js";
5
- import { createAdminUsersContext } from "./legacy/users/createAdminUsersContext.js";
6
- import { createTenancyContext } from "./legacy/tenancy/createTenancyContext.js";
7
- import { createSystemGraphQL } from "./graphql/system/createSystemGraphQL.js";
8
- const createApiCore = (config)=>[
9
- createRegisterExtensionPlugin((context)=>{
10
- ApiCoreFeature.register(context.container, config.storageOperations);
11
- }),
12
- createWcpContext({
13
- testProjectLicense: config.testProjectLicense
14
- }),
15
- createTenancyContext(),
16
- createSecurityContext(),
17
- createAdminUsersContext(),
18
- createSystemGraphQL()
19
- ];
20
- export { createApiCore };
21
-
22
- //# sourceMappingURL=createApiCore.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createApiCore.js","sources":["../src/createApiCore.ts"],"sourcesContent":["import { createRegisterExtensionPlugin } from \"@webiny/handler/plugins/RegisterExtensionPlugin.js\";\nimport { ApiCoreFeature } from \"./ApiCoreFeature.js\";\nimport type { DecryptedWcpProjectLicense } from \"@webiny/wcp/types.js\";\nimport { createWcpContext } from \"~/legacy/wcp/context.js\";\nimport { createSecurityContext } from \"~/legacy/security/createSecurityContext.js\";\nimport { createAdminUsersContext } from \"~/legacy/users/createAdminUsersContext.js\";\nimport { createTenancyContext } from \"~/legacy/tenancy/createTenancyContext.js\";\nimport { createSystemGraphQL } from \"~/graphql/system/createSystemGraphQL.js\";\nimport type { ApiCoreStorageOperations } from \"~/types/core.js\";\n\nexport interface ApiCoreConfig {\n storageOperations: ApiCoreStorageOperations;\n testProjectLicense?: DecryptedWcpProjectLicense;\n}\n\nexport const createApiCore = (config: ApiCoreConfig) => {\n return [\n createRegisterExtensionPlugin(context => {\n ApiCoreFeature.register(context.container, config.storageOperations);\n }),\n createWcpContext({ testProjectLicense: config.testProjectLicense }),\n createTenancyContext(),\n createSecurityContext(),\n createAdminUsersContext(),\n createSystemGraphQL()\n ];\n};\n"],"names":["createApiCore","config","createRegisterExtensionPlugin","context","ApiCoreFeature","createWcpContext","createTenancyContext","createSecurityContext","createAdminUsersContext","createSystemGraphQL"],"mappings":";;;;;;;AAeO,MAAMA,gBAAgB,CAACC,SACnB;QACHC,8BAA8BC,CAAAA;YAC1BC,eAAe,QAAQ,CAACD,QAAQ,SAAS,EAAEF,OAAO,iBAAiB;QACvE;QACAI,iBAAiB;YAAE,oBAAoBJ,OAAO,kBAAkB;QAAC;QACjEK;QACAC;QACAC;QACAC;KACH"}
@@ -1,4 +0,0 @@
1
- import { GraphQLSchemaPlugin } from "@webiny/handler-graphql/plugins/GraphQLSchemaPlugin.js";
2
- import type { ApiCoreContext } from "../../types/core.js";
3
- declare const _default: GraphQLSchemaPlugin<ApiCoreContext>;
4
- export default _default;
@@ -1 +0,0 @@
1
- {"version":3,"file":"graphql/security/apiKey.gql.js","sources":["../../../src/graphql/security/apiKey.gql.ts"],"sourcesContent":["import { Response, ErrorResponse } from \"@webiny/handler-graphql/responses.js\";\nimport { GraphQLSchemaPlugin } from \"@webiny/handler-graphql/plugins/GraphQLSchemaPlugin.js\";\nimport type { ApiCoreContext } from \"~/types/core.js\";\nimport { CreateApiKeyUseCase } from \"~/features/security/apiKeys/CreateApiKey/index.js\";\nimport { UpdateApiKeyUseCase } from \"~/features/security/apiKeys/UpdateApiKey/index.js\";\nimport { DeleteApiKeyUseCase } from \"~/features/security/apiKeys/DeleteApiKey/index.js\";\nimport { ListApiKeysUseCase } from \"~/features/security/apiKeys/ListApiKeys/index.js\";\nimport { GetApiKeyUseCase } from \"~/features/security/apiKeys/GetApiKey/index.js\";\n\nexport default new GraphQLSchemaPlugin<ApiCoreContext>({\n typeDefs: /* GraphQL */ `\n type SecurityApiKey {\n id: ID\n name: String\n slug: String\n description: String\n token: String\n permissions: [JSON]\n createdOn: DateTime\n createdBy: SecurityCreatedBy\n }\n\n input SecurityApiKeyInput {\n id: ID\n name: String!\n slug: String\n description: String\n token: String\n permissions: [JSON]!\n }\n\n type SecurityApiKeyResponse {\n data: SecurityApiKey\n error: SecurityError\n }\n\n type SecurityApiKeyListResponse {\n data: [SecurityApiKey!]\n error: SecurityError\n }\n\n extend type SecurityQuery {\n listApiKeys: SecurityApiKeyListResponse\n getApiKey(id: ID!): SecurityApiKeyResponse\n }\n\n extend type SecurityMutation {\n createApiKey(data: SecurityApiKeyInput!): SecurityApiKeyResponse\n updateApiKey(id: ID!, data: SecurityApiKeyInput!): SecurityApiKeyResponse\n deleteApiKey(id: ID!): SecurityBooleanResponse\n }\n `,\n resolvers: {\n SecurityQuery: {\n async listApiKeys(_, __, context) {\n const list = context.container.resolve(ListApiKeysUseCase);\n const result = await list.execute();\n\n if (result.isOk()) {\n return new Response(result.value);\n }\n return new ErrorResponse(result.error);\n },\n async getApiKey(_, args: any, context) {\n const getById = context.container.resolve(GetApiKeyUseCase);\n const result = await getById.execute(args.id);\n\n if (result.isOk()) {\n return new Response(result.value);\n }\n return new ErrorResponse(result.error);\n }\n },\n SecurityMutation: {\n async createApiKey(_, args: any, context) {\n const createApiKey = context.container.resolve(CreateApiKeyUseCase);\n const result = await createApiKey.execute(args.data);\n\n if (result.isOk()) {\n return new Response(result.value);\n }\n return new ErrorResponse(result.error);\n },\n async updateApiKey(_, args: any, context) {\n const updateApiKey = context.container.resolve(UpdateApiKeyUseCase);\n const result = await updateApiKey.execute(args.id, args.data);\n\n if (result.isOk()) {\n return new Response(result.value);\n }\n return new ErrorResponse(result.error);\n },\n async deleteApiKey(_, args: any, context) {\n const deleteApiKey = context.container.resolve(DeleteApiKeyUseCase);\n const result = await deleteApiKey.execute(args.id);\n\n if (result.isOk()) {\n return new Response(true);\n }\n return new ErrorResponse(result.error);\n }\n }\n }\n});\n"],"names":["GraphQLSchemaPlugin","_","__","context","list","ListApiKeysUseCase","result","Response","ErrorResponse","args","getById","GetApiKeyUseCase","createApiKey","CreateApiKeyUseCase","updateApiKey","UpdateApiKeyUseCase","deleteApiKey","DeleteApiKeyUseCase"],"mappings":";;;;;;;AASA,mBAAe,IAAIA,oBAAoC;IACnD,UAAwB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAyCzB,CAAC;IACD,WAAW;QACP,eAAe;YACX,MAAM,aAAYC,CAAC,EAAEC,EAAE,EAAEC,OAAO;gBAC5B,MAAMC,OAAOD,QAAQ,SAAS,CAAC,OAAO,CAACE;gBACvC,MAAMC,SAAS,MAAMF,KAAK,OAAO;gBAEjC,IAAIE,OAAO,IAAI,IACX,OAAO,IAAIC,SAASD,OAAO,KAAK;gBAEpC,OAAO,IAAIE,cAAcF,OAAO,KAAK;YACzC;YACA,MAAM,WAAUL,CAAC,EAAEQ,IAAS,EAAEN,OAAO;gBACjC,MAAMO,UAAUP,QAAQ,SAAS,CAAC,OAAO,CAACQ;gBAC1C,MAAML,SAAS,MAAMI,QAAQ,OAAO,CAACD,KAAK,EAAE;gBAE5C,IAAIH,OAAO,IAAI,IACX,OAAO,IAAIC,SAASD,OAAO,KAAK;gBAEpC,OAAO,IAAIE,cAAcF,OAAO,KAAK;YACzC;QACJ;QACA,kBAAkB;YACd,MAAM,cAAaL,CAAC,EAAEQ,IAAS,EAAEN,OAAO;gBACpC,MAAMS,eAAeT,QAAQ,SAAS,CAAC,OAAO,CAACU;gBAC/C,MAAMP,SAAS,MAAMM,aAAa,OAAO,CAACH,KAAK,IAAI;gBAEnD,IAAIH,OAAO,IAAI,IACX,OAAO,IAAIC,SAASD,OAAO,KAAK;gBAEpC,OAAO,IAAIE,cAAcF,OAAO,KAAK;YACzC;YACA,MAAM,cAAaL,CAAC,EAAEQ,IAAS,EAAEN,OAAO;gBACpC,MAAMW,eAAeX,QAAQ,SAAS,CAAC,OAAO,CAACY;gBAC/C,MAAMT,SAAS,MAAMQ,aAAa,OAAO,CAACL,KAAK,EAAE,EAAEA,KAAK,IAAI;gBAE5D,IAAIH,OAAO,IAAI,IACX,OAAO,IAAIC,SAASD,OAAO,KAAK;gBAEpC,OAAO,IAAIE,cAAcF,OAAO,KAAK;YACzC;YACA,MAAM,cAAaL,CAAC,EAAEQ,IAAS,EAAEN,OAAO;gBACpC,MAAMa,eAAeb,QAAQ,SAAS,CAAC,OAAO,CAACc;gBAC/C,MAAMX,SAAS,MAAMU,aAAa,OAAO,CAACP,KAAK,EAAE;gBAEjD,IAAIH,OAAO,IAAI,IACX,OAAO,IAAIC,SAAS;gBAExB,OAAO,IAAIC,cAAcF,OAAO,KAAK;YACzC;QACJ;IACJ;AACJ"}
@@ -1,4 +0,0 @@
1
- import { GraphQLSchemaPlugin } from "@webiny/handler-graphql";
2
- import type { SecurityContext } from "../../types/security.js";
3
- declare const _default: GraphQLSchemaPlugin<SecurityContext>;
4
- export default _default;
@@ -1 +0,0 @@
1
- {"version":3,"file":"graphql/security/base.gql.js","sources":["../../../src/graphql/security/base.gql.ts"],"sourcesContent":["import { GraphQLSchemaPlugin } from \"@webiny/handler-graphql\";\nimport type { SecurityContext } from \"~/types/security.js\";\n\nconst emptyResolver = () => ({});\n\nexport default new GraphQLSchemaPlugin<SecurityContext>({\n typeDefs: /* GraphQL */ `\n type SecurityMutation {\n _empty: String\n }\n\n type SecurityQuery {\n _empty: String\n }\n\n extend type Query {\n security: SecurityQuery\n }\n\n extend type Mutation {\n security: SecurityMutation\n }\n\n type SecurityCreatedBy {\n id: ID\n displayName: String\n }\n\n type SecurityError {\n code: String\n message: String\n data: JSON\n stack: String\n }\n\n type SecurityBooleanResponse {\n data: Boolean\n error: SecurityError\n }\n `,\n resolvers: {\n Query: {\n security: emptyResolver\n },\n Mutation: {\n security: emptyResolver\n }\n }\n});\n"],"names":["emptyResolver","GraphQLSchemaPlugin"],"mappings":";AAGA,MAAMA,gBAAgB,IAAO,EAAC;AAE9B,iBAAe,IAAIC,oBAAqC;IACpD,UAAwB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAiCzB,CAAC;IACD,WAAW;QACP,OAAO;YACH,UAAUD;QACd;QACA,UAAU;YACN,UAAUA;QACd;IACJ;AACJ"}
@@ -1,4 +0,0 @@
1
- import { GraphQLSchemaPlugin } from "@webiny/handler-graphql/plugins/GraphQLSchemaPlugin.js";
2
- import type { ApiCoreContext } from "../../types/core.js";
3
- declare const _default: GraphQLSchemaPlugin<ApiCoreContext>;
4
- export default _default;
@@ -1 +0,0 @@
1
- {"version":3,"file":"graphql/security/identity.gql.js","sources":["../../../src/graphql/security/identity.gql.ts"],"sourcesContent":["import { GraphQLSchemaPlugin } from \"@webiny/handler-graphql/plugins/GraphQLSchemaPlugin.js\";\nimport { ErrorResponse, Response } from \"@webiny/handler-graphql\";\nimport { EventPublisher } from \"~/features/eventPublisher/index.js\";\nimport type { ApiCoreContext } from \"~/types/core.js\";\nimport { AfterLoginEvent } from \"~/features/security/login/index.js\";\nimport { GetIdentityProfileUseCase } from \"~/features/users/GetIdentityProfile/index.js\";\nimport type { SecurityContext } from \"~/types/security.js\";\nimport type { AdminUser } from \"~/types/users.js\";\nimport { TeamsRepository } from \"~/features/security/teams/shared/abstractions.js\";\nimport { RolesRepository } from \"~/features/security/roles/shared/abstractions.js\";\nimport { IdentityContext } from \"~/features/security/IdentityContext/index.js\";\nimport { ProfileMapper } from \"./ProfileMapper.js\";\n\nconst getDefaultTenant = async (context: SecurityContext) => {\n const identity = context.security.getIdentity();\n const defaultTenantId = identity.context.defaultTenantId ?? \"root\";\n\n const defaultTenant = await context.tenancy.getTenantById(defaultTenantId);\n if (defaultTenant) {\n return defaultTenant;\n }\n\n return context.tenancy.getRootTenant();\n};\n\nexport default new GraphQLSchemaPlugin<ApiCoreContext>({\n typeDefs: /* GraphQL */ `\n type SecurityIdentityTenant {\n id: ID!\n name: String!\n }\n type SecurityIdentityProfileRole {\n id: String!\n slug: String!\n name: String!\n }\n\n type SecurityIdentityProfileTeam {\n id: String!\n slug: String!\n name: String!\n }\n\n type SecurityIdentityProfile {\n firstName: String\n lastName: String\n email: String\n avatar: JSON\n external: Boolean!\n createdOn: DateTime!\n }\n\n type SecurityIdentity {\n id: ID!\n type: String!\n displayName: String!\n roles: [SecurityIdentityProfileRole!]!\n teams: [SecurityIdentityProfileTeam!]!\n permissions: [JSON!]!\n profile: SecurityIdentityProfile!\n currentTenant: SecurityIdentityTenant!\n defaultTenant: SecurityIdentityTenant!\n }\n\n type SecurityIdentityLoginResponse {\n data: SecurityIdentity\n error: SecurityError\n }\n\n extend type SecurityMutation {\n \"Login using idToken obtained from a 3rd party identity provider\"\n login: SecurityIdentityLoginResponse\n }\n `,\n resolvers: {\n SecurityMutation: {\n login: async (_, __, context) => {\n const identityContext = context.container.resolve(IdentityContext);\n const identity = identityContext.getIdentity();\n if (identity.isAnonymous()) {\n return new ErrorResponse({\n code: \"Security/Identity/NotAuthenticated\",\n message: \"Unauthenticated!\"\n });\n }\n\n try {\n const eventPublisher = context.container.resolve(EventPublisher);\n await eventPublisher.publish(new AfterLoginEvent({ identity }));\n } catch (err) {\n return new ErrorResponse(err);\n }\n\n // Roles and teams are stored in the user record.\n const rolesRepo = context.container.resolve(RolesRepository);\n const teamsRepo = context.container.resolve(TeamsRepository);\n const getProfile = context.container.resolve(GetIdentityProfileUseCase);\n\n const result = await context.security.withoutAuthorization(async () => {\n return getProfile.execute(identity.id);\n });\n\n if (result.isFail()) {\n return new ErrorResponse({\n code: \"Security/Identity/NotAuthorized\",\n message: \"Missing user profile!\"\n });\n }\n\n const user = result.value;\n\n const [roles, teams] = await Promise.all([\n getRoles(user, rolesRepo),\n getTeams(user, teamsRepo)\n ]);\n\n const profileMapper = new ProfileMapper();\n const profile = await profileMapper.toDTO(user);\n\n return new Response({\n ...identity.toJson(),\n profile,\n roles,\n teams\n });\n }\n },\n SecurityIdentity: {\n defaultTenant(_, __, context) {\n return getDefaultTenant(context);\n },\n currentTenant(_, __, context) {\n return context.tenancy.getCurrentTenant();\n },\n permissions(_, __, context) {\n return context.security.listPermissions();\n }\n }\n }\n});\n\nconst getRoles = async (user: AdminUser, rolesRepo: RolesRepository.Interface) => {\n const roleIds = user.roles ?? [];\n if (roleIds.length > 0) {\n const result = await rolesRepo.list({\n where: { id_in: roleIds }\n });\n\n if (result.isOk()) {\n return result.value.map(role => ({\n id: role.id,\n slug: role.slug,\n name: role.name\n }));\n }\n }\n\n return [];\n};\n\nconst getTeams = async (user: AdminUser, teamsRepo: TeamsRepository.Interface) => {\n const teamIds = user.teams ?? [];\n if (teamIds.length > 0) {\n const result = await teamsRepo.list({\n where: { id_in: teamIds }\n });\n if (result.isOk()) {\n return result.value.map(team => ({\n id: team.id,\n slug: team.slug,\n name: team.name\n }));\n }\n }\n return [];\n};\n"],"names":["getDefaultTenant","context","identity","defaultTenantId","defaultTenant","GraphQLSchemaPlugin","_","__","identityContext","IdentityContext","ErrorResponse","eventPublisher","EventPublisher","AfterLoginEvent","err","rolesRepo","RolesRepository","teamsRepo","TeamsRepository","getProfile","GetIdentityProfileUseCase","result","user","roles","teams","Promise","getRoles","getTeams","profileMapper","ProfileMapper","profile","Response","roleIds","role","teamIds","team"],"mappings":"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"}
@@ -1 +0,0 @@
1
- export declare const createSecurityGraphQL: () => import("@webiny/handler-graphql/index.js").GraphQLSchemaPlugin<import("../../types/core.js").ApiCoreContext>[];
@@ -1,15 +0,0 @@
1
- import base_gql from "./base.gql.js";
2
- import apiKey_gql from "./apiKey.gql.js";
3
- import role_gql from "./role.gql.js";
4
- import team_gql from "./team.gql.js";
5
- import identity_gql from "./identity.gql.js";
6
- const createSecurityGraphQL = ()=>[
7
- base_gql,
8
- team_gql,
9
- apiKey_gql,
10
- role_gql,
11
- identity_gql
12
- ];
13
- export { createSecurityGraphQL };
14
-
15
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"graphql/security/index.js","sources":["../../../src/graphql/security/index.ts"],"sourcesContent":["import base from \"./base.gql.js\";\nimport apiKey from \"./apiKey.gql.js\";\nimport role from \"./role.gql.js\";\nimport team from \"./team.gql.js\";\nimport identity from \"./identity.gql.js\";\n\nexport const createSecurityGraphQL = () => {\n return [base, team, apiKey, role, identity];\n};\n"],"names":["createSecurityGraphQL","base","team","apiKey","role","identity"],"mappings":";;;;;AAMO,MAAMA,wBAAwB,IAC1B;QAACC;QAAMC;QAAMC;QAAQC;QAAMC;KAAS"}
@@ -1,4 +0,0 @@
1
- import { GraphQLSchemaPlugin } from "@webiny/handler-graphql/plugins/GraphQLSchemaPlugin.js";
2
- import type { ApiCoreContext } from "../../types/core.js";
3
- declare const _default: GraphQLSchemaPlugin<ApiCoreContext>;
4
- export default _default;