@webiny/api-core 6.6.0-alpha.11 → 6.6.0-alpha.12
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/ApiCoreFeature.js +2 -1
- package/ApiCoreFeature.js.map +1 -1
- package/features/ai/AiSdkTools.d.ts +1 -1
- package/features/ai/AiSdkTools.js +3 -2
- package/features/ai/AiSdkTools.js.map +1 -1
- package/features/ai/abstractions.d.ts +9 -1
- package/features/ai/abstractions.js.map +1 -1
- package/features/ai/index.d.ts +1 -0
- package/features/ai/index.js +1 -0
- package/features/ai/isReadOnlyTool.d.ts +9 -0
- package/features/ai/isReadOnlyTool.js +4 -0
- package/features/ai/isReadOnlyTool.js.map +1 -0
- package/features/security/CanAccessCurrentTenant/CanAccessCurrentTenantUseCase.d.ts +13 -0
- package/features/security/CanAccessCurrentTenant/CanAccessCurrentTenantUseCase.js +25 -0
- package/features/security/CanAccessCurrentTenant/CanAccessCurrentTenantUseCase.js.map +1 -0
- package/features/security/CanAccessCurrentTenant/abstractions.d.ts +12 -0
- package/features/security/CanAccessCurrentTenant/abstractions.js +5 -0
- package/features/security/CanAccessCurrentTenant/abstractions.js.map +1 -0
- package/features/security/CanAccessCurrentTenant/feature.d.ts +4 -0
- package/features/security/CanAccessCurrentTenant/feature.js +11 -0
- package/features/security/CanAccessCurrentTenant/feature.js.map +1 -0
- package/features/security/CanAccessCurrentTenant/index.d.ts +2 -0
- package/features/security/CanAccessCurrentTenant/index.js +2 -0
- package/features/security/SecurityFeature.js +4 -0
- package/features/security/SecurityFeature.js.map +1 -1
- package/features/security/ai/CreateRoleTool.d.ts +54 -0
- package/features/security/ai/CreateRoleTool.js +71 -0
- package/features/security/ai/CreateRoleTool.js.map +1 -0
- package/features/security/ai/CreateTeamTool.d.ts +49 -0
- package/features/security/ai/CreateTeamTool.js +56 -0
- package/features/security/ai/CreateTeamTool.js.map +1 -0
- package/features/security/ai/DeleteRoleTool.d.ts +52 -0
- package/features/security/ai/DeleteRoleTool.js +79 -0
- package/features/security/ai/DeleteRoleTool.js.map +1 -0
- package/features/security/ai/DeleteTeamTool.d.ts +47 -0
- package/features/security/ai/DeleteTeamTool.js +56 -0
- package/features/security/ai/DeleteTeamTool.js.map +1 -0
- package/features/security/ai/ListRolesTool.d.ts +40 -0
- package/features/security/ai/ListRolesTool.js +48 -0
- package/features/security/ai/ListRolesTool.js.map +1 -0
- package/features/security/ai/ListTeamsTool.d.ts +42 -0
- package/features/security/ai/ListTeamsTool.js +49 -0
- package/features/security/ai/ListTeamsTool.js.map +1 -0
- package/features/security/ai/UpdateRoleTool.d.ts +46 -0
- package/features/security/ai/UpdateRoleTool.js +53 -0
- package/features/security/ai/UpdateRoleTool.js.map +1 -0
- package/features/security/ai/UpdateTeamTool.d.ts +53 -0
- package/features/security/ai/UpdateTeamTool.js +56 -0
- package/features/security/ai/UpdateTeamTool.js.map +1 -0
- package/features/security/ai/feature.d.ts +10 -0
- package/features/security/ai/feature.js +25 -0
- package/features/security/ai/feature.js.map +1 -0
- package/features/security/ai/index.d.ts +9 -0
- package/features/security/ai/index.js +9 -0
- package/features/security/apiKeys/ApiKeyAuthorizer.js +1 -1
- package/features/security/apiKeys/ApiKeyAuthorizer.js.map +1 -1
- package/features/security/roles/NotifyRoleChange/NotifyOnRoleCreatedHandler.d.ts +3 -3
- package/features/security/roles/NotifyRoleChange/NotifyOnRoleCreatedHandler.js +7 -5
- package/features/security/roles/NotifyRoleChange/NotifyOnRoleCreatedHandler.js.map +1 -1
- package/features/security/roles/NotifyRoleChange/NotifyOnRoleDeletedHandler.d.ts +3 -3
- package/features/security/roles/NotifyRoleChange/NotifyOnRoleDeletedHandler.js +7 -5
- package/features/security/roles/NotifyRoleChange/NotifyOnRoleDeletedHandler.js.map +1 -1
- package/features/security/roles/NotifyRoleChange/NotifyOnRoleUpdatedHandler.d.ts +3 -3
- package/features/security/roles/NotifyRoleChange/NotifyOnRoleUpdatedHandler.js +7 -5
- package/features/security/roles/NotifyRoleChange/NotifyOnRoleUpdatedHandler.js.map +1 -1
- package/features/security/roles/NotifyRoleChange/feature.js +0 -2
- package/features/security/roles/NotifyRoleChange/feature.js.map +1 -1
- package/features/security/roles/NotifyRoleChange/index.d.ts +1 -1
- package/features/security/roles/NotifyRoleChange/index.js +1 -1
- package/features/security/roles/NotifyRoleChange/recordType.d.ts +5 -0
- package/features/security/roles/NotifyRoleChange/recordType.js +4 -0
- package/features/security/roles/NotifyRoleChange/recordType.js.map +1 -0
- package/features/security/teams/NotifyTeamChange/NotifyOnTeamChangeHandlers.d.ts +7 -7
- package/features/security/teams/NotifyTeamChange/NotifyOnTeamChangeHandlers.js +17 -13
- package/features/security/teams/NotifyTeamChange/NotifyOnTeamChangeHandlers.js.map +1 -1
- package/features/security/teams/NotifyTeamChange/feature.js +0 -2
- package/features/security/teams/NotifyTeamChange/feature.js.map +1 -1
- package/features/security/teams/NotifyTeamChange/index.d.ts +1 -1
- package/features/security/teams/NotifyTeamChange/index.js +1 -1
- package/features/security/teams/NotifyTeamChange/recordType.d.ts +5 -0
- package/features/security/teams/NotifyTeamChange/recordType.js +4 -0
- package/features/security/teams/NotifyTeamChange/recordType.js.map +1 -0
- package/features/users/AdminUsersFeature.js +4 -0
- package/features/users/AdminUsersFeature.js.map +1 -1
- package/features/users/CreateUser/CreateUserUseCase.js +1 -1
- package/features/users/CreateUser/CreateUserUseCase.js.map +1 -1
- package/features/users/NotifyUserChange/NotifyOnUserChangeHandlers.d.ts +29 -0
- package/features/users/NotifyUserChange/NotifyOnUserChangeHandlers.js +62 -0
- package/features/users/NotifyUserChange/NotifyOnUserChangeHandlers.js.map +1 -0
- package/features/users/NotifyUserChange/feature.d.ts +5 -0
- package/features/users/NotifyUserChange/feature.js +13 -0
- package/features/users/NotifyUserChange/feature.js.map +1 -0
- package/features/users/NotifyUserChange/index.d.ts +2 -0
- package/features/users/NotifyUserChange/index.js +2 -0
- package/features/users/NotifyUserChange/recordType.d.ts +5 -0
- package/features/users/NotifyUserChange/recordType.js +4 -0
- package/features/users/NotifyUserChange/recordType.js.map +1 -0
- package/features/users/ai/ListUsersTool.d.ts +39 -0
- package/features/users/ai/ListUsersTool.js +46 -0
- package/features/users/ai/ListUsersTool.js.map +1 -0
- package/features/users/ai/UpdateUserAccessTool.d.ts +59 -0
- package/features/users/ai/UpdateUserAccessTool.js +101 -0
- package/features/users/ai/UpdateUserAccessTool.js.map +1 -0
- package/features/users/ai/feature.d.ts +11 -0
- package/features/users/ai/feature.js +13 -0
- package/features/users/ai/feature.js.map +1 -0
- package/features/users/ai/index.d.ts +3 -0
- package/features/users/ai/index.js +3 -0
- package/features/websockets/NotifyRecordChange/NotifyRecordChangeUseCase.d.ts +12 -0
- package/features/websockets/NotifyRecordChange/NotifyRecordChangeUseCase.js +38 -0
- package/features/websockets/NotifyRecordChange/NotifyRecordChangeUseCase.js.map +1 -0
- package/features/websockets/NotifyRecordChange/abstractions.d.ts +39 -0
- package/features/websockets/NotifyRecordChange/abstractions.js +6 -0
- package/features/websockets/NotifyRecordChange/abstractions.js.map +1 -0
- package/features/websockets/NotifyRecordChange/feature.d.ts +5 -0
- package/features/websockets/NotifyRecordChange/feature.js +11 -0
- package/features/websockets/NotifyRecordChange/feature.js.map +1 -0
- package/features/websockets/NotifyRecordChange/index.d.ts +2 -0
- package/features/websockets/NotifyRecordChange/index.js +2 -0
- package/features/websockets/index.d.ts +1 -0
- package/features/websockets/index.js +1 -0
- package/package.json +11 -11
- package/features/security/roles/NotifyRoleChange/NotifyRoleChangeUseCase.d.ts +0 -11
- package/features/security/roles/NotifyRoleChange/NotifyRoleChangeUseCase.js +0 -40
- package/features/security/roles/NotifyRoleChange/NotifyRoleChangeUseCase.js.map +0 -1
- package/features/security/roles/NotifyRoleChange/abstractions.d.ts +0 -21
- package/features/security/roles/NotifyRoleChange/abstractions.js +0 -8
- package/features/security/roles/NotifyRoleChange/abstractions.js.map +0 -1
- package/features/security/teams/NotifyTeamChange/NotifyTeamChangeUseCase.d.ts +0 -11
- package/features/security/teams/NotifyTeamChange/NotifyTeamChangeUseCase.js +0 -40
- package/features/security/teams/NotifyTeamChange/NotifyTeamChangeUseCase.js.map +0 -1
- package/features/security/teams/NotifyTeamChange/abstractions.d.ts +0 -21
- package/features/security/teams/NotifyTeamChange/abstractions.js +0 -8
- package/features/security/teams/NotifyTeamChange/abstractions.js.map +0 -1
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { createImplementation } from "@webiny/di";
|
|
2
|
+
import { IdentityContext } from "../../security/IdentityContext/abstractions.js";
|
|
3
|
+
import { WebsocketsSendToIdentityUseCase } from "../SendToIdentity/abstractions.js";
|
|
4
|
+
import { NotifyRecordChangeUseCase, RECORD_CHANGED_WEBSOCKET_ACTION } from "./abstractions.js";
|
|
5
|
+
class NotifyRecordChangeUseCaseImpl {
|
|
6
|
+
constructor(identityContext, sendToIdentity){
|
|
7
|
+
this.identityContext = identityContext;
|
|
8
|
+
this.sendToIdentity = sendToIdentity;
|
|
9
|
+
}
|
|
10
|
+
async execute({ identityId, ...data }) {
|
|
11
|
+
const recipient = identityId ?? this.getSignedInIdentityId();
|
|
12
|
+
if (!recipient) return;
|
|
13
|
+
try {
|
|
14
|
+
await this.sendToIdentity.execute({
|
|
15
|
+
id: recipient
|
|
16
|
+
}, {
|
|
17
|
+
action: RECORD_CHANGED_WEBSOCKET_ACTION,
|
|
18
|
+
data
|
|
19
|
+
});
|
|
20
|
+
} catch {}
|
|
21
|
+
}
|
|
22
|
+
getSignedInIdentityId() {
|
|
23
|
+
const identity = this.identityContext.getIdentity();
|
|
24
|
+
if (identity.isAnonymous()) return;
|
|
25
|
+
return identity.id;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
const NotifyRecordChangeUseCase_NotifyRecordChangeUseCase = createImplementation({
|
|
29
|
+
abstraction: NotifyRecordChangeUseCase,
|
|
30
|
+
implementation: NotifyRecordChangeUseCaseImpl,
|
|
31
|
+
dependencies: [
|
|
32
|
+
IdentityContext,
|
|
33
|
+
WebsocketsSendToIdentityUseCase
|
|
34
|
+
]
|
|
35
|
+
});
|
|
36
|
+
export { NotifyRecordChangeUseCase_NotifyRecordChangeUseCase as NotifyRecordChangeUseCase };
|
|
37
|
+
|
|
38
|
+
//# sourceMappingURL=NotifyRecordChangeUseCase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/websockets/NotifyRecordChange/NotifyRecordChangeUseCase.js","sources":["../../../../src/features/websockets/NotifyRecordChange/NotifyRecordChangeUseCase.ts"],"sourcesContent":["import { createImplementation } from \"@webiny/di\";\nimport { IdentityContext } from \"~/features/security/IdentityContext/abstractions.js\";\nimport { WebsocketsSendToIdentityUseCase } from \"~/features/websockets/SendToIdentity/abstractions.js\";\nimport { RECORD_CHANGED_WEBSOCKET_ACTION } from \"./abstractions.js\";\nimport { NotifyRecordChangeUseCase as UseCaseAbstraction } from \"./abstractions.js\";\n\n/*\n * Changes the admin makes itself are announced too: the admin applies them by id, so the tab that\n * made the change ends up where it already was and the user's other tabs catch up.\n *\n * The change is saved whether or not the message goes out, so a failed send is swallowed rather than\n * failing the write. The admin then shows the change after its next reload.\n */\nclass NotifyRecordChangeUseCaseImpl implements UseCaseAbstraction.Interface {\n constructor(\n private identityContext: IdentityContext.Interface,\n private sendToIdentity: WebsocketsSendToIdentityUseCase.Interface\n ) {}\n\n async execute({ identityId, ...data }: UseCaseAbstraction.Params): Promise<void> {\n const recipient = identityId ?? this.getSignedInIdentityId();\n if (!recipient) {\n return;\n }\n\n try {\n await this.sendToIdentity.execute(\n { id: recipient },\n { action: RECORD_CHANGED_WEBSOCKET_ACTION, data }\n );\n } catch {\n // See above.\n }\n }\n\n private getSignedInIdentityId(): string | undefined {\n const identity = this.identityContext.getIdentity();\n if (identity.isAnonymous()) {\n return undefined;\n }\n return identity.id;\n }\n}\n\nexport const NotifyRecordChangeUseCase = createImplementation({\n abstraction: UseCaseAbstraction,\n implementation: NotifyRecordChangeUseCaseImpl,\n dependencies: [IdentityContext, WebsocketsSendToIdentityUseCase]\n});\n"],"names":["NotifyRecordChangeUseCaseImpl","identityContext","sendToIdentity","identityId","data","recipient","RECORD_CHANGED_WEBSOCKET_ACTION","identity","NotifyRecordChangeUseCase","createImplementation","UseCaseAbstraction","IdentityContext","WebsocketsSendToIdentityUseCase"],"mappings":";;;;AAaA,MAAMA;IACF,YACYC,eAA0C,EAC1CC,cAAyD,CACnE;aAFUD,eAAe,GAAfA;aACAC,cAAc,GAAdA;IACT;IAEH,MAAM,QAAQ,EAAEC,UAAU,EAAE,GAAGC,MAAiC,EAAiB;QAC7E,MAAMC,YAAYF,cAAc,IAAI,CAAC,qBAAqB;QAC1D,IAAI,CAACE,WACD;QAGJ,IAAI;YACA,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAC7B;gBAAE,IAAIA;YAAU,GAChB;gBAAE,QAAQC;gBAAiCF;YAAK;QAExD,EAAE,OAAM,CAER;IACJ;IAEQ,wBAA4C;QAChD,MAAMG,WAAW,IAAI,CAAC,eAAe,CAAC,WAAW;QACjD,IAAIA,SAAS,WAAW,IACpB;QAEJ,OAAOA,SAAS,EAAE;IACtB;AACJ;AAEO,MAAMC,sDAA4BC,qBAAqB;IAC1D,aAAaC;IACb,gBAAgBV;IAChB,cAAc;QAACW;QAAiBC;KAAgC;AACpE"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sent to the user's open admin tabs when a record changes on the server. The admin keeps its own
|
|
3
|
+
* copies of folders, teams, roles and users, and a change made on the server (by the assistant's
|
|
4
|
+
* tools, a background task, another tab) never passes through them, so without this message the
|
|
5
|
+
* admin shows the old state until a reload.
|
|
6
|
+
*
|
|
7
|
+
* Carries the record type and id only; the admin reads the record back, or drops it for `deleted`.
|
|
8
|
+
* `RecordChangeMessages` in @webiny/app turns it into a `RecordChangedEvent`.
|
|
9
|
+
*/
|
|
10
|
+
export declare const RECORD_CHANGED_WEBSOCKET_ACTION = "record.changed";
|
|
11
|
+
export type RecordChange = "created" | "updated" | "deleted";
|
|
12
|
+
export interface RecordChangedMessageData {
|
|
13
|
+
/** Names the kind of record, such as `security.team`. The admin handlers filter on it. */
|
|
14
|
+
type: string;
|
|
15
|
+
id: string;
|
|
16
|
+
/**
|
|
17
|
+
* For a record whose id only means something inside a parent: the parent's id. A CMS entry
|
|
18
|
+
* carries its model id here, which the admin needs to read the entry back.
|
|
19
|
+
*/
|
|
20
|
+
scope?: string;
|
|
21
|
+
change: RecordChange;
|
|
22
|
+
}
|
|
23
|
+
export interface NotifyRecordChangeParams extends RecordChangedMessageData {
|
|
24
|
+
/**
|
|
25
|
+
* Whose open tabs to tell. Defaults to the current identity. Background tasks pass the identity
|
|
26
|
+
* that made the change, because they run later, outside that request.
|
|
27
|
+
*/
|
|
28
|
+
identityId?: string;
|
|
29
|
+
}
|
|
30
|
+
export interface INotifyRecordChangeUseCase {
|
|
31
|
+
execute(params: NotifyRecordChangeParams): Promise<void>;
|
|
32
|
+
}
|
|
33
|
+
export declare const NotifyRecordChangeUseCase: import("@webiny/di").Abstraction<INotifyRecordChangeUseCase>;
|
|
34
|
+
export declare namespace NotifyRecordChangeUseCase {
|
|
35
|
+
type Interface = INotifyRecordChangeUseCase;
|
|
36
|
+
type Params = NotifyRecordChangeParams;
|
|
37
|
+
type Change = RecordChange;
|
|
38
|
+
type MessageData = RecordChangedMessageData;
|
|
39
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { createAbstraction } from "@webiny/feature/api";
|
|
2
|
+
const RECORD_CHANGED_WEBSOCKET_ACTION = "record.changed";
|
|
3
|
+
const NotifyRecordChangeUseCase = createAbstraction("Websockets/NotifyRecordChangeUseCase");
|
|
4
|
+
export { NotifyRecordChangeUseCase, RECORD_CHANGED_WEBSOCKET_ACTION };
|
|
5
|
+
|
|
6
|
+
//# sourceMappingURL=abstractions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/websockets/NotifyRecordChange/abstractions.js","sources":["../../../../src/features/websockets/NotifyRecordChange/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\n\n/**\n * Sent to the user's open admin tabs when a record changes on the server. The admin keeps its own\n * copies of folders, teams, roles and users, and a change made on the server (by the assistant's\n * tools, a background task, another tab) never passes through them, so without this message the\n * admin shows the old state until a reload.\n *\n * Carries the record type and id only; the admin reads the record back, or drops it for `deleted`.\n * `RecordChangeMessages` in @webiny/app turns it into a `RecordChangedEvent`.\n */\nexport const RECORD_CHANGED_WEBSOCKET_ACTION = \"record.changed\";\n\nexport type RecordChange = \"created\" | \"updated\" | \"deleted\";\n\nexport interface RecordChangedMessageData {\n /** Names the kind of record, such as `security.team`. The admin handlers filter on it. */\n type: string;\n id: string;\n /**\n * For a record whose id only means something inside a parent: the parent's id. A CMS entry\n * carries its model id here, which the admin needs to read the entry back.\n */\n scope?: string;\n change: RecordChange;\n}\n\nexport interface NotifyRecordChangeParams extends RecordChangedMessageData {\n /**\n * Whose open tabs to tell. Defaults to the current identity. Background tasks pass the identity\n * that made the change, because they run later, outside that request.\n */\n identityId?: string;\n}\n\nexport interface INotifyRecordChangeUseCase {\n execute(params: NotifyRecordChangeParams): Promise<void>;\n}\n\nexport const NotifyRecordChangeUseCase = createAbstraction<INotifyRecordChangeUseCase>(\n \"Websockets/NotifyRecordChangeUseCase\"\n);\n\nexport namespace NotifyRecordChangeUseCase {\n export type Interface = INotifyRecordChangeUseCase;\n export type Params = NotifyRecordChangeParams;\n export type Change = RecordChange;\n export type MessageData = RecordChangedMessageData;\n}\n"],"names":["RECORD_CHANGED_WEBSOCKET_ACTION","NotifyRecordChangeUseCase","createAbstraction"],"mappings":";AAWO,MAAMA,kCAAkC;AA4BxC,MAAMC,4BAA4BC,kBACrC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createFeature } from "@webiny/feature/api";
|
|
2
|
+
import { NotifyRecordChangeUseCase } from "./NotifyRecordChangeUseCase.js";
|
|
3
|
+
const NotifyRecordChangeFeature = createFeature({
|
|
4
|
+
name: "NotifyRecordChange",
|
|
5
|
+
register (container) {
|
|
6
|
+
container.register(NotifyRecordChangeUseCase);
|
|
7
|
+
}
|
|
8
|
+
});
|
|
9
|
+
export { NotifyRecordChangeFeature };
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=feature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/websockets/NotifyRecordChange/feature.js","sources":["../../../../src/features/websockets/NotifyRecordChange/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { NotifyRecordChangeUseCase } from \"./NotifyRecordChangeUseCase.js\";\n\n/** Tells the user's open admin tabs when a record is created, updated or deleted on the server. */\nexport const NotifyRecordChangeFeature = createFeature({\n name: \"NotifyRecordChange\",\n register(container) {\n container.register(NotifyRecordChangeUseCase);\n }\n});\n"],"names":["NotifyRecordChangeFeature","createFeature","container","NotifyRecordChangeUseCase"],"mappings":";;AAIO,MAAMA,4BAA4BC,cAAc;IACnD,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;IACvB;AACJ"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { WebsocketsSendToIdentityUseCase } from "./SendToIdentity/abstractions.js";
|
|
2
2
|
export { NullSendToIdentityUseCase } from "./SendToIdentity/NullSendToIdentityUseCase.js";
|
|
3
|
+
export { NotifyRecordChangeFeature, NotifyRecordChangeUseCase, RECORD_CHANGED_WEBSOCKET_ACTION } from "./NotifyRecordChange/index.js";
|
|
3
4
|
export { WebsocketServiceError } from "./WebsocketServiceError.js";
|
|
4
5
|
export type { IWebsocketsIdentity } from "./types.js";
|
|
5
6
|
export type { IWebsocketsTransportSendData } from "./types.js";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { WebsocketsSendToIdentityUseCase } from "./SendToIdentity/abstractions.js";
|
|
2
2
|
export { NullSendToIdentityUseCase } from "./SendToIdentity/NullSendToIdentityUseCase.js";
|
|
3
|
+
export { NotifyRecordChangeFeature, NotifyRecordChangeUseCase, RECORD_CHANGED_WEBSOCKET_ACTION } from "./NotifyRecordChange/index.js";
|
|
3
4
|
export { WebsocketServiceError } from "./WebsocketServiceError.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/api-core",
|
|
3
|
-
"version": "6.6.0-alpha.
|
|
3
|
+
"version": "6.6.0-alpha.12",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -18,16 +18,16 @@
|
|
|
18
18
|
"@ai-sdk/google": "4.0.109",
|
|
19
19
|
"@ai-sdk/openai": "4.0.106",
|
|
20
20
|
"@openrouter/ai-sdk-provider": "3.1.0",
|
|
21
|
-
"@webiny/api": "6.6.0-alpha.
|
|
22
|
-
"@webiny/api-graphql": "6.6.0-alpha.
|
|
21
|
+
"@webiny/api": "6.6.0-alpha.12",
|
|
22
|
+
"@webiny/api-graphql": "6.6.0-alpha.12",
|
|
23
23
|
"@webiny/di": "2.0.0",
|
|
24
|
-
"@webiny/error": "6.6.0-alpha.
|
|
25
|
-
"@webiny/event-handler-core": "6.6.0-alpha.
|
|
26
|
-
"@webiny/feature": "6.6.0-alpha.
|
|
27
|
-
"@webiny/feature-flags": "6.6.0-alpha.
|
|
28
|
-
"@webiny/handler": "6.6.0-alpha.
|
|
29
|
-
"@webiny/utils": "6.6.0-alpha.
|
|
30
|
-
"@webiny/wcp": "6.6.0-alpha.
|
|
24
|
+
"@webiny/error": "6.6.0-alpha.12",
|
|
25
|
+
"@webiny/event-handler-core": "6.6.0-alpha.12",
|
|
26
|
+
"@webiny/feature": "6.6.0-alpha.12",
|
|
27
|
+
"@webiny/feature-flags": "6.6.0-alpha.12",
|
|
28
|
+
"@webiny/handler": "6.6.0-alpha.12",
|
|
29
|
+
"@webiny/utils": "6.6.0-alpha.12",
|
|
30
|
+
"@webiny/wcp": "6.6.0-alpha.12",
|
|
31
31
|
"ai": "7.0.159",
|
|
32
32
|
"dataloader": "2.2.3",
|
|
33
33
|
"graphql": "16.14.2",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@types/jsonwebtoken": "9.0.10",
|
|
43
|
-
"@webiny/build-tools": "6.6.0-alpha.
|
|
43
|
+
"@webiny/build-tools": "6.6.0-alpha.12",
|
|
44
44
|
"rimraf": "6.1.3",
|
|
45
45
|
"typescript": "7.0.2",
|
|
46
46
|
"vitest": "5.0.5"
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { IdentityContext } from "../../../../features/security/IdentityContext/abstractions.js";
|
|
2
|
-
import { WebsocketsSendToIdentityUseCase } from "../../../../features/websockets/index.js";
|
|
3
|
-
import { NotifyRoleChangeUseCase as UseCaseAbstraction } from "./abstractions.js";
|
|
4
|
-
declare class NotifyRoleChangeUseCaseImpl implements UseCaseAbstraction.Interface {
|
|
5
|
-
private identityContext;
|
|
6
|
-
private sendToIdentity;
|
|
7
|
-
constructor(identityContext: IdentityContext.Interface, sendToIdentity: WebsocketsSendToIdentityUseCase.Interface);
|
|
8
|
-
execute({ id, change }: UseCaseAbstraction.Params): Promise<void>;
|
|
9
|
-
}
|
|
10
|
-
export declare const NotifyRoleChangeUseCase: import("@webiny/di").Implementation<typeof NotifyRoleChangeUseCaseImpl>;
|
|
11
|
-
export {};
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { createImplementation } from "@webiny/di";
|
|
2
|
-
import { IdentityContext } from "../../IdentityContext/abstractions.js";
|
|
3
|
-
import { WebsocketsSendToIdentityUseCase } from "../../../websockets/index.js";
|
|
4
|
-
import { NotifyRoleChangeUseCase, ROLE_CREATED_WEBSOCKET_ACTION, ROLE_DELETED_WEBSOCKET_ACTION, ROLE_UPDATED_WEBSOCKET_ACTION } from "./abstractions.js";
|
|
5
|
-
const ACTIONS = {
|
|
6
|
-
created: ROLE_CREATED_WEBSOCKET_ACTION,
|
|
7
|
-
updated: ROLE_UPDATED_WEBSOCKET_ACTION,
|
|
8
|
-
deleted: ROLE_DELETED_WEBSOCKET_ACTION
|
|
9
|
-
};
|
|
10
|
-
class NotifyRoleChangeUseCaseImpl {
|
|
11
|
-
constructor(identityContext, sendToIdentity){
|
|
12
|
-
this.identityContext = identityContext;
|
|
13
|
-
this.sendToIdentity = sendToIdentity;
|
|
14
|
-
}
|
|
15
|
-
async execute({ id, change }) {
|
|
16
|
-
const recipient = this.identityContext.getIdentity()?.id;
|
|
17
|
-
if (!recipient) return;
|
|
18
|
-
try {
|
|
19
|
-
await this.sendToIdentity.execute({
|
|
20
|
-
id: recipient
|
|
21
|
-
}, {
|
|
22
|
-
action: ACTIONS[change],
|
|
23
|
-
data: {
|
|
24
|
-
id
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
} catch {}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
const NotifyRoleChangeUseCase_NotifyRoleChangeUseCase = createImplementation({
|
|
31
|
-
abstraction: NotifyRoleChangeUseCase,
|
|
32
|
-
implementation: NotifyRoleChangeUseCaseImpl,
|
|
33
|
-
dependencies: [
|
|
34
|
-
IdentityContext,
|
|
35
|
-
WebsocketsSendToIdentityUseCase
|
|
36
|
-
]
|
|
37
|
-
});
|
|
38
|
-
export { NotifyRoleChangeUseCase_NotifyRoleChangeUseCase as NotifyRoleChangeUseCase };
|
|
39
|
-
|
|
40
|
-
//# sourceMappingURL=NotifyRoleChangeUseCase.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"features/security/roles/NotifyRoleChange/NotifyRoleChangeUseCase.js","sources":["../../../../../src/features/security/roles/NotifyRoleChange/NotifyRoleChangeUseCase.ts"],"sourcesContent":["import { createImplementation } from \"@webiny/di\";\nimport { IdentityContext } from \"~/features/security/IdentityContext/abstractions.js\";\nimport { WebsocketsSendToIdentityUseCase } from \"~/features/websockets/index.js\";\nimport { ROLE_CREATED_WEBSOCKET_ACTION } from \"./abstractions.js\";\nimport { ROLE_DELETED_WEBSOCKET_ACTION } from \"./abstractions.js\";\nimport { ROLE_UPDATED_WEBSOCKET_ACTION } from \"./abstractions.js\";\nimport { NotifyRoleChangeUseCase as UseCaseAbstraction } from \"./abstractions.js\";\n\nconst ACTIONS: Record<UseCaseAbstraction.Params[\"change\"], string> = {\n created: ROLE_CREATED_WEBSOCKET_ACTION,\n updated: ROLE_UPDATED_WEBSOCKET_ACTION,\n deleted: ROLE_DELETED_WEBSOCKET_ACTION\n};\n\n/*\n * Changes the admin makes itself are announced too: the admin applies them by id, so the tab that\n * made the change ends up where it already was and the user's other tabs catch up.\n *\n * The change is saved whether or not the message goes out, so a failed send is swallowed rather than\n * failing the write. The admin then shows the change after its next reload.\n */\nclass NotifyRoleChangeUseCaseImpl implements UseCaseAbstraction.Interface {\n constructor(\n private identityContext: IdentityContext.Interface,\n private sendToIdentity: WebsocketsSendToIdentityUseCase.Interface\n ) {}\n\n async execute({ id, change }: UseCaseAbstraction.Params): Promise<void> {\n const recipient = this.identityContext.getIdentity()?.id;\n if (!recipient) {\n return;\n }\n\n try {\n await this.sendToIdentity.execute(\n { id: recipient },\n { action: ACTIONS[change], data: { id } }\n );\n } catch {\n // See above.\n }\n }\n}\n\nexport const NotifyRoleChangeUseCase = createImplementation({\n abstraction: UseCaseAbstraction,\n implementation: NotifyRoleChangeUseCaseImpl,\n dependencies: [IdentityContext, WebsocketsSendToIdentityUseCase]\n});\n"],"names":["ACTIONS","ROLE_CREATED_WEBSOCKET_ACTION","ROLE_UPDATED_WEBSOCKET_ACTION","ROLE_DELETED_WEBSOCKET_ACTION","NotifyRoleChangeUseCaseImpl","identityContext","sendToIdentity","id","change","recipient","NotifyRoleChangeUseCase","createImplementation","UseCaseAbstraction","IdentityContext","WebsocketsSendToIdentityUseCase"],"mappings":";;;;AAQA,MAAMA,UAA+D;IACjE,SAASC;IACT,SAASC;IACT,SAASC;AACb;AASA,MAAMC;IACF,YACYC,eAA0C,EAC1CC,cAAyD,CACnE;aAFUD,eAAe,GAAfA;aACAC,cAAc,GAAdA;IACT;IAEH,MAAM,QAAQ,EAAEC,EAAE,EAAEC,MAAM,EAA6B,EAAiB;QACpE,MAAMC,YAAY,IAAI,CAAC,eAAe,CAAC,WAAW,IAAI;QACtD,IAAI,CAACA,WACD;QAGJ,IAAI;YACA,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAC7B;gBAAE,IAAIA;YAAU,GAChB;gBAAE,QAAQT,OAAO,CAACQ,OAAO;gBAAE,MAAM;oBAAED;gBAAG;YAAE;QAEhD,EAAE,OAAM,CAER;IACJ;AACJ;AAEO,MAAMG,kDAA0BC,qBAAqB;IACxD,aAAaC;IACb,gBAAgBR;IAChB,cAAc;QAACS;QAAiBC;KAAgC;AACpE"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Sent to the user's open admin tabs when a role changes. The admin keeps its own roles list, and a
|
|
3
|
-
* change made on the server (by the assistant's role tools, for one) never passes through it, so
|
|
4
|
-
* without these the Roles view shows the old list until a reload. Each carries the role id only; the
|
|
5
|
-
* admin reads the role back, or drops it for `deleted`.
|
|
6
|
-
*/
|
|
7
|
-
export declare const ROLE_CREATED_WEBSOCKET_ACTION = "security.role.created";
|
|
8
|
-
export declare const ROLE_UPDATED_WEBSOCKET_ACTION = "security.role.updated";
|
|
9
|
-
export declare const ROLE_DELETED_WEBSOCKET_ACTION = "security.role.deleted";
|
|
10
|
-
export interface NotifyRoleChangeParams {
|
|
11
|
-
id: string;
|
|
12
|
-
change: "created" | "updated" | "deleted";
|
|
13
|
-
}
|
|
14
|
-
export interface INotifyRoleChangeUseCase {
|
|
15
|
-
execute(params: NotifyRoleChangeParams): Promise<void>;
|
|
16
|
-
}
|
|
17
|
-
export declare const NotifyRoleChangeUseCase: import("@webiny/di").Abstraction<INotifyRoleChangeUseCase>;
|
|
18
|
-
export declare namespace NotifyRoleChangeUseCase {
|
|
19
|
-
type Interface = INotifyRoleChangeUseCase;
|
|
20
|
-
type Params = NotifyRoleChangeParams;
|
|
21
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { createAbstraction } from "@webiny/feature/api";
|
|
2
|
-
const ROLE_CREATED_WEBSOCKET_ACTION = "security.role.created";
|
|
3
|
-
const ROLE_UPDATED_WEBSOCKET_ACTION = "security.role.updated";
|
|
4
|
-
const ROLE_DELETED_WEBSOCKET_ACTION = "security.role.deleted";
|
|
5
|
-
const NotifyRoleChangeUseCase = createAbstraction("Security/NotifyRoleChangeUseCase");
|
|
6
|
-
export { NotifyRoleChangeUseCase, ROLE_CREATED_WEBSOCKET_ACTION, ROLE_DELETED_WEBSOCKET_ACTION, ROLE_UPDATED_WEBSOCKET_ACTION };
|
|
7
|
-
|
|
8
|
-
//# sourceMappingURL=abstractions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"features/security/roles/NotifyRoleChange/abstractions.js","sources":["../../../../../src/features/security/roles/NotifyRoleChange/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\n\n/**\n * Sent to the user's open admin tabs when a role changes. The admin keeps its own roles list, and a\n * change made on the server (by the assistant's role tools, for one) never passes through it, so\n * without these the Roles view shows the old list until a reload. Each carries the role id only; the\n * admin reads the role back, or drops it for `deleted`.\n */\nexport const ROLE_CREATED_WEBSOCKET_ACTION = \"security.role.created\";\nexport const ROLE_UPDATED_WEBSOCKET_ACTION = \"security.role.updated\";\nexport const ROLE_DELETED_WEBSOCKET_ACTION = \"security.role.deleted\";\n\nexport interface NotifyRoleChangeParams {\n id: string;\n change: \"created\" | \"updated\" | \"deleted\";\n}\n\nexport interface INotifyRoleChangeUseCase {\n execute(params: NotifyRoleChangeParams): Promise<void>;\n}\n\nexport const NotifyRoleChangeUseCase = createAbstraction<INotifyRoleChangeUseCase>(\n \"Security/NotifyRoleChangeUseCase\"\n);\n\nexport namespace NotifyRoleChangeUseCase {\n export type Interface = INotifyRoleChangeUseCase;\n export type Params = NotifyRoleChangeParams;\n}\n"],"names":["ROLE_CREATED_WEBSOCKET_ACTION","ROLE_UPDATED_WEBSOCKET_ACTION","ROLE_DELETED_WEBSOCKET_ACTION","NotifyRoleChangeUseCase","createAbstraction"],"mappings":";AAQO,MAAMA,gCAAgC;AACtC,MAAMC,gCAAgC;AACtC,MAAMC,gCAAgC;AAWtC,MAAMC,0BAA0BC,kBACnC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { IdentityContext } from "../../../../features/security/IdentityContext/abstractions.js";
|
|
2
|
-
import { WebsocketsSendToIdentityUseCase } from "../../../../features/websockets/index.js";
|
|
3
|
-
import { NotifyTeamChangeUseCase as UseCaseAbstraction } from "./abstractions.js";
|
|
4
|
-
declare class NotifyTeamChangeUseCaseImpl implements UseCaseAbstraction.Interface {
|
|
5
|
-
private identityContext;
|
|
6
|
-
private sendToIdentity;
|
|
7
|
-
constructor(identityContext: IdentityContext.Interface, sendToIdentity: WebsocketsSendToIdentityUseCase.Interface);
|
|
8
|
-
execute({ id, change }: UseCaseAbstraction.Params): Promise<void>;
|
|
9
|
-
}
|
|
10
|
-
export declare const NotifyTeamChangeUseCase: import("@webiny/di").Implementation<typeof NotifyTeamChangeUseCaseImpl>;
|
|
11
|
-
export {};
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { createImplementation } from "@webiny/di";
|
|
2
|
-
import { IdentityContext } from "../../IdentityContext/abstractions.js";
|
|
3
|
-
import { WebsocketsSendToIdentityUseCase } from "../../../websockets/index.js";
|
|
4
|
-
import { NotifyTeamChangeUseCase, TEAM_CREATED_WEBSOCKET_ACTION, TEAM_DELETED_WEBSOCKET_ACTION, TEAM_UPDATED_WEBSOCKET_ACTION } from "./abstractions.js";
|
|
5
|
-
const ACTIONS = {
|
|
6
|
-
created: TEAM_CREATED_WEBSOCKET_ACTION,
|
|
7
|
-
updated: TEAM_UPDATED_WEBSOCKET_ACTION,
|
|
8
|
-
deleted: TEAM_DELETED_WEBSOCKET_ACTION
|
|
9
|
-
};
|
|
10
|
-
class NotifyTeamChangeUseCaseImpl {
|
|
11
|
-
constructor(identityContext, sendToIdentity){
|
|
12
|
-
this.identityContext = identityContext;
|
|
13
|
-
this.sendToIdentity = sendToIdentity;
|
|
14
|
-
}
|
|
15
|
-
async execute({ id, change }) {
|
|
16
|
-
const recipient = this.identityContext.getIdentity()?.id;
|
|
17
|
-
if (!recipient) return;
|
|
18
|
-
try {
|
|
19
|
-
await this.sendToIdentity.execute({
|
|
20
|
-
id: recipient
|
|
21
|
-
}, {
|
|
22
|
-
action: ACTIONS[change],
|
|
23
|
-
data: {
|
|
24
|
-
id
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
} catch {}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
const NotifyTeamChangeUseCase_NotifyTeamChangeUseCase = createImplementation({
|
|
31
|
-
abstraction: NotifyTeamChangeUseCase,
|
|
32
|
-
implementation: NotifyTeamChangeUseCaseImpl,
|
|
33
|
-
dependencies: [
|
|
34
|
-
IdentityContext,
|
|
35
|
-
WebsocketsSendToIdentityUseCase
|
|
36
|
-
]
|
|
37
|
-
});
|
|
38
|
-
export { NotifyTeamChangeUseCase_NotifyTeamChangeUseCase as NotifyTeamChangeUseCase };
|
|
39
|
-
|
|
40
|
-
//# sourceMappingURL=NotifyTeamChangeUseCase.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"features/security/teams/NotifyTeamChange/NotifyTeamChangeUseCase.js","sources":["../../../../../src/features/security/teams/NotifyTeamChange/NotifyTeamChangeUseCase.ts"],"sourcesContent":["import { createImplementation } from \"@webiny/di\";\nimport { IdentityContext } from \"~/features/security/IdentityContext/abstractions.js\";\nimport { WebsocketsSendToIdentityUseCase } from \"~/features/websockets/index.js\";\nimport {\n TEAM_CREATED_WEBSOCKET_ACTION,\n TEAM_DELETED_WEBSOCKET_ACTION,\n TEAM_UPDATED_WEBSOCKET_ACTION,\n NotifyTeamChangeUseCase as UseCaseAbstraction\n} from \"./abstractions.js\";\n\nconst ACTIONS: Record<UseCaseAbstraction.Params[\"change\"], string> = {\n created: TEAM_CREATED_WEBSOCKET_ACTION,\n updated: TEAM_UPDATED_WEBSOCKET_ACTION,\n deleted: TEAM_DELETED_WEBSOCKET_ACTION\n};\n\n/*\n * Changes the admin makes itself are announced too: the admin applies them by id, so the tab that\n * made the change ends up where it already was and the user's other tabs catch up.\n *\n * The change is saved whether or not the message goes out, so a failed send is swallowed rather than\n * failing the write. The admin then shows the change after its next reload.\n */\nclass NotifyTeamChangeUseCaseImpl implements UseCaseAbstraction.Interface {\n constructor(\n private identityContext: IdentityContext.Interface,\n private sendToIdentity: WebsocketsSendToIdentityUseCase.Interface\n ) {}\n\n async execute({ id, change }: UseCaseAbstraction.Params): Promise<void> {\n const recipient = this.identityContext.getIdentity()?.id;\n if (!recipient) {\n return;\n }\n\n try {\n await this.sendToIdentity.execute(\n { id: recipient },\n { action: ACTIONS[change], data: { id } }\n );\n } catch {\n // See above.\n }\n }\n}\n\nexport const NotifyTeamChangeUseCase = createImplementation({\n abstraction: UseCaseAbstraction,\n implementation: NotifyTeamChangeUseCaseImpl,\n dependencies: [IdentityContext, WebsocketsSendToIdentityUseCase]\n});\n"],"names":["ACTIONS","TEAM_CREATED_WEBSOCKET_ACTION","TEAM_UPDATED_WEBSOCKET_ACTION","TEAM_DELETED_WEBSOCKET_ACTION","NotifyTeamChangeUseCaseImpl","identityContext","sendToIdentity","id","change","recipient","NotifyTeamChangeUseCase","createImplementation","UseCaseAbstraction","IdentityContext","WebsocketsSendToIdentityUseCase"],"mappings":";;;;AAUA,MAAMA,UAA+D;IACjE,SAASC;IACT,SAASC;IACT,SAASC;AACb;AASA,MAAMC;IACF,YACYC,eAA0C,EAC1CC,cAAyD,CACnE;aAFUD,eAAe,GAAfA;aACAC,cAAc,GAAdA;IACT;IAEH,MAAM,QAAQ,EAAEC,EAAE,EAAEC,MAAM,EAA6B,EAAiB;QACpE,MAAMC,YAAY,IAAI,CAAC,eAAe,CAAC,WAAW,IAAI;QACtD,IAAI,CAACA,WACD;QAGJ,IAAI;YACA,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAC7B;gBAAE,IAAIA;YAAU,GAChB;gBAAE,QAAQT,OAAO,CAACQ,OAAO;gBAAE,MAAM;oBAAED;gBAAG;YAAE;QAEhD,EAAE,OAAM,CAER;IACJ;AACJ;AAEO,MAAMG,kDAA0BC,qBAAqB;IACxD,aAAaC;IACb,gBAAgBR;IAChB,cAAc;QAACS;QAAiBC;KAAgC;AACpE"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Sent to the user's open admin tabs when a team changes. The admin keeps its own teams list, and a
|
|
3
|
-
* change made on the server (by the assistant's team tools, for one) never passes through it, so
|
|
4
|
-
* without these the Teams view shows the old list until a reload. Each carries the team id only; the
|
|
5
|
-
* admin reads the team back, or drops it for `deleted`.
|
|
6
|
-
*/
|
|
7
|
-
export declare const TEAM_CREATED_WEBSOCKET_ACTION = "security.team.created";
|
|
8
|
-
export declare const TEAM_UPDATED_WEBSOCKET_ACTION = "security.team.updated";
|
|
9
|
-
export declare const TEAM_DELETED_WEBSOCKET_ACTION = "security.team.deleted";
|
|
10
|
-
export interface NotifyTeamChangeParams {
|
|
11
|
-
id: string;
|
|
12
|
-
change: "created" | "updated" | "deleted";
|
|
13
|
-
}
|
|
14
|
-
export interface INotifyTeamChangeUseCase {
|
|
15
|
-
execute(params: NotifyTeamChangeParams): Promise<void>;
|
|
16
|
-
}
|
|
17
|
-
export declare const NotifyTeamChangeUseCase: import("@webiny/di").Abstraction<INotifyTeamChangeUseCase>;
|
|
18
|
-
export declare namespace NotifyTeamChangeUseCase {
|
|
19
|
-
type Interface = INotifyTeamChangeUseCase;
|
|
20
|
-
type Params = NotifyTeamChangeParams;
|
|
21
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { createAbstraction } from "@webiny/feature/api";
|
|
2
|
-
const TEAM_CREATED_WEBSOCKET_ACTION = "security.team.created";
|
|
3
|
-
const TEAM_UPDATED_WEBSOCKET_ACTION = "security.team.updated";
|
|
4
|
-
const TEAM_DELETED_WEBSOCKET_ACTION = "security.team.deleted";
|
|
5
|
-
const NotifyTeamChangeUseCase = createAbstraction("Security/NotifyTeamChangeUseCase");
|
|
6
|
-
export { NotifyTeamChangeUseCase, TEAM_CREATED_WEBSOCKET_ACTION, TEAM_DELETED_WEBSOCKET_ACTION, TEAM_UPDATED_WEBSOCKET_ACTION };
|
|
7
|
-
|
|
8
|
-
//# sourceMappingURL=abstractions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"features/security/teams/NotifyTeamChange/abstractions.js","sources":["../../../../../src/features/security/teams/NotifyTeamChange/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\n\n/**\n * Sent to the user's open admin tabs when a team changes. The admin keeps its own teams list, and a\n * change made on the server (by the assistant's team tools, for one) never passes through it, so\n * without these the Teams view shows the old list until a reload. Each carries the team id only; the\n * admin reads the team back, or drops it for `deleted`.\n */\nexport const TEAM_CREATED_WEBSOCKET_ACTION = \"security.team.created\";\nexport const TEAM_UPDATED_WEBSOCKET_ACTION = \"security.team.updated\";\nexport const TEAM_DELETED_WEBSOCKET_ACTION = \"security.team.deleted\";\n\nexport interface NotifyTeamChangeParams {\n id: string;\n change: \"created\" | \"updated\" | \"deleted\";\n}\n\nexport interface INotifyTeamChangeUseCase {\n execute(params: NotifyTeamChangeParams): Promise<void>;\n}\n\nexport const NotifyTeamChangeUseCase = createAbstraction<INotifyTeamChangeUseCase>(\n \"Security/NotifyTeamChangeUseCase\"\n);\n\nexport namespace NotifyTeamChangeUseCase {\n export type Interface = INotifyTeamChangeUseCase;\n export type Params = NotifyTeamChangeParams;\n}\n"],"names":["TEAM_CREATED_WEBSOCKET_ACTION","TEAM_UPDATED_WEBSOCKET_ACTION","TEAM_DELETED_WEBSOCKET_ACTION","NotifyTeamChangeUseCase","createAbstraction"],"mappings":";AAQO,MAAMA,gCAAgC;AACtC,MAAMC,gCAAgC;AACtC,MAAMC,gCAAgC;AAWtC,MAAMC,0BAA0BC,kBACnC"}
|