@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
@@ -1,106 +0,0 @@
1
- import { ErrorResponse, ListErrorResponse, ListResponse, Response } from "@webiny/handler-graphql/responses.js";
2
- import { GraphQLSchemaPlugin } from "@webiny/handler-graphql/plugins/GraphQLSchemaPlugin.js";
3
- const role_gql = new GraphQLSchemaPlugin({
4
- typeDefs: `
5
- type SecurityRole {
6
- id: ID
7
- name: String
8
- slug: String
9
- createdOn: DateTime
10
- description: String
11
- permissions: [JSON]
12
- system: Boolean!
13
- plugin: Boolean
14
- }
15
-
16
- input SecurityRoleCreateInput {
17
- name: String!
18
- slug: String!
19
- description: String
20
- permissions: [JSON!]!
21
- }
22
-
23
- input SecurityRoleUpdateInput {
24
- name: String
25
- description: String
26
- permissions: [JSON!]
27
- }
28
-
29
- type SecurityRoleResponse {
30
- data: SecurityRole
31
- error: SecurityError
32
- }
33
-
34
- type SecurityRoleListResponse {
35
- data: [SecurityRole]
36
- error: SecurityError
37
- }
38
-
39
- input GetRoleWhereInput {
40
- id: ID
41
- slug: String
42
- }
43
-
44
- extend type SecurityQuery {
45
- getRole(where: GetRoleWhereInput!): SecurityRoleResponse
46
- listRoles: SecurityRoleListResponse
47
- }
48
-
49
- extend type SecurityMutation {
50
- createRole(data: SecurityRoleCreateInput!): SecurityRoleResponse
51
- updateRole(id: ID!, data: SecurityRoleUpdateInput!): SecurityRoleResponse
52
- deleteRole(id: ID!): SecurityBooleanResponse
53
- }
54
- `,
55
- resolvers: {
56
- SecurityQuery: {
57
- getRole: async (_, { where }, context)=>{
58
- try {
59
- const roles = await context.security.getRole({
60
- where
61
- });
62
- return new Response(roles);
63
- } catch (e) {
64
- return new ErrorResponse(e);
65
- }
66
- },
67
- listRoles: async (_, __, context)=>{
68
- try {
69
- const rolesList = await context.security.listRoles();
70
- return new ListResponse(rolesList);
71
- } catch (e) {
72
- return new ListErrorResponse(e);
73
- }
74
- }
75
- },
76
- SecurityMutation: {
77
- createRole: async (_, { data }, context)=>{
78
- try {
79
- const role = await context.security.createRole(data);
80
- return new Response(role);
81
- } catch (e) {
82
- return new ErrorResponse(e);
83
- }
84
- },
85
- updateRole: async (_, { id, data }, context)=>{
86
- try {
87
- const role = await context.security.updateRole(id, data);
88
- return new Response(role);
89
- } catch (e) {
90
- return new ErrorResponse(e);
91
- }
92
- },
93
- deleteRole: async (_, { id }, context)=>{
94
- try {
95
- await context.security.deleteRole(id);
96
- return new Response(true);
97
- } catch (e) {
98
- return new ErrorResponse(e);
99
- }
100
- }
101
- }
102
- }
103
- });
104
- export default role_gql;
105
-
106
- //# sourceMappingURL=role.gql.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"graphql/security/role.gql.js","sources":["../../../src/graphql/security/role.gql.ts"],"sourcesContent":["import {\n ErrorResponse,\n ListErrorResponse,\n ListResponse,\n Response\n} from \"@webiny/handler-graphql/responses.js\";\nimport { GraphQLSchemaPlugin } from \"@webiny/handler-graphql/plugins/GraphQLSchemaPlugin.js\";\nimport type { ApiCoreContext } from \"~/types/core.js\";\n\nexport default new GraphQLSchemaPlugin<ApiCoreContext>({\n typeDefs: /* GraphQL */ `\n type SecurityRole {\n id: ID\n name: String\n slug: String\n createdOn: DateTime\n description: String\n permissions: [JSON]\n system: Boolean!\n plugin: Boolean\n }\n\n input SecurityRoleCreateInput {\n name: String!\n slug: String!\n description: String\n permissions: [JSON!]!\n }\n\n input SecurityRoleUpdateInput {\n name: String\n description: String\n permissions: [JSON!]\n }\n\n type SecurityRoleResponse {\n data: SecurityRole\n error: SecurityError\n }\n\n type SecurityRoleListResponse {\n data: [SecurityRole]\n error: SecurityError\n }\n\n input GetRoleWhereInput {\n id: ID\n slug: String\n }\n\n extend type SecurityQuery {\n getRole(where: GetRoleWhereInput!): SecurityRoleResponse\n listRoles: SecurityRoleListResponse\n }\n\n extend type SecurityMutation {\n createRole(data: SecurityRoleCreateInput!): SecurityRoleResponse\n updateRole(id: ID!, data: SecurityRoleUpdateInput!): SecurityRoleResponse\n deleteRole(id: ID!): SecurityBooleanResponse\n }\n `,\n resolvers: {\n SecurityQuery: {\n getRole: async (_, { where }, context) => {\n try {\n const roles = await context.security.getRole({ where });\n return new Response(roles);\n } catch (e) {\n return new ErrorResponse(e);\n }\n },\n listRoles: async (_, __, context) => {\n try {\n const rolesList = await context.security.listRoles();\n\n return new ListResponse(rolesList);\n } catch (e) {\n return new ListErrorResponse(e);\n }\n }\n },\n SecurityMutation: {\n createRole: async (_, { data }, context) => {\n try {\n const role = await context.security.createRole(data);\n\n return new Response(role);\n } catch (e) {\n return new ErrorResponse(e);\n }\n },\n updateRole: async (_, { id, data }, context) => {\n try {\n const role = await context.security.updateRole(id, data);\n return new Response(role);\n } catch (e) {\n return new ErrorResponse(e);\n }\n },\n deleteRole: async (_, { id }, context) => {\n try {\n await context.security.deleteRole(id);\n\n return new Response(true);\n } catch (e) {\n return new ErrorResponse(e);\n }\n }\n }\n }\n});\n"],"names":["GraphQLSchemaPlugin","_","where","context","roles","Response","e","ErrorResponse","__","rolesList","ListResponse","ListErrorResponse","data","role","id"],"mappings":";;AASA,iBAAe,IAAIA,oBAAoC;IACnD,UAAwB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAkDzB,CAAC;IACD,WAAW;QACP,eAAe;YACX,SAAS,OAAOC,GAAG,EAAEC,KAAK,EAAE,EAAEC;gBAC1B,IAAI;oBACA,MAAMC,QAAQ,MAAMD,QAAQ,QAAQ,CAAC,OAAO,CAAC;wBAAED;oBAAM;oBACrD,OAAO,IAAIG,SAASD;gBACxB,EAAE,OAAOE,GAAG;oBACR,OAAO,IAAIC,cAAcD;gBAC7B;YACJ;YACA,WAAW,OAAOL,GAAGO,IAAIL;gBACrB,IAAI;oBACA,MAAMM,YAAY,MAAMN,QAAQ,QAAQ,CAAC,SAAS;oBAElD,OAAO,IAAIO,aAAaD;gBAC5B,EAAE,OAAOH,GAAG;oBACR,OAAO,IAAIK,kBAAkBL;gBACjC;YACJ;QACJ;QACA,kBAAkB;YACd,YAAY,OAAOL,GAAG,EAAEW,IAAI,EAAE,EAAET;gBAC5B,IAAI;oBACA,MAAMU,OAAO,MAAMV,QAAQ,QAAQ,CAAC,UAAU,CAACS;oBAE/C,OAAO,IAAIP,SAASQ;gBACxB,EAAE,OAAOP,GAAG;oBACR,OAAO,IAAIC,cAAcD;gBAC7B;YACJ;YACA,YAAY,OAAOL,GAAG,EAAEa,EAAE,EAAEF,IAAI,EAAE,EAAET;gBAChC,IAAI;oBACA,MAAMU,OAAO,MAAMV,QAAQ,QAAQ,CAAC,UAAU,CAACW,IAAIF;oBACnD,OAAO,IAAIP,SAASQ;gBACxB,EAAE,OAAOP,GAAG;oBACR,OAAO,IAAIC,cAAcD;gBAC7B;YACJ;YACA,YAAY,OAAOL,GAAG,EAAEa,EAAE,EAAE,EAAEX;gBAC1B,IAAI;oBACA,MAAMA,QAAQ,QAAQ,CAAC,UAAU,CAACW;oBAElC,OAAO,IAAIT,SAAS;gBACxB,EAAE,OAAOC,GAAG;oBACR,OAAO,IAAIC,cAAcD;gBAC7B;YACJ;QACJ;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,119 +0,0 @@
1
- import { ErrorResponse, ListErrorResponse, ListResponse, Response } from "@webiny/handler-graphql/responses.js";
2
- import { GraphQLSchemaPlugin } from "@webiny/handler-graphql/plugins/GraphQLSchemaPlugin.js";
3
- const team_gql = new GraphQLSchemaPlugin({
4
- typeDefs: `
5
- type SecurityTeam {
6
- id: ID
7
- name: String
8
- slug: String
9
- createdOn: DateTime
10
- description: String
11
- roles: [SecurityRole]
12
- system: Boolean!
13
- plugin: Boolean
14
- }
15
-
16
- input SecurityTeamCreateInput {
17
- name: String!
18
- slug: String!
19
- description: String
20
- roles: [RefInput!]!
21
- }
22
-
23
- input SecurityTeamUpdateInput {
24
- name: String
25
- description: String
26
- roles: [RefInput!]
27
- }
28
-
29
- type SecurityTeamResponse {
30
- data: SecurityTeam
31
- error: SecurityError
32
- }
33
-
34
- type SecurityTeamListResponse {
35
- data: [SecurityTeam]
36
- error: SecurityError
37
- }
38
-
39
- input GetTeamWhereInput {
40
- id: ID
41
- slug: String
42
- }
43
-
44
- extend type SecurityQuery {
45
- getTeam(where: GetTeamWhereInput!): SecurityTeamResponse
46
- listTeams: SecurityTeamListResponse
47
- }
48
-
49
- extend type SecurityMutation {
50
- createTeam(data: SecurityTeamCreateInput!): SecurityTeamResponse
51
- updateTeam(id: ID!, data: SecurityTeamUpdateInput!): SecurityTeamResponse
52
- deleteTeam(id: ID!): SecurityBooleanResponse
53
- }
54
- `,
55
- resolvers: {
56
- SecurityTeam: {
57
- roles: async (team, __, context)=>{
58
- try {
59
- return context.security.listRoles({
60
- where: {
61
- id_in: team.roles
62
- }
63
- });
64
- } catch (e) {
65
- return new ErrorResponse(e);
66
- }
67
- }
68
- },
69
- SecurityQuery: {
70
- getTeam: async (_, { where }, context)=>{
71
- try {
72
- const team = await context.security.getTeam({
73
- where
74
- });
75
- return new Response(team);
76
- } catch (e) {
77
- return new ErrorResponse(e);
78
- }
79
- },
80
- listTeams: async (_, __, context)=>{
81
- try {
82
- const teamList = await context.security.listTeams();
83
- return new ListResponse(teamList);
84
- } catch (e) {
85
- return new ListErrorResponse(e);
86
- }
87
- }
88
- },
89
- SecurityMutation: {
90
- createTeam: async (_, { data }, context)=>{
91
- try {
92
- const team = await context.security.createTeam(data);
93
- return new Response(team);
94
- } catch (e) {
95
- return new ErrorResponse(e);
96
- }
97
- },
98
- updateTeam: async (_, { id, data }, context)=>{
99
- try {
100
- const team = await context.security.updateTeam(id, data);
101
- return new Response(team);
102
- } catch (e) {
103
- return new ErrorResponse(e);
104
- }
105
- },
106
- deleteTeam: async (_, { id }, context)=>{
107
- try {
108
- await context.security.deleteTeam(id);
109
- return new Response(true);
110
- } catch (e) {
111
- return new ErrorResponse(e);
112
- }
113
- }
114
- }
115
- }
116
- });
117
- export default team_gql;
118
-
119
- //# sourceMappingURL=team.gql.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"graphql/security/team.gql.js","sources":["../../../src/graphql/security/team.gql.ts"],"sourcesContent":["import {\n ErrorResponse,\n ListErrorResponse,\n ListResponse,\n Response\n} from \"@webiny/handler-graphql/responses.js\";\nimport { GraphQLSchemaPlugin } from \"@webiny/handler-graphql/plugins/GraphQLSchemaPlugin.js\";\nimport type { ApiCoreContext } from \"~/types/core.js\";\nimport type { Team } from \"~/types/security.js\";\n\nexport default new GraphQLSchemaPlugin<ApiCoreContext>({\n typeDefs: /* GraphQL */ `\n type SecurityTeam {\n id: ID\n name: String\n slug: String\n createdOn: DateTime\n description: String\n roles: [SecurityRole]\n system: Boolean!\n plugin: Boolean\n }\n\n input SecurityTeamCreateInput {\n name: String!\n slug: String!\n description: String\n roles: [RefInput!]!\n }\n\n input SecurityTeamUpdateInput {\n name: String\n description: String\n roles: [RefInput!]\n }\n\n type SecurityTeamResponse {\n data: SecurityTeam\n error: SecurityError\n }\n\n type SecurityTeamListResponse {\n data: [SecurityTeam]\n error: SecurityError\n }\n\n input GetTeamWhereInput {\n id: ID\n slug: String\n }\n\n extend type SecurityQuery {\n getTeam(where: GetTeamWhereInput!): SecurityTeamResponse\n listTeams: SecurityTeamListResponse\n }\n\n extend type SecurityMutation {\n createTeam(data: SecurityTeamCreateInput!): SecurityTeamResponse\n updateTeam(id: ID!, data: SecurityTeamUpdateInput!): SecurityTeamResponse\n deleteTeam(id: ID!): SecurityBooleanResponse\n }\n `,\n resolvers: {\n SecurityTeam: {\n roles: async (team: Team, __, context) => {\n try {\n return context.security.listRoles({ where: { id_in: team.roles } });\n } catch (e) {\n return new ErrorResponse(e);\n }\n }\n },\n SecurityQuery: {\n getTeam: async (_, { where }, context) => {\n try {\n const team = await context.security.getTeam({ where });\n return new Response(team);\n } catch (e) {\n return new ErrorResponse(e);\n }\n },\n listTeams: async (_, __, context) => {\n try {\n const teamList = await context.security.listTeams();\n\n return new ListResponse(teamList);\n } catch (e) {\n return new ListErrorResponse(e);\n }\n }\n },\n SecurityMutation: {\n createTeam: async (_, { data }, context) => {\n try {\n const team = await context.security.createTeam(data);\n\n return new Response(team);\n } catch (e) {\n return new ErrorResponse(e);\n }\n },\n updateTeam: async (_, { id, data }, context) => {\n try {\n const team = await context.security.updateTeam(id, data);\n return new Response(team);\n } catch (e) {\n return new ErrorResponse(e);\n }\n },\n deleteTeam: async (_, { id }, context) => {\n try {\n await context.security.deleteTeam(id);\n\n return new Response(true);\n } catch (e) {\n return new ErrorResponse(e);\n }\n }\n }\n }\n});\n"],"names":["GraphQLSchemaPlugin","team","__","context","e","ErrorResponse","_","where","Response","teamList","ListResponse","ListErrorResponse","data","id"],"mappings":";;AAUA,iBAAe,IAAIA,oBAAoC;IACnD,UAAwB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAkDzB,CAAC;IACD,WAAW;QACP,cAAc;YACV,OAAO,OAAOC,MAAYC,IAAIC;gBAC1B,IAAI;oBACA,OAAOA,QAAQ,QAAQ,CAAC,SAAS,CAAC;wBAAE,OAAO;4BAAE,OAAOF,KAAK,KAAK;wBAAC;oBAAE;gBACrE,EAAE,OAAOG,GAAG;oBACR,OAAO,IAAIC,cAAcD;gBAC7B;YACJ;QACJ;QACA,eAAe;YACX,SAAS,OAAOE,GAAG,EAAEC,KAAK,EAAE,EAAEJ;gBAC1B,IAAI;oBACA,MAAMF,OAAO,MAAME,QAAQ,QAAQ,CAAC,OAAO,CAAC;wBAAEI;oBAAM;oBACpD,OAAO,IAAIC,SAASP;gBACxB,EAAE,OAAOG,GAAG;oBACR,OAAO,IAAIC,cAAcD;gBAC7B;YACJ;YACA,WAAW,OAAOE,GAAGJ,IAAIC;gBACrB,IAAI;oBACA,MAAMM,WAAW,MAAMN,QAAQ,QAAQ,CAAC,SAAS;oBAEjD,OAAO,IAAIO,aAAaD;gBAC5B,EAAE,OAAOL,GAAG;oBACR,OAAO,IAAIO,kBAAkBP;gBACjC;YACJ;QACJ;QACA,kBAAkB;YACd,YAAY,OAAOE,GAAG,EAAEM,IAAI,EAAE,EAAET;gBAC5B,IAAI;oBACA,MAAMF,OAAO,MAAME,QAAQ,QAAQ,CAAC,UAAU,CAACS;oBAE/C,OAAO,IAAIJ,SAASP;gBACxB,EAAE,OAAOG,GAAG;oBACR,OAAO,IAAIC,cAAcD;gBAC7B;YACJ;YACA,YAAY,OAAOE,GAAG,EAAEO,EAAE,EAAED,IAAI,EAAE,EAAET;gBAChC,IAAI;oBACA,MAAMF,OAAO,MAAME,QAAQ,QAAQ,CAAC,UAAU,CAACU,IAAID;oBACnD,OAAO,IAAIJ,SAASP;gBACxB,EAAE,OAAOG,GAAG;oBACR,OAAO,IAAIC,cAAcD;gBAC7B;YACJ;YACA,YAAY,OAAOE,GAAG,EAAEO,EAAE,EAAE,EAAEV;gBAC1B,IAAI;oBACA,MAAMA,QAAQ,QAAQ,CAAC,UAAU,CAACU;oBAElC,OAAO,IAAIL,SAAS;gBACxB,EAAE,OAAOJ,GAAG;oBACR,OAAO,IAAIC,cAAcD;gBAC7B;YACJ;QACJ;IACJ;AACJ"}
@@ -1,2 +0,0 @@
1
- import { GraphQLSchemaPlugin } from "@webiny/handler-graphql/plugins/index.js";
2
- export declare const createSystemGraphQL: () => GraphQLSchemaPlugin<import("@webiny/api/types").Context>;
@@ -1,54 +0,0 @@
1
- import { GraphQLSchemaPlugin } from "@webiny/handler-graphql/plugins/index.js";
2
- import { ErrorResponse, Response } from "@webiny/handler-graphql";
3
- import { GetRootTenantUseCase } from "../../features/tenancy/GetRootTenant/index.js";
4
- import { InstallSystemUseCase } from "../../features/system/InstallSystem/index.js";
5
- const emptyResolver = ()=>({});
6
- const createSystemGraphQL = ()=>new GraphQLSchemaPlugin({
7
- typeDefs: `
8
- type SystemQuery {
9
- isSystemInstalled: BooleanResponse
10
- }
11
-
12
- type SystemMutation {
13
- installSystem(installationInput: JSON!): BooleanResponse
14
- }
15
-
16
- extend type Query {
17
- system: SystemQuery
18
- }
19
-
20
- extend type Mutation {
21
- system: SystemMutation
22
- }
23
- `,
24
- resolvers: {
25
- Query: {
26
- system: emptyResolver
27
- },
28
- Mutation: {
29
- system: emptyResolver
30
- },
31
- SystemQuery: {
32
- isSystemInstalled: async (_, __, context)=>{
33
- const getRootTenant = context.container.resolve(GetRootTenantUseCase);
34
- const result = await getRootTenant.execute();
35
- return new Response(result.isOk());
36
- }
37
- },
38
- SystemMutation: {
39
- installSystem: async (_, args, context)=>{
40
- const installSystem = context.container.resolve(InstallSystemUseCase);
41
- const result = await installSystem.execute(args.installationInput);
42
- if (result.isOk()) return new Response(true);
43
- return new ErrorResponse({
44
- code: result.error.code,
45
- message: result.error.message,
46
- data: result.error.data
47
- });
48
- }
49
- }
50
- }
51
- });
52
- export { createSystemGraphQL };
53
-
54
- //# sourceMappingURL=createSystemGraphQL.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"graphql/system/createSystemGraphQL.js","sources":["../../../src/graphql/system/createSystemGraphQL.ts"],"sourcesContent":["import { GraphQLSchemaPlugin } from \"@webiny/handler-graphql/plugins/index.js\";\nimport { ErrorResponse, Response } from \"@webiny/handler-graphql\";\nimport { type AppInstallationData } from \"~/features/tenancy/InstallTenant/index.js\";\nimport { GetRootTenantUseCase } from \"~/features/tenancy/GetRootTenant/index.js\";\nimport { InstallSystemUseCase } from \"~/features/system/InstallSystem/index.js\";\n\nconst emptyResolver = () => ({});\n\ninterface InstallTenantArgs {\n installationInput: AppInstallationData[];\n}\n\nexport const createSystemGraphQL = () => {\n return new GraphQLSchemaPlugin({\n typeDefs: /* GraphQL */ `\n type SystemQuery {\n isSystemInstalled: BooleanResponse\n }\n\n type SystemMutation {\n installSystem(installationInput: JSON!): BooleanResponse\n }\n\n extend type Query {\n system: SystemQuery\n }\n\n extend type Mutation {\n system: SystemMutation\n }\n `,\n resolvers: {\n Query: {\n system: emptyResolver\n },\n Mutation: {\n system: emptyResolver\n },\n SystemQuery: {\n isSystemInstalled: async (_, __, context) => {\n const getRootTenant = context.container.resolve(GetRootTenantUseCase);\n const result = await getRootTenant.execute();\n\n return new Response(result.isOk());\n }\n },\n SystemMutation: {\n installSystem: async (_, args: InstallTenantArgs, context) => {\n const installSystem = context.container.resolve(InstallSystemUseCase);\n\n const result = await installSystem.execute(args.installationInput);\n\n if (result.isOk()) {\n return new Response(true);\n }\n\n return new ErrorResponse({\n code: result.error.code,\n message: result.error.message,\n data: result.error.data\n });\n }\n }\n }\n });\n};\n"],"names":["emptyResolver","createSystemGraphQL","GraphQLSchemaPlugin","_","__","context","getRootTenant","GetRootTenantUseCase","result","Response","args","installSystem","InstallSystemUseCase","ErrorResponse"],"mappings":";;;;AAMA,MAAMA,gBAAgB,IAAO,EAAC;AAMvB,MAAMC,sBAAsB,IACxB,IAAIC,oBAAoB;QAC3B,UAAwB,CAAC;;;;;;;;;;;;;;;;QAgBzB,CAAC;QACD,WAAW;YACP,OAAO;gBACH,QAAQF;YACZ;YACA,UAAU;gBACN,QAAQA;YACZ;YACA,aAAa;gBACT,mBAAmB,OAAOG,GAAGC,IAAIC;oBAC7B,MAAMC,gBAAgBD,QAAQ,SAAS,CAAC,OAAO,CAACE;oBAChD,MAAMC,SAAS,MAAMF,cAAc,OAAO;oBAE1C,OAAO,IAAIG,SAASD,OAAO,IAAI;gBACnC;YACJ;YACA,gBAAgB;gBACZ,eAAe,OAAOL,GAAGO,MAAyBL;oBAC9C,MAAMM,gBAAgBN,QAAQ,SAAS,CAAC,OAAO,CAACO;oBAEhD,MAAMJ,SAAS,MAAMG,cAAc,OAAO,CAACD,KAAK,iBAAiB;oBAEjE,IAAIF,OAAO,IAAI,IACX,OAAO,IAAIC,SAAS;oBAGxB,OAAO,IAAII,cAAc;wBACrB,MAAML,OAAO,KAAK,CAAC,IAAI;wBACvB,SAASA,OAAO,KAAK,CAAC,OAAO;wBAC7B,MAAMA,OAAO,KAAK,CAAC,IAAI;oBAC3B;gBACJ;YACJ;QACJ;IACJ"}
@@ -1,3 +0,0 @@
1
- import { GraphQLSchemaPlugin } from "@webiny/handler-graphql/plugins/GraphQLSchemaPlugin.js";
2
- import type { ApiCoreContext } from "../../types/core.js";
3
- export declare const createUsersGraphQL: () => GraphQLSchemaPlugin<ApiCoreContext>[];
@@ -1,167 +0,0 @@
1
- import { ErrorResponse, ListErrorResponse, ListResponse, NotFoundResponse, Response } from "@webiny/handler-graphql/responses.js";
2
- import { GraphQLSchemaPlugin } from "@webiny/handler-graphql/plugins/GraphQLSchemaPlugin.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
- const emptyResolver = ()=>({});
7
- const createUsersGraphQL = ()=>[
8
- new GraphQLSchemaPlugin({
9
- typeDefs: `
10
- type AdminUsersQuery {
11
- _empty: String
12
- }
13
-
14
- type AdminUsersMutation {
15
- _empty: String
16
- }
17
-
18
- extend type Query {
19
- adminUsers: AdminUsersQuery
20
- }
21
-
22
- extend type Mutation {
23
- adminUsers: AdminUsersMutation
24
- }
25
-
26
- type AdminUsersCreatedBy {
27
- id: ID
28
- displayName: String
29
- }
30
-
31
- type AdminUsersError {
32
- code: String
33
- message: String
34
- data: JSON
35
- stack: String
36
- }
37
-
38
- type AdminUsersBooleanResponse {
39
- data: Boolean
40
- error: AdminUsersError
41
- }
42
- `,
43
- resolvers: {
44
- Query: {
45
- adminUsers: emptyResolver
46
- },
47
- Mutation: {
48
- adminUsers: emptyResolver
49
- }
50
- }
51
- }),
52
- new GraphQLSchemaPlugin({
53
- typeDefs: `
54
- type AdminUser {
55
- id: ID!
56
- displayName: String!
57
- email: String!
58
-
59
- roles: [SecurityRole]
60
- firstName: String
61
- lastName: String
62
- avatar: JSON
63
- external: Boolean
64
- createdOn: DateTime
65
- }
66
-
67
- type AdminUsersResponse {
68
- data: AdminUser
69
- error: AdminUsersError
70
- }
71
-
72
- type AdminUsersListResponse {
73
- data: [AdminUser]
74
- error: AdminUsersError
75
- }
76
-
77
- input AdminUsersGetUserWhereInput {
78
- id: ID
79
- email: String
80
- }
81
-
82
- extend type AdminUsersQuery {
83
- getUser(where: AdminUsersGetUserWhereInput): AdminUsersResponse
84
- getCurrentUser: AdminUsersResponse
85
- listUsers: AdminUsersListResponse
86
- }
87
- `,
88
- resolvers: {
89
- AdminUser: {
90
- roles (user, _, context) {
91
- if (!user.roles) return null;
92
- return context.security.listRoles({
93
- where: {
94
- id_in: user.roles
95
- }
96
- });
97
- }
98
- },
99
- AdminUsersQuery: {
100
- getUser: async (_, { where }, context)=>{
101
- const getUser = context.container.resolve(GetUserUseCase);
102
- const userResult = await getUser.execute({
103
- id: where.id,
104
- email: where.email
105
- });
106
- if (userResult.isFail()) {
107
- const error = userResult.error;
108
- if ("AdminUser/NotFound" === error.code) return new NotFoundResponse(`User "${JSON.stringify(where)}" was not found!`);
109
- return new ErrorResponse({
110
- message: error.message,
111
- code: error.code,
112
- data: error.data
113
- });
114
- }
115
- return new Response(userResult.value);
116
- },
117
- getCurrentUser: async (_, __, context)=>{
118
- const identity = context.security.getIdentity();
119
- if (!identity.isAdmin()) throw new NotAuthorizedResponse();
120
- const getUser = context.container.resolve(GetUserUseCase);
121
- const userResponse = await context.security.withoutAuthorization(async ()=>await getUser.execute({
122
- id: identity.id
123
- }));
124
- if (userResponse.isFail()) {
125
- const error = userResponse.error;
126
- if ("AdminUser/NotFound" === error.code) return new NotFoundResponse(`User with ID ${identity.id} was not found!`);
127
- return new ErrorResponse({
128
- message: error.message,
129
- code: error.code,
130
- data: error.data
131
- });
132
- }
133
- return new Response(userResponse.value);
134
- },
135
- listUsers: async (_, __, context)=>{
136
- const listUsers = context.container.resolve(ListUsersUseCase);
137
- const users = await listUsers.execute();
138
- if (users.isFail()) return new ListErrorResponse(users.error);
139
- return new ListResponse(users.value);
140
- }
141
- }
142
- }
143
- }),
144
- new GraphQLSchemaPlugin({
145
- typeDefs: `
146
- extend type AdminUser {
147
- teams: [SecurityTeam]
148
- }
149
- `,
150
- resolvers: {
151
- AdminUser: {
152
- teams (user, _, context) {
153
- const hasTeams = Array.isArray(user.teams) && user.teams.length > 0;
154
- if (!hasTeams) return [];
155
- return context.security.listTeams({
156
- where: {
157
- id_in: user.teams
158
- }
159
- });
160
- }
161
- }
162
- }
163
- })
164
- ].filter(Boolean);
165
- export { createUsersGraphQL };
166
-
167
- //# sourceMappingURL=user.gql.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"graphql/users/user.gql.js","sources":["../../../src/graphql/users/user.gql.ts"],"sourcesContent":["import {\n ErrorResponse,\n ListErrorResponse,\n ListResponse,\n NotFoundResponse,\n Response\n} from \"@webiny/handler-graphql/responses.js\";\nimport { GraphQLSchemaPlugin } from \"@webiny/handler-graphql/plugins/GraphQLSchemaPlugin.js\";\nimport type { ApiCoreContext } from \"~/types/core.js\";\nimport { 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\";\n\nconst emptyResolver = () => ({});\n\nexport const createUsersGraphQL = () => {\n return [\n new GraphQLSchemaPlugin<ApiCoreContext>({\n typeDefs: /* 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 resolvers: {\n Query: {\n adminUsers: emptyResolver\n },\n Mutation: {\n adminUsers: emptyResolver\n }\n }\n }),\n new GraphQLSchemaPlugin<ApiCoreContext>({\n typeDefs: /* GraphQL */ `\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 resolvers: {\n AdminUser: {\n roles(user: AdminUser, _, context) {\n if (!user.roles) {\n return null;\n }\n\n return context.security.listRoles({ where: { id_in: user.roles } });\n }\n },\n AdminUsersQuery: {\n getUser: async (_, { where }: any, context) => {\n const getUser = context.container.resolve(GetUserUseCase);\n\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 getCurrentUser: async (_, __, context) => {\n const identity = context.security.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\n const getUser = context.container.resolve(GetUserUseCase);\n\n const userResponse = await context.security.withoutAuthorization(\n async () => {\n // Get user record using the identity ID.\n return await getUser.execute({ id: identity.id });\n }\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 listUsers: async (_, __, context) => {\n const listUsers = context.container.resolve(ListUsersUseCase);\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 }),\n new GraphQLSchemaPlugin<ApiCoreContext>({\n typeDefs: /* GraphQL */ `\n extend type AdminUser {\n teams: [SecurityTeam]\n }\n `,\n resolvers: {\n AdminUser: {\n teams(user: AdminUser, _, context) {\n const hasTeams = Array.isArray(user.teams) && user.teams.length > 0;\n if (!hasTeams) {\n return [];\n }\n\n return context.security.listTeams({ where: { id_in: user.teams } });\n }\n }\n }\n })\n ].filter(Boolean);\n};\n"],"names":["emptyResolver","createUsersGraphQL","GraphQLSchemaPlugin","user","_","context","where","getUser","GetUserUseCase","userResult","error","NotFoundResponse","JSON","ErrorResponse","Response","__","identity","NotAuthorizedResponse","userResponse","listUsers","ListUsersUseCase","users","ListErrorResponse","ListResponse","hasTeams","Array","Boolean"],"mappings":";;;;;AAcA,MAAMA,gBAAgB,IAAO,EAAC;AAEvB,MAAMC,qBAAqB,IACvB;QACH,IAAIC,oBAAoC;YACpC,UAAwB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAiCzB,CAAC;YACD,WAAW;gBACP,OAAO;oBACH,YAAYF;gBAChB;gBACA,UAAU;oBACN,YAAYA;gBAChB;YACJ;QACJ;QACA,IAAIE,oBAAoC;YACpC,UAAwB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAkCzB,CAAC;YACD,WAAW;gBACP,WAAW;oBACP,OAAMC,IAAe,EAAEC,CAAC,EAAEC,OAAO;wBAC7B,IAAI,CAACF,KAAK,KAAK,EACX,OAAO;wBAGX,OAAOE,QAAQ,QAAQ,CAAC,SAAS,CAAC;4BAAE,OAAO;gCAAE,OAAOF,KAAK,KAAK;4BAAC;wBAAE;oBACrE;gBACJ;gBACA,iBAAiB;oBACb,SAAS,OAAOC,GAAG,EAAEE,KAAK,EAAO,EAAED;wBAC/B,MAAME,UAAUF,QAAQ,SAAS,CAAC,OAAO,CAACG;wBAE1C,MAAMC,aAAa,MAAMF,QAAQ,OAAO,CAAC;4BACrC,IAAID,MAAM,EAAE;4BACZ,OAAOA,MAAM,KAAK;wBACtB;wBAEA,IAAIG,WAAW,MAAM,IAAI;4BACrB,MAAMC,QAAQD,WAAW,KAAK;4BAC9B,IAAIC,AAAe,yBAAfA,MAAM,IAAI,EACV,OAAO,IAAIC,iBACP,CAAC,MAAM,EAAEC,KAAK,SAAS,CAACN,OAAO,gBAAgB,CAAC;4BAIxD,OAAO,IAAIO,cAAc;gCACrB,SAASH,MAAM,OAAO;gCACtB,MAAMA,MAAM,IAAI;gCAChB,MAAMA,MAAM,IAAI;4BACpB;wBACJ;wBAEA,OAAO,IAAII,SAASL,WAAW,KAAK;oBACxC;oBACA,gBAAgB,OAAOL,GAAGW,IAAIV;wBAC1B,MAAMW,WAAWX,QAAQ,QAAQ,CAAC,WAAW;wBAE7C,IAAI,CAACW,SAAS,OAAO,IACjB,MAAM,IAAIC;wBAMd,MAAMV,UAAUF,QAAQ,SAAS,CAAC,OAAO,CAACG;wBAE1C,MAAMU,eAAe,MAAMb,QAAQ,QAAQ,CAAC,oBAAoB,CAC5D,UAEW,MAAME,QAAQ,OAAO,CAAC;gCAAE,IAAIS,SAAS,EAAE;4BAAC;wBAIvD,IAAIE,aAAa,MAAM,IAAI;4BACvB,MAAMR,QAAQQ,aAAa,KAAK;4BAChC,IAAIR,AAAe,yBAAfA,MAAM,IAAI,EACV,OAAO,IAAIC,iBACP,CAAC,aAAa,EAAEK,SAAS,EAAE,CAAC,eAAe,CAAC;4BAIpD,OAAO,IAAIH,cAAc;gCACrB,SAASH,MAAM,OAAO;gCACtB,MAAMA,MAAM,IAAI;gCAChB,MAAMA,MAAM,IAAI;4BACpB;wBACJ;wBAEA,OAAO,IAAII,SAASI,aAAa,KAAK;oBAC1C;oBACA,WAAW,OAAOd,GAAGW,IAAIV;wBACrB,MAAMc,YAAYd,QAAQ,SAAS,CAAC,OAAO,CAACe;wBAC5C,MAAMC,QAAQ,MAAMF,UAAU,OAAO;wBAErC,IAAIE,MAAM,MAAM,IACZ,OAAO,IAAIC,kBAAkBD,MAAM,KAAK;wBAG5C,OAAO,IAAIE,aAAaF,MAAM,KAAK;oBACvC;gBACJ;YACJ;QACJ;QACA,IAAInB,oBAAoC;YACpC,UAAwB,CAAC;;;;YAIzB,CAAC;YACD,WAAW;gBACP,WAAW;oBACP,OAAMC,IAAe,EAAEC,CAAC,EAAEC,OAAO;wBAC7B,MAAMmB,WAAWC,MAAM,OAAO,CAACtB,KAAK,KAAK,KAAKA,KAAK,KAAK,CAAC,MAAM,GAAG;wBAClE,IAAI,CAACqB,UACD,OAAO,EAAE;wBAGb,OAAOnB,QAAQ,QAAQ,CAAC,SAAS,CAAC;4BAAE,OAAO;gCAAE,OAAOF,KAAK,KAAK;4BAAC;wBAAE;oBACrE;gBACJ;YACJ;QACJ;KACH,CAAC,MAAM,CAACuB"}
@@ -1,2 +0,0 @@
1
- import { GraphQLSchemaPlugin } from "@webiny/handler-graphql/plugins/index.js";
2
- export declare const createWcpGraphQL: () => GraphQLSchemaPlugin<import("@webiny/api/types").Context>;
@@ -1 +0,0 @@
1
- {"version":3,"file":"graphql/wcp/graphql.js","sources":["../../../src/graphql/wcp/graphql.ts"],"sourcesContent":["import { GraphQLSchemaPlugin } from \"@webiny/handler-graphql/plugins/index.js\";\nimport { ErrorResponse, Response } from \"@webiny/handler-graphql/responses.js\";\nimport { WcpContext } from \"~/features/wcp/WcpContext/index.js\";\n\nconst emptyResolver = () => ({});\n\nexport const createWcpGraphQL = () => {\n return new GraphQLSchemaPlugin({\n typeDefs: /* GraphQL */ `\n type WcpProjectPackageFeaturesFeature {\n enabled: Boolean\n options: JSON\n }\n\n type WcpProjectPackageFeatures {\n seats: WcpProjectPackageFeaturesFeature\n multiTenancy: WcpProjectPackageFeaturesFeature\n advancedPublishingWorkflow: WcpProjectPackageFeaturesFeature\n advancedAccessControlLayer: WcpProjectPackageFeaturesFeature\n auditLogs: WcpProjectPackageFeaturesFeature\n recordLocking: WcpProjectPackageFeaturesFeature\n fileManager: WcpProjectPackageFeaturesFeature\n aiPowerups: WcpProjectPackageFeaturesFeature\n }\n\n type WcpProjectPackage {\n features: WcpProjectPackageFeatures\n }\n\n type WcpProject {\n orgId: ID\n projectId: ID\n package: WcpProjectPackage\n }\n\n type WcpError {\n code: String\n message: String\n data: JSON\n stack: String\n }\n\n type WcpProjectResponse {\n data: WcpProject\n error: WcpError\n }\n\n type WcpQuery {\n getProject: WcpProjectResponse\n }\n\n type WcpMutation {\n updateProject: WcpProjectResponse\n }\n\n extend type Query {\n wcp: WcpQuery\n }\n\n extend type Mutation {\n wcp: WcpMutation\n }\n `,\n resolvers: {\n Query: {\n wcp: emptyResolver\n },\n WcpQuery: {\n getProject: async (_, __, context) => {\n try {\n const wcpContext = context.container.resolve(WcpContext);\n const project = wcpContext.getProjectWithFeatureFlags();\n\n if (!project) {\n throw Error(`Could not get project!`);\n }\n\n return new Response(project);\n } catch (e) {\n return new ErrorResponse({\n code: \"COULD_NOT_GET_PROJECT\",\n message: e.message,\n data: null,\n stack: e.stack\n });\n }\n }\n }\n }\n });\n};\n"],"names":["emptyResolver","createWcpGraphQL","GraphQLSchemaPlugin","_","__","context","wcpContext","WcpContext","project","Error","Response","e","ErrorResponse"],"mappings":";;;AAIA,MAAMA,gBAAgB,IAAO,EAAC;AAEvB,MAAMC,mBAAmB,IACrB,IAAIC,oBAAoB;QAC3B,UAAwB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAsDzB,CAAC;QACD,WAAW;YACP,OAAO;gBACH,KAAKF;YACT;YACA,UAAU;gBACN,YAAY,OAAOG,GAAGC,IAAIC;oBACtB,IAAI;wBACA,MAAMC,aAAaD,QAAQ,SAAS,CAAC,OAAO,CAACE;wBAC7C,MAAMC,UAAUF,WAAW,0BAA0B;wBAErD,IAAI,CAACE,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;YACJ;QACJ;IACJ"}
@@ -1,36 +0,0 @@
1
- import { type Container } from "@webiny/di";
2
- import type { SecurityIdentity, SecurityPermission } from "../../types/security.js";
3
- import { Authenticator } from "../../features/security/authentication/Authenticator/index.js";
4
- /**
5
- * Legacy bridge that implements the old Security interface.
6
- * As we implement each phase, we'll replace forwarding with delegation.
7
- */
8
- export declare class LegacyContext {
9
- private container;
10
- constructor(container: Container);
11
- private get identityContext();
12
- private get authenticationContext();
13
- addAuthenticator(authenticator: Authenticator.Interface["authenticate"]): void;
14
- authenticate(token: string): Promise<void>;
15
- getIdentity(): SecurityIdentity;
16
- setIdentity(identity: SecurityIdentity): void;
17
- getToken(): string | undefined;
18
- isAuthorizationEnabled(): boolean;
19
- withoutAuthorization<T = any>(cb: () => Promise<T>): Promise<T>;
20
- withIdentity<T = any>(identity: SecurityIdentity | undefined, cb: () => Promise<T>): Promise<T>;
21
- getPermission<TPermission extends SecurityPermission = SecurityPermission>(permission: string): Promise<TPermission | null>;
22
- getPermissions<TPermission extends SecurityPermission = SecurityPermission>(permission: string): Promise<TPermission[]>;
23
- listPermissions(): Promise<SecurityPermission[]>;
24
- hasFullAccess(): Promise<boolean>;
25
- getRole(params: any): Promise<import("~/types/security.js").Role>;
26
- listRoles(params?: any): Promise<import("~/types/security.js").Role[]>;
27
- createRole(input: any): Promise<import("~/types/security.js").Role>;
28
- updateRole(id: string, input: any): Promise<import("~/types/security.js").Role>;
29
- deleteRole(id: string): Promise<void>;
30
- addAuthorizer(authorizer: any): void;
31
- getTeam(params: any): Promise<import("~/types/security.js").Team>;
32
- listTeams(params?: any): Promise<import("~/types/security.js").Team[]>;
33
- createTeam(input: any): Promise<import("~/types/security.js").Team>;
34
- updateTeam(id: string, input: any): Promise<import("~/types/security.js").Team>;
35
- deleteTeam(id: string): Promise<void>;
36
- }