@webiny/app-admin 6.6.0-alpha.10 → 6.6.0-alpha.11
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.
- package/features/accessManagement/roles/roleEvents/AddCreatedRoleToCache.d.ts +12 -0
- package/features/accessManagement/roles/roleEvents/AddCreatedRoleToCache.js +18 -0
- package/features/accessManagement/roles/roleEvents/AddCreatedRoleToCache.js.map +1 -0
- package/features/accessManagement/roles/roleEvents/RefreshRoleInCacheRepository.d.ts +18 -0
- package/features/accessManagement/roles/roleEvents/RefreshRoleInCacheRepository.js +26 -0
- package/features/accessManagement/roles/roleEvents/RefreshRoleInCacheRepository.js.map +1 -0
- package/features/accessManagement/roles/roleEvents/RefreshUpdatedRoleInCache.d.ts +12 -0
- package/features/accessManagement/roles/roleEvents/RefreshUpdatedRoleInCache.js +18 -0
- package/features/accessManagement/roles/roleEvents/RefreshUpdatedRoleInCache.js.map +1 -0
- package/features/accessManagement/roles/roleEvents/RemoveDeletedRoleFromCache.d.ts +12 -0
- package/features/accessManagement/roles/roleEvents/RemoveDeletedRoleFromCache.js +20 -0
- package/features/accessManagement/roles/roleEvents/RemoveDeletedRoleFromCache.js.map +1 -0
- package/features/accessManagement/roles/roleEvents/RoleCreatedEvent.d.ts +14 -0
- package/features/accessManagement/roles/roleEvents/RoleCreatedEvent.js +13 -0
- package/features/accessManagement/roles/roleEvents/RoleCreatedEvent.js.map +1 -0
- package/features/accessManagement/roles/roleEvents/RoleDeletedEvent.d.ts +9 -0
- package/features/accessManagement/roles/roleEvents/RoleDeletedEvent.js +13 -0
- package/features/accessManagement/roles/roleEvents/RoleDeletedEvent.js.map +1 -0
- package/features/accessManagement/roles/roleEvents/RoleUpdatedEvent.d.ts +9 -0
- package/features/accessManagement/roles/roleEvents/RoleUpdatedEvent.js +13 -0
- package/features/accessManagement/roles/roleEvents/RoleUpdatedEvent.js.map +1 -0
- package/features/accessManagement/roles/roleEvents/RoleWebsocketMessages.d.ts +12 -0
- package/features/accessManagement/roles/roleEvents/RoleWebsocketMessages.js +49 -0
- package/features/accessManagement/roles/roleEvents/RoleWebsocketMessages.js.map +1 -0
- package/features/accessManagement/roles/roleEvents/abstractions.d.ts +33 -0
- package/features/accessManagement/roles/roleEvents/abstractions.js +8 -0
- package/features/accessManagement/roles/roleEvents/abstractions.js.map +1 -0
- package/features/accessManagement/roles/roleEvents/feature.d.ts +5 -0
- package/features/accessManagement/roles/roleEvents/feature.js +19 -0
- package/features/accessManagement/roles/roleEvents/feature.js.map +1 -0
- package/features/accessManagement/roles/roleEvents/index.d.ts +1 -0
- package/features/accessManagement/roles/roleEvents/index.js +1 -0
- package/features/accessManagement/teams/teamEvents/AddCreatedTeamToCache.d.ts +12 -0
- package/features/accessManagement/teams/teamEvents/AddCreatedTeamToCache.js +18 -0
- package/features/accessManagement/teams/teamEvents/AddCreatedTeamToCache.js.map +1 -0
- package/features/accessManagement/teams/teamEvents/RefreshTeamInCacheRepository.d.ts +18 -0
- package/features/accessManagement/teams/teamEvents/RefreshTeamInCacheRepository.js +26 -0
- package/features/accessManagement/teams/teamEvents/RefreshTeamInCacheRepository.js.map +1 -0
- package/features/accessManagement/teams/teamEvents/RefreshUpdatedTeamInCache.d.ts +12 -0
- package/features/accessManagement/teams/teamEvents/RefreshUpdatedTeamInCache.js +18 -0
- package/features/accessManagement/teams/teamEvents/RefreshUpdatedTeamInCache.js.map +1 -0
- package/features/accessManagement/teams/teamEvents/RemoveDeletedTeamFromCache.d.ts +12 -0
- package/features/accessManagement/teams/teamEvents/RemoveDeletedTeamFromCache.js +20 -0
- package/features/accessManagement/teams/teamEvents/RemoveDeletedTeamFromCache.js.map +1 -0
- package/features/accessManagement/teams/teamEvents/TeamCreatedEvent.d.ts +14 -0
- package/features/accessManagement/teams/teamEvents/TeamCreatedEvent.js +13 -0
- package/features/accessManagement/teams/teamEvents/TeamCreatedEvent.js.map +1 -0
- package/features/accessManagement/teams/teamEvents/TeamDeletedEvent.d.ts +9 -0
- package/features/accessManagement/teams/teamEvents/TeamDeletedEvent.js +13 -0
- package/features/accessManagement/teams/teamEvents/TeamDeletedEvent.js.map +1 -0
- package/features/accessManagement/teams/teamEvents/TeamUpdatedEvent.d.ts +9 -0
- package/features/accessManagement/teams/teamEvents/TeamUpdatedEvent.js +13 -0
- package/features/accessManagement/teams/teamEvents/TeamUpdatedEvent.js.map +1 -0
- package/features/accessManagement/teams/teamEvents/TeamWebsocketMessages.d.ts +12 -0
- package/features/accessManagement/teams/teamEvents/TeamWebsocketMessages.js +48 -0
- package/features/accessManagement/teams/teamEvents/TeamWebsocketMessages.js.map +1 -0
- package/features/accessManagement/teams/teamEvents/abstractions.d.ts +33 -0
- package/features/accessManagement/teams/teamEvents/abstractions.js +8 -0
- package/features/accessManagement/teams/teamEvents/abstractions.js.map +1 -0
- package/features/accessManagement/teams/teamEvents/feature.d.ts +5 -0
- package/features/accessManagement/teams/teamEvents/feature.js +19 -0
- package/features/accessManagement/teams/teamEvents/feature.js.map +1 -0
- package/features/accessManagement/teams/teamEvents/index.d.ts +1 -0
- package/features/accessManagement/teams/teamEvents/index.js +1 -0
- package/features/adminAssistant/AdminAssistantGateway.js +3 -3
- package/features/adminAssistant/AdminAssistantGateway.js.map +1 -1
- package/features/adminAssistant/AdminAssistantPresenter.d.ts +8 -12
- package/features/adminAssistant/AdminAssistantPresenter.js +45 -87
- package/features/adminAssistant/AdminAssistantPresenter.js.map +1 -1
- package/features/adminAssistant/abstractions.d.ts +28 -23
- package/features/adminAssistant/abstractions.js.map +1 -1
- package/features/adminAssistant/turnsFromMessages.d.ts +4 -7
- package/features/adminAssistant/turnsFromMessages.js +0 -2
- package/features/adminAssistant/turnsFromMessages.js.map +1 -1
- package/features/aiChats/AiChatsGateway.d.ts +0 -3
- package/features/aiChats/AiChatsGateway.js +1 -26
- package/features/aiChats/AiChatsGateway.js.map +1 -1
- package/features/aiChats/AiChatsRepository.d.ts +1 -3
- package/features/aiChats/AiChatsRepository.js +9 -28
- package/features/aiChats/AiChatsRepository.js.map +1 -1
- package/features/aiChats/abstractions.d.ts +7 -19
- package/features/aiChats/abstractions.js.map +1 -1
- package/features/aiChats/index.d.ts +0 -2
- package/features/aiChats/index.js +0 -1
- package/index.d.ts +1 -1
- package/modules/AccessManagementExtension.js +6 -0
- package/modules/AccessManagementExtension.js.map +1 -1
- package/package.json +20 -20
- package/features/aiChats/AiChatSaveError.d.ts +0 -6
- package/features/aiChats/AiChatSaveError.js +0 -8
- package/features/aiChats/AiChatSaveError.js.map +0 -1
- package/features/aiChats/AiChatsRequestError.d.ts +0 -9
- package/features/aiChats/AiChatsRequestError.js +0 -8
- package/features/aiChats/AiChatsRequestError.js.map +0 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { RefreshRoleInCacheRepository } from "./abstractions.js";
|
|
2
|
+
import { RoleCreatedEventHandler } from "./abstractions.js";
|
|
3
|
+
/** Adds the created role to the roles list cache, which the Roles view renders from. */
|
|
4
|
+
declare class AddCreatedRoleToCacheImpl implements RoleCreatedEventHandler.Interface {
|
|
5
|
+
private repository;
|
|
6
|
+
constructor(repository: RefreshRoleInCacheRepository.Interface);
|
|
7
|
+
handle(event: RoleCreatedEventHandler.Event): Promise<void>;
|
|
8
|
+
}
|
|
9
|
+
export declare const AddCreatedRoleToCache: typeof AddCreatedRoleToCacheImpl & {
|
|
10
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/app/features/eventPublisher/abstractions.js").IEventHandler<import("./RoleCreatedEvent.js").RoleCreatedEvent>>;
|
|
11
|
+
};
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { RefreshRoleInCacheRepository, RoleCreatedEventHandler } from "./abstractions.js";
|
|
2
|
+
class AddCreatedRoleToCacheImpl {
|
|
3
|
+
constructor(repository){
|
|
4
|
+
this.repository = repository;
|
|
5
|
+
}
|
|
6
|
+
async handle(event) {
|
|
7
|
+
await this.repository.execute(event.payload.id);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
const AddCreatedRoleToCache = RoleCreatedEventHandler.createImplementation({
|
|
11
|
+
implementation: AddCreatedRoleToCacheImpl,
|
|
12
|
+
dependencies: [
|
|
13
|
+
RefreshRoleInCacheRepository
|
|
14
|
+
]
|
|
15
|
+
});
|
|
16
|
+
export { AddCreatedRoleToCache };
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=AddCreatedRoleToCache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/accessManagement/roles/roleEvents/AddCreatedRoleToCache.js","sources":["../../../../../src/features/accessManagement/roles/roleEvents/AddCreatedRoleToCache.ts"],"sourcesContent":["import { RefreshRoleInCacheRepository } from \"./abstractions.js\";\nimport { RoleCreatedEventHandler } from \"./abstractions.js\";\n\n/** Adds the created role to the roles list cache, which the Roles view renders from. */\nclass AddCreatedRoleToCacheImpl implements RoleCreatedEventHandler.Interface {\n constructor(private repository: RefreshRoleInCacheRepository.Interface) {}\n\n async handle(event: RoleCreatedEventHandler.Event): Promise<void> {\n await this.repository.execute(event.payload.id);\n }\n}\n\nexport const AddCreatedRoleToCache = RoleCreatedEventHandler.createImplementation({\n implementation: AddCreatedRoleToCacheImpl,\n dependencies: [RefreshRoleInCacheRepository]\n});\n"],"names":["AddCreatedRoleToCacheImpl","repository","event","AddCreatedRoleToCache","RoleCreatedEventHandler","RefreshRoleInCacheRepository"],"mappings":";AAIA,MAAMA;IACF,YAAoBC,UAAkD,CAAE;aAApDA,UAAU,GAAVA;IAAqD;IAEzE,MAAM,OAAOC,KAAoC,EAAiB;QAC9D,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,CAACA,MAAM,OAAO,CAAC,EAAE;IAClD;AACJ;AAEO,MAAMC,wBAAwBC,wBAAwB,oBAAoB,CAAC;IAC9E,gBAAgBJ;IAChB,cAAc;QAACK;KAA6B;AAChD"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { GetRoleGateway } from "../getRole/abstractions.js";
|
|
2
|
+
import { RolesListCache } from "../listRoles/abstractions.js";
|
|
3
|
+
import { RefreshRoleInCacheRepository as RepositoryAbstraction } from "./abstractions.js";
|
|
4
|
+
/**
|
|
5
|
+
* Read back rather than taken from the message, so the role has the same fields as one the admin loads
|
|
6
|
+
* itself. A role the list already has is replaced where it is, so an update does not move its row; a
|
|
7
|
+
* new one is added.
|
|
8
|
+
*/
|
|
9
|
+
declare class RefreshRoleInCacheRepositoryImpl implements RepositoryAbstraction.Interface {
|
|
10
|
+
private gateway;
|
|
11
|
+
private cache;
|
|
12
|
+
constructor(gateway: GetRoleGateway.Interface, cache: RolesListCache.Interface);
|
|
13
|
+
execute(id: string): Promise<void>;
|
|
14
|
+
}
|
|
15
|
+
export declare const RefreshRoleInCacheRepository: typeof RefreshRoleInCacheRepositoryImpl & {
|
|
16
|
+
__abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").IRefreshRoleInCacheRepository>;
|
|
17
|
+
};
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { GetRoleGateway } from "../getRole/abstractions.js";
|
|
2
|
+
import { RolesListCache } from "../listRoles/abstractions.js";
|
|
3
|
+
import { RefreshRoleInCacheRepository } from "./abstractions.js";
|
|
4
|
+
class RefreshRoleInCacheRepositoryImpl {
|
|
5
|
+
constructor(gateway, cache){
|
|
6
|
+
this.gateway = gateway;
|
|
7
|
+
this.cache = cache;
|
|
8
|
+
}
|
|
9
|
+
async execute(id) {
|
|
10
|
+
const role = await this.gateway.execute(id);
|
|
11
|
+
if (this.cache.getItem((item)=>item.id === id)) return void this.cache.updateItems((item)=>item.id === id ? role : item);
|
|
12
|
+
this.cache.addItems([
|
|
13
|
+
role
|
|
14
|
+
]);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
const RefreshRoleInCacheRepository_RefreshRoleInCacheRepository = RefreshRoleInCacheRepository.createImplementation({
|
|
18
|
+
implementation: RefreshRoleInCacheRepositoryImpl,
|
|
19
|
+
dependencies: [
|
|
20
|
+
GetRoleGateway,
|
|
21
|
+
RolesListCache
|
|
22
|
+
]
|
|
23
|
+
});
|
|
24
|
+
export { RefreshRoleInCacheRepository_RefreshRoleInCacheRepository as RefreshRoleInCacheRepository };
|
|
25
|
+
|
|
26
|
+
//# sourceMappingURL=RefreshRoleInCacheRepository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/accessManagement/roles/roleEvents/RefreshRoleInCacheRepository.js","sources":["../../../../../src/features/accessManagement/roles/roleEvents/RefreshRoleInCacheRepository.ts"],"sourcesContent":["import { GetRoleGateway } from \"../getRole/abstractions.js\";\nimport { RolesListCache } from \"../listRoles/abstractions.js\";\nimport { RefreshRoleInCacheRepository as RepositoryAbstraction } from \"./abstractions.js\";\n\n/**\n * Read back rather than taken from the message, so the role has the same fields as one the admin loads\n * itself. A role the list already has is replaced where it is, so an update does not move its row; a\n * new one is added.\n */\nclass RefreshRoleInCacheRepositoryImpl implements RepositoryAbstraction.Interface {\n constructor(\n private gateway: GetRoleGateway.Interface,\n private cache: RolesListCache.Interface\n ) {}\n\n async execute(id: string): Promise<void> {\n const role = await this.gateway.execute(id);\n\n if (this.cache.getItem(item => item.id === id)) {\n this.cache.updateItems(item => (item.id === id ? role : item));\n return;\n }\n\n this.cache.addItems([role]);\n }\n}\n\nexport const RefreshRoleInCacheRepository = RepositoryAbstraction.createImplementation({\n implementation: RefreshRoleInCacheRepositoryImpl,\n dependencies: [GetRoleGateway, RolesListCache]\n});\n"],"names":["RefreshRoleInCacheRepositoryImpl","gateway","cache","id","role","item","RefreshRoleInCacheRepository","RepositoryAbstraction","GetRoleGateway","RolesListCache"],"mappings":";;;AASA,MAAMA;IACF,YACYC,OAAiC,EACjCC,KAA+B,CACzC;aAFUD,OAAO,GAAPA;aACAC,KAAK,GAALA;IACT;IAEH,MAAM,QAAQC,EAAU,EAAiB;QACrC,MAAMC,OAAO,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAACD;QAExC,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAACE,CAAAA,OAAQA,KAAK,EAAE,KAAKF,KAAK,YAC5C,IAAI,CAAC,KAAK,CAAC,WAAW,CAACE,CAAAA,OAASA,KAAK,EAAE,KAAKF,KAAKC,OAAOC;QAI5D,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;YAACD;SAAK;IAC9B;AACJ;AAEO,MAAME,4DAA+BC,6BAAAA,oBAA0C,CAAC;IACnF,gBAAgBP;IAChB,cAAc;QAACQ;QAAgBC;KAAe;AAClD"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { RefreshRoleInCacheRepository } from "./abstractions.js";
|
|
2
|
+
import { RoleUpdatedEventHandler } from "./abstractions.js";
|
|
3
|
+
/** Replaces the updated role in the roles list cache with what the server now has. */
|
|
4
|
+
declare class RefreshUpdatedRoleInCacheImpl implements RoleUpdatedEventHandler.Interface {
|
|
5
|
+
private repository;
|
|
6
|
+
constructor(repository: RefreshRoleInCacheRepository.Interface);
|
|
7
|
+
handle(event: RoleUpdatedEventHandler.Event): Promise<void>;
|
|
8
|
+
}
|
|
9
|
+
export declare const RefreshUpdatedRoleInCache: typeof RefreshUpdatedRoleInCacheImpl & {
|
|
10
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/app/features/eventPublisher/abstractions.js").IEventHandler<import("./RoleUpdatedEvent.js").RoleUpdatedEvent>>;
|
|
11
|
+
};
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { RefreshRoleInCacheRepository, RoleUpdatedEventHandler } from "./abstractions.js";
|
|
2
|
+
class RefreshUpdatedRoleInCacheImpl {
|
|
3
|
+
constructor(repository){
|
|
4
|
+
this.repository = repository;
|
|
5
|
+
}
|
|
6
|
+
async handle(event) {
|
|
7
|
+
await this.repository.execute(event.payload.id);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
const RefreshUpdatedRoleInCache = RoleUpdatedEventHandler.createImplementation({
|
|
11
|
+
implementation: RefreshUpdatedRoleInCacheImpl,
|
|
12
|
+
dependencies: [
|
|
13
|
+
RefreshRoleInCacheRepository
|
|
14
|
+
]
|
|
15
|
+
});
|
|
16
|
+
export { RefreshUpdatedRoleInCache };
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=RefreshUpdatedRoleInCache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/accessManagement/roles/roleEvents/RefreshUpdatedRoleInCache.js","sources":["../../../../../src/features/accessManagement/roles/roleEvents/RefreshUpdatedRoleInCache.ts"],"sourcesContent":["import { RefreshRoleInCacheRepository } from \"./abstractions.js\";\nimport { RoleUpdatedEventHandler } from \"./abstractions.js\";\n\n/** Replaces the updated role in the roles list cache with what the server now has. */\nclass RefreshUpdatedRoleInCacheImpl implements RoleUpdatedEventHandler.Interface {\n constructor(private repository: RefreshRoleInCacheRepository.Interface) {}\n\n async handle(event: RoleUpdatedEventHandler.Event): Promise<void> {\n await this.repository.execute(event.payload.id);\n }\n}\n\nexport const RefreshUpdatedRoleInCache = RoleUpdatedEventHandler.createImplementation({\n implementation: RefreshUpdatedRoleInCacheImpl,\n dependencies: [RefreshRoleInCacheRepository]\n});\n"],"names":["RefreshUpdatedRoleInCacheImpl","repository","event","RefreshUpdatedRoleInCache","RoleUpdatedEventHandler","RefreshRoleInCacheRepository"],"mappings":";AAIA,MAAMA;IACF,YAAoBC,UAAkD,CAAE;aAApDA,UAAU,GAAVA;IAAqD;IAEzE,MAAM,OAAOC,KAAoC,EAAiB;QAC9D,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,CAACA,MAAM,OAAO,CAAC,EAAE;IAClD;AACJ;AAEO,MAAMC,4BAA4BC,wBAAwB,oBAAoB,CAAC;IAClF,gBAAgBJ;IAChB,cAAc;QAACK;KAA6B;AAChD"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { RolesListCache } from "../listRoles/abstractions.js";
|
|
2
|
+
import { RoleDeletedEventHandler } from "./abstractions.js";
|
|
3
|
+
/** Takes the deleted role out of the roles list cache. A deleted role cannot be read back. */
|
|
4
|
+
declare class RemoveDeletedRoleFromCacheImpl implements RoleDeletedEventHandler.Interface {
|
|
5
|
+
private cache;
|
|
6
|
+
constructor(cache: RolesListCache.Interface);
|
|
7
|
+
handle(event: RoleDeletedEventHandler.Event): Promise<void>;
|
|
8
|
+
}
|
|
9
|
+
export declare const RemoveDeletedRoleFromCache: typeof RemoveDeletedRoleFromCacheImpl & {
|
|
10
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/app/features/eventPublisher/abstractions.js").IEventHandler<import("./RoleDeletedEvent.js").RoleDeletedEvent>>;
|
|
11
|
+
};
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { RolesListCache } from "../listRoles/abstractions.js";
|
|
2
|
+
import { RoleDeletedEventHandler } from "./abstractions.js";
|
|
3
|
+
class RemoveDeletedRoleFromCacheImpl {
|
|
4
|
+
constructor(cache){
|
|
5
|
+
this.cache = cache;
|
|
6
|
+
}
|
|
7
|
+
async handle(event) {
|
|
8
|
+
const { id } = event.payload;
|
|
9
|
+
this.cache.removeItems((role)=>role.id === id);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
const RemoveDeletedRoleFromCache = RoleDeletedEventHandler.createImplementation({
|
|
13
|
+
implementation: RemoveDeletedRoleFromCacheImpl,
|
|
14
|
+
dependencies: [
|
|
15
|
+
RolesListCache
|
|
16
|
+
]
|
|
17
|
+
});
|
|
18
|
+
export { RemoveDeletedRoleFromCache };
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=RemoveDeletedRoleFromCache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/accessManagement/roles/roleEvents/RemoveDeletedRoleFromCache.js","sources":["../../../../../src/features/accessManagement/roles/roleEvents/RemoveDeletedRoleFromCache.ts"],"sourcesContent":["import { RolesListCache } from \"../listRoles/abstractions.js\";\nimport { RoleDeletedEventHandler } from \"./abstractions.js\";\n\n/** Takes the deleted role out of the roles list cache. A deleted role cannot be read back. */\nclass RemoveDeletedRoleFromCacheImpl implements RoleDeletedEventHandler.Interface {\n constructor(private cache: RolesListCache.Interface) {}\n\n async handle(event: RoleDeletedEventHandler.Event): Promise<void> {\n const { id } = event.payload;\n this.cache.removeItems(role => role.id === id);\n }\n}\n\nexport const RemoveDeletedRoleFromCache = RoleDeletedEventHandler.createImplementation({\n implementation: RemoveDeletedRoleFromCacheImpl,\n dependencies: [RolesListCache]\n});\n"],"names":["RemoveDeletedRoleFromCacheImpl","cache","event","id","role","RemoveDeletedRoleFromCache","RoleDeletedEventHandler","RolesListCache"],"mappings":";;AAIA,MAAMA;IACF,YAAoBC,KAA+B,CAAE;aAAjCA,KAAK,GAALA;IAAkC;IAEtD,MAAM,OAAOC,KAAoC,EAAiB;QAC9D,MAAM,EAAEC,EAAE,EAAE,GAAGD,MAAM,OAAO;QAC5B,IAAI,CAAC,KAAK,CAAC,WAAW,CAACE,CAAAA,OAAQA,KAAK,EAAE,KAAKD;IAC/C;AACJ;AAEO,MAAME,6BAA6BC,wBAAwB,oBAAoB,CAAC;IACnF,gBAAgBN;IAChB,cAAc;QAACO;KAAe;AAClC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BaseEvent } from "@webiny/app/features/eventPublisher/index.js";
|
|
2
|
+
export interface RoleCreatedPayload {
|
|
3
|
+
id: string;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* A role now exists that the admin's roles list may not have.
|
|
7
|
+
*
|
|
8
|
+
* Says nothing about where the news came from. The websocket is the source today
|
|
9
|
+
* (`RoleWebsocketMessages`); anything else can publish it and the handlers stay as they are.
|
|
10
|
+
*/
|
|
11
|
+
export declare class RoleCreatedEvent extends BaseEvent<RoleCreatedPayload> {
|
|
12
|
+
readonly eventType: "AccessManagement/RoleCreated";
|
|
13
|
+
getHandlerAbstraction(): import("@webiny/di").Abstraction<import("@webiny/app/features/eventPublisher/abstractions.js").IEventHandler<RoleCreatedEvent>>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { BaseEvent } from "@webiny/app/features/eventPublisher/index.js";
|
|
2
|
+
import { RoleCreatedEventHandler } from "./abstractions.js";
|
|
3
|
+
class RoleCreatedEvent extends BaseEvent {
|
|
4
|
+
getHandlerAbstraction() {
|
|
5
|
+
return RoleCreatedEventHandler;
|
|
6
|
+
}
|
|
7
|
+
constructor(...args){
|
|
8
|
+
super(...args), this.eventType = "AccessManagement/RoleCreated";
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
export { RoleCreatedEvent };
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=RoleCreatedEvent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/accessManagement/roles/roleEvents/RoleCreatedEvent.js","sources":["../../../../../src/features/accessManagement/roles/roleEvents/RoleCreatedEvent.ts"],"sourcesContent":["import { BaseEvent } from \"@webiny/app/features/eventPublisher/index.js\";\nimport { RoleCreatedEventHandler } from \"./abstractions.js\";\n\nexport interface RoleCreatedPayload {\n id: string;\n}\n\n/**\n * A role now exists that the admin's roles list may not have.\n *\n * Says nothing about where the news came from. The websocket is the source today\n * (`RoleWebsocketMessages`); anything else can publish it and the handlers stay as they are.\n */\nexport class RoleCreatedEvent extends BaseEvent<RoleCreatedPayload> {\n readonly eventType = \"AccessManagement/RoleCreated\" as const;\n\n getHandlerAbstraction() {\n return RoleCreatedEventHandler;\n }\n}\n"],"names":["RoleCreatedEvent","BaseEvent","RoleCreatedEventHandler"],"mappings":";;AAaO,MAAMA,yBAAyBC;IAGlC,wBAAwB;QACpB,OAAOC;IACX;;QALG,qBACM,SAAS,GAAG;;AAKzB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BaseEvent } from "@webiny/app/features/eventPublisher/index.js";
|
|
2
|
+
export interface RoleDeletedPayload {
|
|
3
|
+
id: string;
|
|
4
|
+
}
|
|
5
|
+
/** A role no longer exists, and the admin's roles list may still hold it. */
|
|
6
|
+
export declare class RoleDeletedEvent extends BaseEvent<RoleDeletedPayload> {
|
|
7
|
+
readonly eventType: "AccessManagement/RoleDeleted";
|
|
8
|
+
getHandlerAbstraction(): import("@webiny/di").Abstraction<import("@webiny/app/features/eventPublisher/abstractions.js").IEventHandler<RoleDeletedEvent>>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { BaseEvent } from "@webiny/app/features/eventPublisher/index.js";
|
|
2
|
+
import { RoleDeletedEventHandler } from "./abstractions.js";
|
|
3
|
+
class RoleDeletedEvent extends BaseEvent {
|
|
4
|
+
getHandlerAbstraction() {
|
|
5
|
+
return RoleDeletedEventHandler;
|
|
6
|
+
}
|
|
7
|
+
constructor(...args){
|
|
8
|
+
super(...args), this.eventType = "AccessManagement/RoleDeleted";
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
export { RoleDeletedEvent };
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=RoleDeletedEvent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/accessManagement/roles/roleEvents/RoleDeletedEvent.js","sources":["../../../../../src/features/accessManagement/roles/roleEvents/RoleDeletedEvent.ts"],"sourcesContent":["import { BaseEvent } from \"@webiny/app/features/eventPublisher/index.js\";\nimport { RoleDeletedEventHandler } from \"./abstractions.js\";\n\nexport interface RoleDeletedPayload {\n id: string;\n}\n\n/** A role no longer exists, and the admin's roles list may still hold it. */\nexport class RoleDeletedEvent extends BaseEvent<RoleDeletedPayload> {\n readonly eventType = \"AccessManagement/RoleDeleted\" as const;\n\n getHandlerAbstraction() {\n return RoleDeletedEventHandler;\n }\n}\n"],"names":["RoleDeletedEvent","BaseEvent","RoleDeletedEventHandler"],"mappings":";;AAQO,MAAMA,yBAAyBC;IAGlC,wBAAwB;QACpB,OAAOC;IACX;;QALG,qBACM,SAAS,GAAG;;AAKzB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BaseEvent } from "@webiny/app/features/eventPublisher/index.js";
|
|
2
|
+
export interface RoleUpdatedPayload {
|
|
3
|
+
id: string;
|
|
4
|
+
}
|
|
5
|
+
/** A role changed, and the admin's roles list may still hold the old copy. */
|
|
6
|
+
export declare class RoleUpdatedEvent extends BaseEvent<RoleUpdatedPayload> {
|
|
7
|
+
readonly eventType: "AccessManagement/RoleUpdated";
|
|
8
|
+
getHandlerAbstraction(): import("@webiny/di").Abstraction<import("@webiny/app/features/eventPublisher/abstractions.js").IEventHandler<RoleUpdatedEvent>>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { BaseEvent } from "@webiny/app/features/eventPublisher/index.js";
|
|
2
|
+
import { RoleUpdatedEventHandler } from "./abstractions.js";
|
|
3
|
+
class RoleUpdatedEvent extends BaseEvent {
|
|
4
|
+
getHandlerAbstraction() {
|
|
5
|
+
return RoleUpdatedEventHandler;
|
|
6
|
+
}
|
|
7
|
+
constructor(...args){
|
|
8
|
+
super(...args), this.eventType = "AccessManagement/RoleUpdated";
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
export { RoleUpdatedEvent };
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=RoleUpdatedEvent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/accessManagement/roles/roleEvents/RoleUpdatedEvent.js","sources":["../../../../../src/features/accessManagement/roles/roleEvents/RoleUpdatedEvent.ts"],"sourcesContent":["import { BaseEvent } from \"@webiny/app/features/eventPublisher/index.js\";\nimport { RoleUpdatedEventHandler } from \"./abstractions.js\";\n\nexport interface RoleUpdatedPayload {\n id: string;\n}\n\n/** A role changed, and the admin's roles list may still hold the old copy. */\nexport class RoleUpdatedEvent extends BaseEvent<RoleUpdatedPayload> {\n readonly eventType = \"AccessManagement/RoleUpdated\" as const;\n\n getHandlerAbstraction() {\n return RoleUpdatedEventHandler;\n }\n}\n"],"names":["RoleUpdatedEvent","BaseEvent","RoleUpdatedEventHandler"],"mappings":";;AAQO,MAAMA,yBAAyBC;IAGlC,wBAAwB;QACpB,OAAOC;IACX;;QALG,qBACM,SAAS,GAAG;;AAKzB"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { WebsocketEventHandler } from "@webiny/app/features/websocketEvents/index.js";
|
|
2
|
+
import { EventPublisher } from "@webiny/app/features/eventPublisher/index.js";
|
|
3
|
+
/** Turns the api's role messages into role events. */
|
|
4
|
+
declare class RoleWebsocketMessagesImpl implements WebsocketEventHandler.Interface {
|
|
5
|
+
private eventPublisher;
|
|
6
|
+
constructor(eventPublisher: EventPublisher.Interface);
|
|
7
|
+
handle(event: WebsocketEventHandler.Event): Promise<void>;
|
|
8
|
+
}
|
|
9
|
+
export declare const RoleWebsocketMessages: typeof RoleWebsocketMessagesImpl & {
|
|
10
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/app/features/eventPublisher/abstractions.js").IEventHandler<import("@webiny/app/features/websocketEvents/WebsocketEvent.js").WebsocketEvent>>;
|
|
11
|
+
};
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { WebsocketEventHandler } from "@webiny/app/features/websocketEvents/index.js";
|
|
2
|
+
import { EventPublisher } from "@webiny/app/features/eventPublisher/index.js";
|
|
3
|
+
import { RoleCreatedEvent } from "./RoleCreatedEvent.js";
|
|
4
|
+
import { RoleUpdatedEvent } from "./RoleUpdatedEvent.js";
|
|
5
|
+
import { RoleDeletedEvent } from "./RoleDeletedEvent.js";
|
|
6
|
+
const ROLE_CREATED_ACTION = "security.role.created";
|
|
7
|
+
const ROLE_UPDATED_ACTION = "security.role.updated";
|
|
8
|
+
const ROLE_DELETED_ACTION = "security.role.deleted";
|
|
9
|
+
const TO_EVENT = new Map([
|
|
10
|
+
[
|
|
11
|
+
ROLE_CREATED_ACTION,
|
|
12
|
+
(id)=>new RoleCreatedEvent({
|
|
13
|
+
id
|
|
14
|
+
})
|
|
15
|
+
],
|
|
16
|
+
[
|
|
17
|
+
ROLE_UPDATED_ACTION,
|
|
18
|
+
(id)=>new RoleUpdatedEvent({
|
|
19
|
+
id
|
|
20
|
+
})
|
|
21
|
+
],
|
|
22
|
+
[
|
|
23
|
+
ROLE_DELETED_ACTION,
|
|
24
|
+
(id)=>new RoleDeletedEvent({
|
|
25
|
+
id
|
|
26
|
+
})
|
|
27
|
+
]
|
|
28
|
+
]);
|
|
29
|
+
class RoleWebsocketMessagesImpl {
|
|
30
|
+
constructor(eventPublisher){
|
|
31
|
+
this.eventPublisher = eventPublisher;
|
|
32
|
+
}
|
|
33
|
+
async handle(event) {
|
|
34
|
+
const toEvent = TO_EVENT.get(event.payload.action);
|
|
35
|
+
if (!toEvent) return;
|
|
36
|
+
const { data } = event.payload;
|
|
37
|
+
const roleEvent = toEvent(data.id);
|
|
38
|
+
await this.eventPublisher.publish(roleEvent);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
const RoleWebsocketMessages = WebsocketEventHandler.createImplementation({
|
|
42
|
+
implementation: RoleWebsocketMessagesImpl,
|
|
43
|
+
dependencies: [
|
|
44
|
+
EventPublisher
|
|
45
|
+
]
|
|
46
|
+
});
|
|
47
|
+
export { RoleWebsocketMessages };
|
|
48
|
+
|
|
49
|
+
//# sourceMappingURL=RoleWebsocketMessages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/accessManagement/roles/roleEvents/RoleWebsocketMessages.js","sources":["../../../../../src/features/accessManagement/roles/roleEvents/RoleWebsocketMessages.ts"],"sourcesContent":["import { WebsocketEventHandler } from \"@webiny/app/features/websocketEvents/index.js\";\nimport { EventPublisher } from \"@webiny/app/features/eventPublisher/index.js\";\nimport type { BaseEvent } from \"@webiny/app/features/eventPublisher/index.js\";\nimport { RoleCreatedEvent } from \"./RoleCreatedEvent.js\";\nimport { RoleUpdatedEvent } from \"./RoleUpdatedEvent.js\";\nimport { RoleDeletedEvent } from \"./RoleDeletedEvent.js\";\n\n// Sent by the api when a role changes; see `NotifyRoleChangeUseCase` in @webiny/api-aco.\nconst ROLE_CREATED_ACTION = \"security.role.created\";\nconst ROLE_UPDATED_ACTION = \"security.role.updated\";\nconst ROLE_DELETED_ACTION = \"security.role.deleted\";\n\ninterface RoleMessageData {\n id: string;\n}\n\nconst TO_EVENT = new Map<string, (id: string) => BaseEvent<{ id: string }>>([\n [ROLE_CREATED_ACTION, id => new RoleCreatedEvent({ id })],\n [ROLE_UPDATED_ACTION, id => new RoleUpdatedEvent({ id })],\n [ROLE_DELETED_ACTION, id => new RoleDeletedEvent({ id })]\n]);\n\n/** Turns the api's role messages into role events. */\nclass RoleWebsocketMessagesImpl implements WebsocketEventHandler.Interface {\n constructor(private eventPublisher: EventPublisher.Interface) {}\n\n async handle(event: WebsocketEventHandler.Event): Promise<void> {\n const toEvent = TO_EVENT.get(event.payload.action);\n if (!toEvent) {\n return;\n }\n\n const { data } = event.payload as unknown as { data: RoleMessageData };\n const roleEvent = toEvent(data.id);\n await this.eventPublisher.publish(roleEvent);\n }\n}\n\nexport const RoleWebsocketMessages = WebsocketEventHandler.createImplementation({\n implementation: RoleWebsocketMessagesImpl,\n dependencies: [EventPublisher]\n});\n"],"names":["ROLE_CREATED_ACTION","ROLE_UPDATED_ACTION","ROLE_DELETED_ACTION","TO_EVENT","Map","id","RoleCreatedEvent","RoleUpdatedEvent","RoleDeletedEvent","RoleWebsocketMessagesImpl","eventPublisher","event","toEvent","data","roleEvent","RoleWebsocketMessages","WebsocketEventHandler","EventPublisher"],"mappings":";;;;;AAQA,MAAMA,sBAAsB;AAC5B,MAAMC,sBAAsB;AAC5B,MAAMC,sBAAsB;AAM5B,MAAMC,WAAW,IAAIC,IAAuD;IACxE;QAACJ;QAAqBK,CAAAA,KAAM,IAAIC,iBAAiB;gBAAED;YAAG;KAAG;IACzD;QAACJ;QAAqBI,CAAAA,KAAM,IAAIE,iBAAiB;gBAAEF;YAAG;KAAG;IACzD;QAACH;QAAqBG,CAAAA,KAAM,IAAIG,iBAAiB;gBAAEH;YAAG;KAAG;CAC5D;AAGD,MAAMI;IACF,YAAoBC,cAAwC,CAAE;aAA1CA,cAAc,GAAdA;IAA2C;IAE/D,MAAM,OAAOC,KAAkC,EAAiB;QAC5D,MAAMC,UAAUT,SAAS,GAAG,CAACQ,MAAM,OAAO,CAAC,MAAM;QACjD,IAAI,CAACC,SACD;QAGJ,MAAM,EAAEC,IAAI,EAAE,GAAGF,MAAM,OAAO;QAC9B,MAAMG,YAAYF,QAAQC,KAAK,EAAE;QACjC,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAACC;IACtC;AACJ;AAEO,MAAMC,wBAAwBC,sBAAsB,oBAAoB,CAAC;IAC5E,gBAAgBP;IAChB,cAAc;QAACQ;KAAe;AAClC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { IEventHandler } from "@webiny/app/features/eventPublisher/index.js";
|
|
2
|
+
import type { RoleCreatedEvent } from "./RoleCreatedEvent.js";
|
|
3
|
+
import type { RoleUpdatedEvent } from "./RoleUpdatedEvent.js";
|
|
4
|
+
import type { RoleDeletedEvent } from "./RoleDeletedEvent.js";
|
|
5
|
+
/**
|
|
6
|
+
* Reacts to a role created somewhere the admin did not see, such as by the assistant. Roles the admin
|
|
7
|
+
* creates itself are already in its list.
|
|
8
|
+
*/
|
|
9
|
+
export declare const RoleCreatedEventHandler: import("@webiny/di").Abstraction<IEventHandler<RoleCreatedEvent>>;
|
|
10
|
+
export declare namespace RoleCreatedEventHandler {
|
|
11
|
+
type Interface = IEventHandler<RoleCreatedEvent>;
|
|
12
|
+
type Event = RoleCreatedEvent;
|
|
13
|
+
}
|
|
14
|
+
/** Reacts to a role changed somewhere the admin did not see, such as by the assistant. */
|
|
15
|
+
export declare const RoleUpdatedEventHandler: import("@webiny/di").Abstraction<IEventHandler<RoleUpdatedEvent>>;
|
|
16
|
+
export declare namespace RoleUpdatedEventHandler {
|
|
17
|
+
type Interface = IEventHandler<RoleUpdatedEvent>;
|
|
18
|
+
type Event = RoleUpdatedEvent;
|
|
19
|
+
}
|
|
20
|
+
/** Reacts to a role deleted somewhere the admin did not see, such as by the assistant. */
|
|
21
|
+
export declare const RoleDeletedEventHandler: import("@webiny/di").Abstraction<IEventHandler<RoleDeletedEvent>>;
|
|
22
|
+
export declare namespace RoleDeletedEventHandler {
|
|
23
|
+
type Interface = IEventHandler<RoleDeletedEvent>;
|
|
24
|
+
type Event = RoleDeletedEvent;
|
|
25
|
+
}
|
|
26
|
+
export interface IRefreshRoleInCacheRepository {
|
|
27
|
+
execute(id: string): Promise<void>;
|
|
28
|
+
}
|
|
29
|
+
/** Reads a role back by id and puts it into the roles list, replacing the copy the list has. */
|
|
30
|
+
export declare const RefreshRoleInCacheRepository: import("@webiny/di").Abstraction<IRefreshRoleInCacheRepository>;
|
|
31
|
+
export declare namespace RefreshRoleInCacheRepository {
|
|
32
|
+
type Interface = IRefreshRoleInCacheRepository;
|
|
33
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { createAbstraction } from "@webiny/feature/admin";
|
|
2
|
+
const RoleCreatedEventHandler = createAbstraction("AccessManagement/RoleCreatedEventHandler");
|
|
3
|
+
const RoleUpdatedEventHandler = createAbstraction("AccessManagement/RoleUpdatedEventHandler");
|
|
4
|
+
const RoleDeletedEventHandler = createAbstraction("AccessManagement/RoleDeletedEventHandler");
|
|
5
|
+
const RefreshRoleInCacheRepository = createAbstraction("AccessManagement/RefreshRoleInCacheRepository");
|
|
6
|
+
export { RefreshRoleInCacheRepository, RoleCreatedEventHandler, RoleDeletedEventHandler, RoleUpdatedEventHandler };
|
|
7
|
+
|
|
8
|
+
//# sourceMappingURL=abstractions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/accessManagement/roles/roleEvents/abstractions.js","sources":["../../../../../src/features/accessManagement/roles/roleEvents/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/admin\";\nimport type { IEventHandler } from \"@webiny/app/features/eventPublisher/index.js\";\nimport type { RoleCreatedEvent } from \"./RoleCreatedEvent.js\";\nimport type { RoleUpdatedEvent } from \"./RoleUpdatedEvent.js\";\nimport type { RoleDeletedEvent } from \"./RoleDeletedEvent.js\";\n\n/**\n * Reacts to a role created somewhere the admin did not see, such as by the assistant. Roles the admin\n * creates itself are already in its list.\n */\nexport const RoleCreatedEventHandler = createAbstraction<IEventHandler<RoleCreatedEvent>>(\n \"AccessManagement/RoleCreatedEventHandler\"\n);\n\nexport namespace RoleCreatedEventHandler {\n export type Interface = IEventHandler<RoleCreatedEvent>;\n export type Event = RoleCreatedEvent;\n}\n\n/** Reacts to a role changed somewhere the admin did not see, such as by the assistant. */\nexport const RoleUpdatedEventHandler = createAbstraction<IEventHandler<RoleUpdatedEvent>>(\n \"AccessManagement/RoleUpdatedEventHandler\"\n);\n\nexport namespace RoleUpdatedEventHandler {\n export type Interface = IEventHandler<RoleUpdatedEvent>;\n export type Event = RoleUpdatedEvent;\n}\n\n/** Reacts to a role deleted somewhere the admin did not see, such as by the assistant. */\nexport const RoleDeletedEventHandler = createAbstraction<IEventHandler<RoleDeletedEvent>>(\n \"AccessManagement/RoleDeletedEventHandler\"\n);\n\nexport namespace RoleDeletedEventHandler {\n export type Interface = IEventHandler<RoleDeletedEvent>;\n export type Event = RoleDeletedEvent;\n}\n\nexport interface IRefreshRoleInCacheRepository {\n execute(id: string): Promise<void>;\n}\n\n/** Reads a role back by id and puts it into the roles list, replacing the copy the list has. */\nexport const RefreshRoleInCacheRepository = createAbstraction<IRefreshRoleInCacheRepository>(\n \"AccessManagement/RefreshRoleInCacheRepository\"\n);\n\nexport namespace RefreshRoleInCacheRepository {\n export type Interface = IRefreshRoleInCacheRepository;\n}\n"],"names":["RoleCreatedEventHandler","createAbstraction","RoleUpdatedEventHandler","RoleDeletedEventHandler","RefreshRoleInCacheRepository"],"mappings":";AAUO,MAAMA,0BAA0BC,kBACnC;AASG,MAAMC,0BAA0BD,kBACnC;AASG,MAAME,0BAA0BF,kBACnC;AAaG,MAAMG,+BAA+BH,kBACxC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Keeps the roles list current when roles are created, updated or deleted on the server. Needs
|
|
3
|
+
* `ListRolesFeature` and `GetRoleFeature` in the same container, for the cache and the gateway.
|
|
4
|
+
*/
|
|
5
|
+
export declare const RoleEventsFeature: import("@webiny/feature/admin").FeatureDefinition<any, []>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { createFeature } from "@webiny/feature/admin";
|
|
2
|
+
import { RefreshRoleInCacheRepository } from "./RefreshRoleInCacheRepository.js";
|
|
3
|
+
import { AddCreatedRoleToCache } from "./AddCreatedRoleToCache.js";
|
|
4
|
+
import { RefreshUpdatedRoleInCache } from "./RefreshUpdatedRoleInCache.js";
|
|
5
|
+
import { RemoveDeletedRoleFromCache } from "./RemoveDeletedRoleFromCache.js";
|
|
6
|
+
import { RoleWebsocketMessages } from "./RoleWebsocketMessages.js";
|
|
7
|
+
const RoleEventsFeature = createFeature({
|
|
8
|
+
name: "AccessManagement/RoleEvents",
|
|
9
|
+
register (container) {
|
|
10
|
+
container.register(RefreshRoleInCacheRepository).inSingletonScope();
|
|
11
|
+
container.register(AddCreatedRoleToCache);
|
|
12
|
+
container.register(RefreshUpdatedRoleInCache);
|
|
13
|
+
container.register(RemoveDeletedRoleFromCache);
|
|
14
|
+
container.register(RoleWebsocketMessages);
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
export { RoleEventsFeature };
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=feature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/accessManagement/roles/roleEvents/feature.js","sources":["../../../../../src/features/accessManagement/roles/roleEvents/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/admin\";\nimport { RefreshRoleInCacheRepository } from \"./RefreshRoleInCacheRepository.js\";\nimport { AddCreatedRoleToCache } from \"./AddCreatedRoleToCache.js\";\nimport { RefreshUpdatedRoleInCache } from \"./RefreshUpdatedRoleInCache.js\";\nimport { RemoveDeletedRoleFromCache } from \"./RemoveDeletedRoleFromCache.js\";\nimport { RoleWebsocketMessages } from \"./RoleWebsocketMessages.js\";\n\n/**\n * Keeps the roles list current when roles are created, updated or deleted on the server. Needs\n * `ListRolesFeature` and `GetRoleFeature` in the same container, for the cache and the gateway.\n */\nexport const RoleEventsFeature = createFeature({\n name: \"AccessManagement/RoleEvents\",\n register(container) {\n container.register(RefreshRoleInCacheRepository).inSingletonScope();\n container.register(AddCreatedRoleToCache);\n container.register(RefreshUpdatedRoleInCache);\n container.register(RemoveDeletedRoleFromCache);\n container.register(RoleWebsocketMessages);\n }\n});\n"],"names":["RoleEventsFeature","createFeature","container","RefreshRoleInCacheRepository","AddCreatedRoleToCache","RefreshUpdatedRoleInCache","RemoveDeletedRoleFromCache","RoleWebsocketMessages"],"mappings":";;;;;;AAWO,MAAMA,oBAAoBC,cAAc;IAC3C,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC,8BAA8B,gBAAgB;QACjED,UAAU,QAAQ,CAACE;QACnBF,UAAU,QAAQ,CAACG;QACnBH,UAAU,QAAQ,CAACI;QACnBJ,UAAU,QAAQ,CAACK;IACvB;AACJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { RoleEventsFeature } from "./feature.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { RoleEventsFeature } from "./feature.js";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { RefreshTeamInCacheRepository } from "./abstractions.js";
|
|
2
|
+
import { TeamCreatedEventHandler } from "./abstractions.js";
|
|
3
|
+
/** Adds the created team to the teams list cache, which the Teams view renders from. */
|
|
4
|
+
declare class AddCreatedTeamToCacheImpl implements TeamCreatedEventHandler.Interface {
|
|
5
|
+
private repository;
|
|
6
|
+
constructor(repository: RefreshTeamInCacheRepository.Interface);
|
|
7
|
+
handle(event: TeamCreatedEventHandler.Event): Promise<void>;
|
|
8
|
+
}
|
|
9
|
+
export declare const AddCreatedTeamToCache: typeof AddCreatedTeamToCacheImpl & {
|
|
10
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/app/features/eventPublisher/abstractions.js").IEventHandler<import("./TeamCreatedEvent.js").TeamCreatedEvent>>;
|
|
11
|
+
};
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { RefreshTeamInCacheRepository, TeamCreatedEventHandler } from "./abstractions.js";
|
|
2
|
+
class AddCreatedTeamToCacheImpl {
|
|
3
|
+
constructor(repository){
|
|
4
|
+
this.repository = repository;
|
|
5
|
+
}
|
|
6
|
+
async handle(event) {
|
|
7
|
+
await this.repository.execute(event.payload.id);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
const AddCreatedTeamToCache = TeamCreatedEventHandler.createImplementation({
|
|
11
|
+
implementation: AddCreatedTeamToCacheImpl,
|
|
12
|
+
dependencies: [
|
|
13
|
+
RefreshTeamInCacheRepository
|
|
14
|
+
]
|
|
15
|
+
});
|
|
16
|
+
export { AddCreatedTeamToCache };
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=AddCreatedTeamToCache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/accessManagement/teams/teamEvents/AddCreatedTeamToCache.js","sources":["../../../../../src/features/accessManagement/teams/teamEvents/AddCreatedTeamToCache.ts"],"sourcesContent":["import { RefreshTeamInCacheRepository } from \"./abstractions.js\";\nimport { TeamCreatedEventHandler } from \"./abstractions.js\";\n\n/** Adds the created team to the teams list cache, which the Teams view renders from. */\nclass AddCreatedTeamToCacheImpl implements TeamCreatedEventHandler.Interface {\n constructor(private repository: RefreshTeamInCacheRepository.Interface) {}\n\n async handle(event: TeamCreatedEventHandler.Event): Promise<void> {\n await this.repository.execute(event.payload.id);\n }\n}\n\nexport const AddCreatedTeamToCache = TeamCreatedEventHandler.createImplementation({\n implementation: AddCreatedTeamToCacheImpl,\n dependencies: [RefreshTeamInCacheRepository]\n});\n"],"names":["AddCreatedTeamToCacheImpl","repository","event","AddCreatedTeamToCache","TeamCreatedEventHandler","RefreshTeamInCacheRepository"],"mappings":";AAIA,MAAMA;IACF,YAAoBC,UAAkD,CAAE;aAApDA,UAAU,GAAVA;IAAqD;IAEzE,MAAM,OAAOC,KAAoC,EAAiB;QAC9D,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,CAACA,MAAM,OAAO,CAAC,EAAE;IAClD;AACJ;AAEO,MAAMC,wBAAwBC,wBAAwB,oBAAoB,CAAC;IAC9E,gBAAgBJ;IAChB,cAAc;QAACK;KAA6B;AAChD"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { GetTeamGateway } from "../getTeam/abstractions.js";
|
|
2
|
+
import { TeamsListCache } from "../listTeams/abstractions.js";
|
|
3
|
+
import { RefreshTeamInCacheRepository as RepositoryAbstraction } from "./abstractions.js";
|
|
4
|
+
/**
|
|
5
|
+
* Read back rather than taken from the message, so the team has the same fields as one the admin loads
|
|
6
|
+
* itself. A team the list already has is replaced where it is, so an update does not move its row; a
|
|
7
|
+
* new one is added.
|
|
8
|
+
*/
|
|
9
|
+
declare class RefreshTeamInCacheRepositoryImpl implements RepositoryAbstraction.Interface {
|
|
10
|
+
private gateway;
|
|
11
|
+
private cache;
|
|
12
|
+
constructor(gateway: GetTeamGateway.Interface, cache: TeamsListCache.Interface);
|
|
13
|
+
execute(id: string): Promise<void>;
|
|
14
|
+
}
|
|
15
|
+
export declare const RefreshTeamInCacheRepository: typeof RefreshTeamInCacheRepositoryImpl & {
|
|
16
|
+
__abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").IRefreshTeamInCacheRepository>;
|
|
17
|
+
};
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { GetTeamGateway } from "../getTeam/abstractions.js";
|
|
2
|
+
import { TeamsListCache } from "../listTeams/abstractions.js";
|
|
3
|
+
import { RefreshTeamInCacheRepository } from "./abstractions.js";
|
|
4
|
+
class RefreshTeamInCacheRepositoryImpl {
|
|
5
|
+
constructor(gateway, cache){
|
|
6
|
+
this.gateway = gateway;
|
|
7
|
+
this.cache = cache;
|
|
8
|
+
}
|
|
9
|
+
async execute(id) {
|
|
10
|
+
const team = await this.gateway.execute(id);
|
|
11
|
+
if (this.cache.getItem((item)=>item.id === id)) return void this.cache.updateItems((item)=>item.id === id ? team : item);
|
|
12
|
+
this.cache.addItems([
|
|
13
|
+
team
|
|
14
|
+
]);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
const RefreshTeamInCacheRepository_RefreshTeamInCacheRepository = RefreshTeamInCacheRepository.createImplementation({
|
|
18
|
+
implementation: RefreshTeamInCacheRepositoryImpl,
|
|
19
|
+
dependencies: [
|
|
20
|
+
GetTeamGateway,
|
|
21
|
+
TeamsListCache
|
|
22
|
+
]
|
|
23
|
+
});
|
|
24
|
+
export { RefreshTeamInCacheRepository_RefreshTeamInCacheRepository as RefreshTeamInCacheRepository };
|
|
25
|
+
|
|
26
|
+
//# sourceMappingURL=RefreshTeamInCacheRepository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/accessManagement/teams/teamEvents/RefreshTeamInCacheRepository.js","sources":["../../../../../src/features/accessManagement/teams/teamEvents/RefreshTeamInCacheRepository.ts"],"sourcesContent":["import { GetTeamGateway } from \"../getTeam/abstractions.js\";\nimport { TeamsListCache } from \"../listTeams/abstractions.js\";\nimport { RefreshTeamInCacheRepository as RepositoryAbstraction } from \"./abstractions.js\";\n\n/**\n * Read back rather than taken from the message, so the team has the same fields as one the admin loads\n * itself. A team the list already has is replaced where it is, so an update does not move its row; a\n * new one is added.\n */\nclass RefreshTeamInCacheRepositoryImpl implements RepositoryAbstraction.Interface {\n constructor(\n private gateway: GetTeamGateway.Interface,\n private cache: TeamsListCache.Interface\n ) {}\n\n async execute(id: string): Promise<void> {\n const team = await this.gateway.execute(id);\n\n if (this.cache.getItem(item => item.id === id)) {\n this.cache.updateItems(item => (item.id === id ? team : item));\n return;\n }\n\n this.cache.addItems([team]);\n }\n}\n\nexport const RefreshTeamInCacheRepository = RepositoryAbstraction.createImplementation({\n implementation: RefreshTeamInCacheRepositoryImpl,\n dependencies: [GetTeamGateway, TeamsListCache]\n});\n"],"names":["RefreshTeamInCacheRepositoryImpl","gateway","cache","id","team","item","RefreshTeamInCacheRepository","RepositoryAbstraction","GetTeamGateway","TeamsListCache"],"mappings":";;;AASA,MAAMA;IACF,YACYC,OAAiC,EACjCC,KAA+B,CACzC;aAFUD,OAAO,GAAPA;aACAC,KAAK,GAALA;IACT;IAEH,MAAM,QAAQC,EAAU,EAAiB;QACrC,MAAMC,OAAO,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAACD;QAExC,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAACE,CAAAA,OAAQA,KAAK,EAAE,KAAKF,KAAK,YAC5C,IAAI,CAAC,KAAK,CAAC,WAAW,CAACE,CAAAA,OAASA,KAAK,EAAE,KAAKF,KAAKC,OAAOC;QAI5D,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;YAACD;SAAK;IAC9B;AACJ;AAEO,MAAME,4DAA+BC,6BAAAA,oBAA0C,CAAC;IACnF,gBAAgBP;IAChB,cAAc;QAACQ;QAAgBC;KAAe;AAClD"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { RefreshTeamInCacheRepository } from "./abstractions.js";
|
|
2
|
+
import { TeamUpdatedEventHandler } from "./abstractions.js";
|
|
3
|
+
/** Replaces the updated team in the teams list cache with what the server now has. */
|
|
4
|
+
declare class RefreshUpdatedTeamInCacheImpl implements TeamUpdatedEventHandler.Interface {
|
|
5
|
+
private repository;
|
|
6
|
+
constructor(repository: RefreshTeamInCacheRepository.Interface);
|
|
7
|
+
handle(event: TeamUpdatedEventHandler.Event): Promise<void>;
|
|
8
|
+
}
|
|
9
|
+
export declare const RefreshUpdatedTeamInCache: typeof RefreshUpdatedTeamInCacheImpl & {
|
|
10
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/app/features/eventPublisher/abstractions.js").IEventHandler<import("./TeamUpdatedEvent.js").TeamUpdatedEvent>>;
|
|
11
|
+
};
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { RefreshTeamInCacheRepository, TeamUpdatedEventHandler } from "./abstractions.js";
|
|
2
|
+
class RefreshUpdatedTeamInCacheImpl {
|
|
3
|
+
constructor(repository){
|
|
4
|
+
this.repository = repository;
|
|
5
|
+
}
|
|
6
|
+
async handle(event) {
|
|
7
|
+
await this.repository.execute(event.payload.id);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
const RefreshUpdatedTeamInCache = TeamUpdatedEventHandler.createImplementation({
|
|
11
|
+
implementation: RefreshUpdatedTeamInCacheImpl,
|
|
12
|
+
dependencies: [
|
|
13
|
+
RefreshTeamInCacheRepository
|
|
14
|
+
]
|
|
15
|
+
});
|
|
16
|
+
export { RefreshUpdatedTeamInCache };
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=RefreshUpdatedTeamInCache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/accessManagement/teams/teamEvents/RefreshUpdatedTeamInCache.js","sources":["../../../../../src/features/accessManagement/teams/teamEvents/RefreshUpdatedTeamInCache.ts"],"sourcesContent":["import { RefreshTeamInCacheRepository } from \"./abstractions.js\";\nimport { TeamUpdatedEventHandler } from \"./abstractions.js\";\n\n/** Replaces the updated team in the teams list cache with what the server now has. */\nclass RefreshUpdatedTeamInCacheImpl implements TeamUpdatedEventHandler.Interface {\n constructor(private repository: RefreshTeamInCacheRepository.Interface) {}\n\n async handle(event: TeamUpdatedEventHandler.Event): Promise<void> {\n await this.repository.execute(event.payload.id);\n }\n}\n\nexport const RefreshUpdatedTeamInCache = TeamUpdatedEventHandler.createImplementation({\n implementation: RefreshUpdatedTeamInCacheImpl,\n dependencies: [RefreshTeamInCacheRepository]\n});\n"],"names":["RefreshUpdatedTeamInCacheImpl","repository","event","RefreshUpdatedTeamInCache","TeamUpdatedEventHandler","RefreshTeamInCacheRepository"],"mappings":";AAIA,MAAMA;IACF,YAAoBC,UAAkD,CAAE;aAApDA,UAAU,GAAVA;IAAqD;IAEzE,MAAM,OAAOC,KAAoC,EAAiB;QAC9D,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,CAACA,MAAM,OAAO,CAAC,EAAE;IAClD;AACJ;AAEO,MAAMC,4BAA4BC,wBAAwB,oBAAoB,CAAC;IAClF,gBAAgBJ;IAChB,cAAc;QAACK;KAA6B;AAChD"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { TeamsListCache } from "../listTeams/abstractions.js";
|
|
2
|
+
import { TeamDeletedEventHandler } from "./abstractions.js";
|
|
3
|
+
/** Takes the deleted team out of the teams list cache. A deleted team cannot be read back. */
|
|
4
|
+
declare class RemoveDeletedTeamFromCacheImpl implements TeamDeletedEventHandler.Interface {
|
|
5
|
+
private cache;
|
|
6
|
+
constructor(cache: TeamsListCache.Interface);
|
|
7
|
+
handle(event: TeamDeletedEventHandler.Event): Promise<void>;
|
|
8
|
+
}
|
|
9
|
+
export declare const RemoveDeletedTeamFromCache: typeof RemoveDeletedTeamFromCacheImpl & {
|
|
10
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/app/features/eventPublisher/abstractions.js").IEventHandler<import("./TeamDeletedEvent.js").TeamDeletedEvent>>;
|
|
11
|
+
};
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { TeamsListCache } from "../listTeams/abstractions.js";
|
|
2
|
+
import { TeamDeletedEventHandler } from "./abstractions.js";
|
|
3
|
+
class RemoveDeletedTeamFromCacheImpl {
|
|
4
|
+
constructor(cache){
|
|
5
|
+
this.cache = cache;
|
|
6
|
+
}
|
|
7
|
+
async handle(event) {
|
|
8
|
+
const { id } = event.payload;
|
|
9
|
+
this.cache.removeItems((team)=>team.id === id);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
const RemoveDeletedTeamFromCache = TeamDeletedEventHandler.createImplementation({
|
|
13
|
+
implementation: RemoveDeletedTeamFromCacheImpl,
|
|
14
|
+
dependencies: [
|
|
15
|
+
TeamsListCache
|
|
16
|
+
]
|
|
17
|
+
});
|
|
18
|
+
export { RemoveDeletedTeamFromCache };
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=RemoveDeletedTeamFromCache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/accessManagement/teams/teamEvents/RemoveDeletedTeamFromCache.js","sources":["../../../../../src/features/accessManagement/teams/teamEvents/RemoveDeletedTeamFromCache.ts"],"sourcesContent":["import { TeamsListCache } from \"../listTeams/abstractions.js\";\nimport { TeamDeletedEventHandler } from \"./abstractions.js\";\n\n/** Takes the deleted team out of the teams list cache. A deleted team cannot be read back. */\nclass RemoveDeletedTeamFromCacheImpl implements TeamDeletedEventHandler.Interface {\n constructor(private cache: TeamsListCache.Interface) {}\n\n async handle(event: TeamDeletedEventHandler.Event): Promise<void> {\n const { id } = event.payload;\n this.cache.removeItems(team => team.id === id);\n }\n}\n\nexport const RemoveDeletedTeamFromCache = TeamDeletedEventHandler.createImplementation({\n implementation: RemoveDeletedTeamFromCacheImpl,\n dependencies: [TeamsListCache]\n});\n"],"names":["RemoveDeletedTeamFromCacheImpl","cache","event","id","team","RemoveDeletedTeamFromCache","TeamDeletedEventHandler","TeamsListCache"],"mappings":";;AAIA,MAAMA;IACF,YAAoBC,KAA+B,CAAE;aAAjCA,KAAK,GAALA;IAAkC;IAEtD,MAAM,OAAOC,KAAoC,EAAiB;QAC9D,MAAM,EAAEC,EAAE,EAAE,GAAGD,MAAM,OAAO;QAC5B,IAAI,CAAC,KAAK,CAAC,WAAW,CAACE,CAAAA,OAAQA,KAAK,EAAE,KAAKD;IAC/C;AACJ;AAEO,MAAME,6BAA6BC,wBAAwB,oBAAoB,CAAC;IACnF,gBAAgBN;IAChB,cAAc;QAACO;KAAe;AAClC"}
|