@webiny/api-aco 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/features/ai/feature.d.ts +2 -2
- package/features/ai/feature.js +0 -16
- package/features/ai/feature.js.map +1 -1
- package/features/ai/index.d.ts +0 -8
- package/features/ai/index.js +0 -8
- package/features/flp/FolderLevelPermissions/FolderLevelPermissions.js +0 -1
- package/features/flp/FolderLevelPermissions/FolderLevelPermissions.js.map +1 -1
- package/features/flp/ListFolderAccess/mayAskAboutUser.js +1 -1
- package/features/flp/ListFolderAccess/mayAskAboutUser.js.map +1 -1
- package/features/folder/NotifyFolderChange/NotifyOnFolderDeletedHandler.d.ts +3 -3
- package/features/folder/NotifyFolderChange/NotifyOnFolderDeletedHandler.js +10 -10
- package/features/folder/NotifyFolderChange/NotifyOnFolderDeletedHandler.js.map +1 -1
- package/features/folder/NotifyFolderChange/feature.js +0 -2
- package/features/folder/NotifyFolderChange/feature.js.map +1 -1
- package/features/folder/NotifyFolderChange/index.d.ts +1 -1
- package/features/folder/NotifyFolderChange/index.js +1 -1
- package/features/folder/NotifyFolderChange/recordType.d.ts +8 -0
- package/features/folder/NotifyFolderChange/recordType.js +4 -0
- package/features/folder/NotifyFolderChange/recordType.js.map +1 -0
- package/flpTaskCatalog/TaskFolderCatalogSync.d.ts +1 -0
- package/flpTaskCatalog/TaskFolderCatalogSync.js +7 -2
- package/flpTaskCatalog/TaskFolderCatalogSync.js.map +1 -1
- package/flpTaskCatalog/tasks/createFlp.task.d.ts +3 -3
- package/flpTaskCatalog/tasks/createFlp.task.js +7 -5
- package/flpTaskCatalog/tasks/createFlp.task.js.map +1 -1
- package/flpTaskCatalog/tasks/updateFlp.task.d.ts +3 -3
- package/flpTaskCatalog/tasks/updateFlp.task.js +7 -5
- package/flpTaskCatalog/tasks/updateFlp.task.js.map +1 -1
- package/package.json +18 -18
- package/features/ai/CreateRoleTool.d.ts +0 -54
- package/features/ai/CreateRoleTool.js +0 -71
- package/features/ai/CreateRoleTool.js.map +0 -1
- package/features/ai/CreateTeamTool.d.ts +0 -48
- package/features/ai/CreateTeamTool.js +0 -56
- package/features/ai/CreateTeamTool.js.map +0 -1
- package/features/ai/DeleteRoleTool.d.ts +0 -52
- package/features/ai/DeleteRoleTool.js +0 -79
- package/features/ai/DeleteRoleTool.js.map +0 -1
- package/features/ai/DeleteTeamTool.d.ts +0 -46
- package/features/ai/DeleteTeamTool.js +0 -56
- package/features/ai/DeleteTeamTool.js.map +0 -1
- package/features/ai/ListRolesTool.d.ts +0 -39
- package/features/ai/ListRolesTool.js +0 -48
- package/features/ai/ListRolesTool.js.map +0 -1
- package/features/ai/ListTeamsTool.d.ts +0 -41
- package/features/ai/ListTeamsTool.js +0 -49
- package/features/ai/ListTeamsTool.js.map +0 -1
- package/features/ai/UpdateRoleTool.d.ts +0 -46
- package/features/ai/UpdateRoleTool.js +0 -53
- package/features/ai/UpdateRoleTool.js.map +0 -1
- package/features/ai/UpdateTeamTool.d.ts +0 -52
- package/features/ai/UpdateTeamTool.js +0 -56
- package/features/ai/UpdateTeamTool.js.map +0 -1
- package/features/folder/NotifyFolderChange/NotifyFolderChangeUseCase.d.ts +0 -11
- package/features/folder/NotifyFolderChange/NotifyFolderChangeUseCase.js +0 -38
- package/features/folder/NotifyFolderChange/NotifyFolderChangeUseCase.js.map +0 -1
- package/features/folder/NotifyFolderChange/abstractions.d.ts +0 -28
- package/features/folder/NotifyFolderChange/abstractions.js +0 -8
- package/features/folder/NotifyFolderChange/abstractions.js.map +0 -1
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { AiSdkToolDefinition, AiSdkToolHandler } from "@webiny/api-core/features/ai/index.js";
|
|
3
|
-
import { ListTeamsUseCase } from "@webiny/api-core/features/security/teams/ListTeams/index.js";
|
|
4
|
-
declare const inputSchema: z.ZodObject<{}, z.core.$strip>;
|
|
5
|
-
type Input = z.infer<typeof inputSchema>;
|
|
6
|
-
interface TeamSummary {
|
|
7
|
-
id: string;
|
|
8
|
-
name: string;
|
|
9
|
-
slug: string;
|
|
10
|
-
description?: string;
|
|
11
|
-
/** Role ids, so `updateTeam` can be given the full list with one role added or removed. */
|
|
12
|
-
roles: string[];
|
|
13
|
-
}
|
|
14
|
-
declare class ListTeamsToolHandlerImpl implements AiSdkToolHandler.Interface<Input> {
|
|
15
|
-
private listTeams;
|
|
16
|
-
constructor(listTeams: ListTeamsUseCase.Interface);
|
|
17
|
-
execute(): Promise<TeamSummary[]>;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Resolves human names ("team A") to the ids folder permissions actually take.
|
|
21
|
-
*
|
|
22
|
-
* Kept separate from setFolderPermissions rather than accepting a team name there: the user approves
|
|
23
|
-
* the arguments of a write, so the id has to be looked up and shown, not guessed inside the write.
|
|
24
|
-
*/
|
|
25
|
-
declare class ListTeamsToolImpl implements AiSdkToolDefinition.Interface<Input> {
|
|
26
|
-
readonly name = "listTeams";
|
|
27
|
-
readonly title = "List teams";
|
|
28
|
-
readonly description = "Lists the teams in this project with their ids, names, slugs and role ids. Folder permission targets use the SLUG (`team:<slug>`), not the id; updateTeam and deleteTeam take the id.";
|
|
29
|
-
readonly inputSchema: z.ZodObject<{}, z.core.$strip>;
|
|
30
|
-
readonly annotations: {
|
|
31
|
-
readOnlyHint: boolean;
|
|
32
|
-
idempotentHint: boolean;
|
|
33
|
-
};
|
|
34
|
-
readonly handler: typeof ListTeamsToolHandlerImpl & {
|
|
35
|
-
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/ai/abstractions").IAiSdkToolHandler<any>>;
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
export declare const ListTeamsTool: typeof ListTeamsToolImpl & {
|
|
39
|
-
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/ai/abstractions").IAiSdkToolDefinition<any>>;
|
|
40
|
-
};
|
|
41
|
-
export {};
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { AiSdkToolDefinition, AiSdkToolHandler } from "@webiny/api-core/features/ai/index.js";
|
|
3
|
-
import { ListTeamsUseCase } from "@webiny/api-core/features/security/teams/ListTeams/index.js";
|
|
4
|
-
const inputSchema = z.object({});
|
|
5
|
-
class ListTeamsToolHandlerImpl {
|
|
6
|
-
constructor(listTeams){
|
|
7
|
-
this.listTeams = listTeams;
|
|
8
|
-
}
|
|
9
|
-
async execute() {
|
|
10
|
-
const result = await this.listTeams.execute();
|
|
11
|
-
if (result.isFail()) throw new Error(`Could not list teams: ${result.error.message}`);
|
|
12
|
-
return result.value.map((team)=>{
|
|
13
|
-
const summary = {
|
|
14
|
-
id: team.id,
|
|
15
|
-
name: team.name,
|
|
16
|
-
slug: team.slug,
|
|
17
|
-
roles: team.roles
|
|
18
|
-
};
|
|
19
|
-
if (team.description) summary.description = team.description;
|
|
20
|
-
return summary;
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
const ListTeamsToolHandler = AiSdkToolHandler.createImplementation({
|
|
25
|
-
implementation: ListTeamsToolHandlerImpl,
|
|
26
|
-
dependencies: [
|
|
27
|
-
ListTeamsUseCase
|
|
28
|
-
]
|
|
29
|
-
});
|
|
30
|
-
class ListTeamsToolImpl {
|
|
31
|
-
constructor(){
|
|
32
|
-
this.name = "listTeams";
|
|
33
|
-
this.title = "List teams";
|
|
34
|
-
this.description = "Lists the teams in this project with their ids, names, slugs and role ids. Folder permission targets use the SLUG (`team:<slug>`), not the id; updateTeam and deleteTeam take the id.";
|
|
35
|
-
this.inputSchema = inputSchema;
|
|
36
|
-
this.annotations = {
|
|
37
|
-
readOnlyHint: true,
|
|
38
|
-
idempotentHint: true
|
|
39
|
-
};
|
|
40
|
-
this.handler = ListTeamsToolHandler;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
const ListTeamsTool = AiSdkToolDefinition.createImplementation({
|
|
44
|
-
implementation: ListTeamsToolImpl,
|
|
45
|
-
dependencies: []
|
|
46
|
-
});
|
|
47
|
-
export { ListTeamsTool };
|
|
48
|
-
|
|
49
|
-
//# sourceMappingURL=ListTeamsTool.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"features/ai/ListTeamsTool.js","sources":["../../../src/features/ai/ListTeamsTool.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { AiSdkToolDefinition, AiSdkToolHandler } from \"@webiny/api-core/features/ai/index.js\";\nimport { ListTeamsUseCase } from \"@webiny/api-core/features/security/teams/ListTeams/index.js\";\n\nconst inputSchema = z.object({});\n\ntype Input = z.infer<typeof inputSchema>;\n\ninterface TeamSummary {\n id: string;\n name: string;\n slug: string;\n description?: string;\n /** Role ids, so `updateTeam` can be given the full list with one role added or removed. */\n roles: string[];\n}\n\nclass ListTeamsToolHandlerImpl implements AiSdkToolHandler.Interface<Input> {\n constructor(private listTeams: ListTeamsUseCase.Interface) {}\n\n async execute(): Promise<TeamSummary[]> {\n const result = await this.listTeams.execute();\n\n if (result.isFail()) {\n throw new Error(`Could not list teams: ${result.error.message}`);\n }\n\n return result.value.map(team => {\n const summary: TeamSummary = {\n id: team.id,\n name: team.name,\n slug: team.slug,\n roles: team.roles\n };\n\n if (team.description) {\n summary.description = team.description;\n }\n\n return summary;\n });\n }\n}\n\nconst ListTeamsToolHandler = AiSdkToolHandler.createImplementation({\n implementation: ListTeamsToolHandlerImpl,\n dependencies: [ListTeamsUseCase]\n});\n\n/**\n * Resolves human names (\"team A\") to the ids folder permissions actually take.\n *\n * Kept separate from setFolderPermissions rather than accepting a team name there: the user approves\n * the arguments of a write, so the id has to be looked up and shown, not guessed inside the write.\n */\nclass ListTeamsToolImpl implements AiSdkToolDefinition.Interface<Input> {\n readonly name = \"listTeams\";\n readonly title = \"List teams\";\n readonly description =\n \"Lists the teams in this project with their ids, names, slugs and role ids. Folder permission targets use the SLUG (`team:<slug>`), not the id; updateTeam and deleteTeam take the id.\";\n readonly inputSchema = inputSchema;\n readonly annotations = { readOnlyHint: true, idempotentHint: true };\n readonly handler = ListTeamsToolHandler;\n}\n\nexport const ListTeamsTool = AiSdkToolDefinition.createImplementation({\n implementation: ListTeamsToolImpl,\n dependencies: []\n});\n"],"names":["inputSchema","z","ListTeamsToolHandlerImpl","listTeams","result","Error","team","summary","ListTeamsToolHandler","AiSdkToolHandler","ListTeamsUseCase","ListTeamsToolImpl","ListTeamsTool","AiSdkToolDefinition"],"mappings":";;;AAIA,MAAMA,cAAcC,EAAE,MAAM,CAAC,CAAC;AAa9B,MAAMC;IACF,YAAoBC,SAAqC,CAAE;aAAvCA,SAAS,GAATA;IAAwC;IAE5D,MAAM,UAAkC;QACpC,MAAMC,SAAS,MAAM,IAAI,CAAC,SAAS,CAAC,OAAO;QAE3C,IAAIA,OAAO,MAAM,IACb,MAAM,IAAIC,MAAM,CAAC,sBAAsB,EAAED,OAAO,KAAK,CAAC,OAAO,EAAE;QAGnE,OAAOA,OAAO,KAAK,CAAC,GAAG,CAACE,CAAAA;YACpB,MAAMC,UAAuB;gBACzB,IAAID,KAAK,EAAE;gBACX,MAAMA,KAAK,IAAI;gBACf,MAAMA,KAAK,IAAI;gBACf,OAAOA,KAAK,KAAK;YACrB;YAEA,IAAIA,KAAK,WAAW,EAChBC,QAAQ,WAAW,GAAGD,KAAK,WAAW;YAG1C,OAAOC;QACX;IACJ;AACJ;AAEA,MAAMC,uBAAuBC,iBAAiB,oBAAoB,CAAC;IAC/D,gBAAgBP;IAChB,cAAc;QAACQ;KAAiB;AACpC;AAQA,MAAMC;;aACO,IAAI,GAAG;aACP,KAAK,GAAG;aACR,WAAW,GAChB;aACK,WAAW,GAAGX;aACd,WAAW,GAAG;YAAE,cAAc;YAAM,gBAAgB;QAAK;aACzD,OAAO,GAAGQ;;AACvB;AAEO,MAAMI,gBAAgBC,oBAAoB,oBAAoB,CAAC;IAClE,gBAAgBF;IAChB,cAAc,EAAE;AACpB"}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { AiSdkToolDefinition } from "@webiny/api-core/features/ai/index.js";
|
|
3
|
-
import { AiSdkToolHandler } from "@webiny/api-core/features/ai/index.js";
|
|
4
|
-
import { UpdateRoleUseCase } from "@webiny/api-core/features/security/roles/UpdateRole/index.js";
|
|
5
|
-
declare const inputSchema: z.ZodObject<{
|
|
6
|
-
roleId: z.ZodString;
|
|
7
|
-
name: z.ZodOptional<z.ZodString>;
|
|
8
|
-
description: z.ZodOptional<z.ZodString>;
|
|
9
|
-
}, z.core.$strip>;
|
|
10
|
-
type Input = z.infer<typeof inputSchema>;
|
|
11
|
-
interface UpdatedRole {
|
|
12
|
-
id: string;
|
|
13
|
-
name: string;
|
|
14
|
-
slug: string;
|
|
15
|
-
description: string;
|
|
16
|
-
}
|
|
17
|
-
declare class UpdateRoleToolHandlerImpl implements AiSdkToolHandler.Interface<Input> {
|
|
18
|
-
private updateRole;
|
|
19
|
-
constructor(updateRole: UpdateRoleUseCase.Interface);
|
|
20
|
-
execute(input: Input): Promise<UpdatedRole>;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Renames a role or changes its description. Permissions are out of reach for the same reason as in
|
|
24
|
-
* `createRole`. The slug cannot change because `UpdateRoleUseCase` does not accept one.
|
|
25
|
-
*/
|
|
26
|
-
declare class UpdateRoleToolImpl implements AiSdkToolDefinition.Interface<Input> {
|
|
27
|
-
readonly name = "updateRole";
|
|
28
|
-
readonly title = "Update role";
|
|
29
|
-
readonly description = "Changes a role's name or description. Call listRoles first for the id. Permissions cannot be changed with this tool; the user edits them on the Roles screen. Roles defined in code cannot be changed. Requires user approval.";
|
|
30
|
-
readonly inputSchema: z.ZodObject<{
|
|
31
|
-
roleId: z.ZodString;
|
|
32
|
-
name: z.ZodOptional<z.ZodString>;
|
|
33
|
-
description: z.ZodOptional<z.ZodString>;
|
|
34
|
-
}, z.core.$strip>;
|
|
35
|
-
readonly annotations: {
|
|
36
|
-
readOnlyHint: boolean;
|
|
37
|
-
idempotentHint: boolean;
|
|
38
|
-
};
|
|
39
|
-
readonly handler: typeof UpdateRoleToolHandlerImpl & {
|
|
40
|
-
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/ai/abstractions").IAiSdkToolHandler<any>>;
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
export declare const UpdateRoleTool: typeof UpdateRoleToolImpl & {
|
|
44
|
-
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/ai/abstractions").IAiSdkToolDefinition<any>>;
|
|
45
|
-
};
|
|
46
|
-
export {};
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { AiSdkToolDefinition, AiSdkToolHandler } from "@webiny/api-core/features/ai/index.js";
|
|
3
|
-
import { UpdateRoleUseCase } from "@webiny/api-core/features/security/roles/UpdateRole/index.js";
|
|
4
|
-
const inputSchema = z.object({
|
|
5
|
-
roleId: z.string().describe("Role id as returned by listRoles."),
|
|
6
|
-
name: z.string().min(3).optional().describe("New role name. Omit it to keep the current one."),
|
|
7
|
-
description: z.string().max(500).optional().describe("New description. Omit it to keep the current one; an empty string clears it.")
|
|
8
|
-
});
|
|
9
|
-
class UpdateRoleToolHandlerImpl {
|
|
10
|
-
constructor(updateRole){
|
|
11
|
-
this.updateRole = updateRole;
|
|
12
|
-
}
|
|
13
|
-
async execute(input) {
|
|
14
|
-
const result = await this.updateRole.execute(input.roleId, {
|
|
15
|
-
name: input.name,
|
|
16
|
-
description: input.description
|
|
17
|
-
});
|
|
18
|
-
if (result.isFail()) throw new Error(`Could not update the role: ${result.error.message}`);
|
|
19
|
-
const role = result.value;
|
|
20
|
-
return {
|
|
21
|
-
id: role.id,
|
|
22
|
-
name: role.name,
|
|
23
|
-
slug: role.slug,
|
|
24
|
-
description: role.description
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
const UpdateRoleToolHandler = AiSdkToolHandler.createImplementation({
|
|
29
|
-
implementation: UpdateRoleToolHandlerImpl,
|
|
30
|
-
dependencies: [
|
|
31
|
-
UpdateRoleUseCase
|
|
32
|
-
]
|
|
33
|
-
});
|
|
34
|
-
class UpdateRoleToolImpl {
|
|
35
|
-
constructor(){
|
|
36
|
-
this.name = "updateRole";
|
|
37
|
-
this.title = "Update role";
|
|
38
|
-
this.description = "Changes a role's name or description. Call listRoles first for the id. Permissions cannot be changed with this tool; the user edits them on the Roles screen. Roles defined in code cannot be changed. Requires user approval.";
|
|
39
|
-
this.inputSchema = inputSchema;
|
|
40
|
-
this.annotations = {
|
|
41
|
-
readOnlyHint: false,
|
|
42
|
-
idempotentHint: true
|
|
43
|
-
};
|
|
44
|
-
this.handler = UpdateRoleToolHandler;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
const UpdateRoleTool = AiSdkToolDefinition.createImplementation({
|
|
48
|
-
implementation: UpdateRoleToolImpl,
|
|
49
|
-
dependencies: []
|
|
50
|
-
});
|
|
51
|
-
export { UpdateRoleTool };
|
|
52
|
-
|
|
53
|
-
//# sourceMappingURL=UpdateRoleTool.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"features/ai/UpdateRoleTool.js","sources":["../../../src/features/ai/UpdateRoleTool.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { AiSdkToolDefinition } from \"@webiny/api-core/features/ai/index.js\";\nimport { AiSdkToolHandler } from \"@webiny/api-core/features/ai/index.js\";\nimport { UpdateRoleUseCase } from \"@webiny/api-core/features/security/roles/UpdateRole/index.js\";\n\nconst inputSchema = z.object({\n roleId: z.string().describe(\"Role id as returned by listRoles.\"),\n name: z.string().min(3).optional().describe(\"New role name. Omit it to keep the current one.\"),\n description: z\n .string()\n .max(500)\n .optional()\n .describe(\"New description. Omit it to keep the current one; an empty string clears it.\")\n});\n\ntype Input = z.infer<typeof inputSchema>;\n\ninterface UpdatedRole {\n id: string;\n name: string;\n slug: string;\n description: string;\n}\n\nclass UpdateRoleToolHandlerImpl implements AiSdkToolHandler.Interface<Input> {\n constructor(private updateRole: UpdateRoleUseCase.Interface) {}\n\n async execute(input: Input): Promise<UpdatedRole> {\n // A field the model left out arrives as `undefined`; `UpdateRoleUseCase` leaves those alone.\n const result = await this.updateRole.execute(input.roleId, {\n name: input.name,\n description: input.description\n });\n\n if (result.isFail()) {\n throw new Error(`Could not update the role: ${result.error.message}`);\n }\n\n const role = result.value;\n\n return { id: role.id, name: role.name, slug: role.slug, description: role.description };\n }\n}\n\nconst UpdateRoleToolHandler = AiSdkToolHandler.createImplementation({\n implementation: UpdateRoleToolHandlerImpl,\n dependencies: [UpdateRoleUseCase]\n});\n\n/**\n * Renames a role or changes its description. Permissions are out of reach for the same reason as in\n * `createRole`. The slug cannot change because `UpdateRoleUseCase` does not accept one.\n */\nclass UpdateRoleToolImpl implements AiSdkToolDefinition.Interface<Input> {\n readonly name = \"updateRole\";\n readonly title = \"Update role\";\n readonly description =\n \"Changes a role's name or description. Call listRoles first for the id. Permissions cannot be changed with this tool; the user edits them on the Roles screen. Roles defined in code cannot be changed. Requires user approval.\";\n readonly inputSchema = inputSchema;\n readonly annotations = { readOnlyHint: false, idempotentHint: true };\n readonly handler = UpdateRoleToolHandler;\n}\n\nexport const UpdateRoleTool = AiSdkToolDefinition.createImplementation({\n implementation: UpdateRoleToolImpl,\n dependencies: []\n});\n"],"names":["inputSchema","z","UpdateRoleToolHandlerImpl","updateRole","input","result","Error","role","UpdateRoleToolHandler","AiSdkToolHandler","UpdateRoleUseCase","UpdateRoleToolImpl","UpdateRoleTool","AiSdkToolDefinition"],"mappings":";;;AAKA,MAAMA,cAAcC,EAAE,MAAM,CAAC;IACzB,QAAQA,EAAE,MAAM,GAAG,QAAQ,CAAC;IAC5B,MAAMA,EAAE,MAAM,GAAG,GAAG,CAAC,GAAG,QAAQ,GAAG,QAAQ,CAAC;IAC5C,aAAaA,EAAAA,MACF,GACN,GAAG,CAAC,KACJ,QAAQ,GACR,QAAQ,CAAC;AAClB;AAWA,MAAMC;IACF,YAAoBC,UAAuC,CAAE;aAAzCA,UAAU,GAAVA;IAA0C;IAE9D,MAAM,QAAQC,KAAY,EAAwB;QAE9C,MAAMC,SAAS,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,CAACD,MAAM,MAAM,EAAE;YACvD,MAAMA,MAAM,IAAI;YAChB,aAAaA,MAAM,WAAW;QAClC;QAEA,IAAIC,OAAO,MAAM,IACb,MAAM,IAAIC,MAAM,CAAC,2BAA2B,EAAED,OAAO,KAAK,CAAC,OAAO,EAAE;QAGxE,MAAME,OAAOF,OAAO,KAAK;QAEzB,OAAO;YAAE,IAAIE,KAAK,EAAE;YAAE,MAAMA,KAAK,IAAI;YAAE,MAAMA,KAAK,IAAI;YAAE,aAAaA,KAAK,WAAW;QAAC;IAC1F;AACJ;AAEA,MAAMC,wBAAwBC,iBAAiB,oBAAoB,CAAC;IAChE,gBAAgBP;IAChB,cAAc;QAACQ;KAAkB;AACrC;AAMA,MAAMC;;aACO,IAAI,GAAG;aACP,KAAK,GAAG;aACR,WAAW,GAChB;aACK,WAAW,GAAGX;aACd,WAAW,GAAG;YAAE,cAAc;YAAO,gBAAgB;QAAK;aAC1D,OAAO,GAAGQ;;AACvB;AAEO,MAAMI,iBAAiBC,oBAAoB,oBAAoB,CAAC;IACnE,gBAAgBF;IAChB,cAAc,EAAE;AACpB"}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { AiSdkToolDefinition, AiSdkToolHandler } from "@webiny/api-core/features/ai/index.js";
|
|
3
|
-
import { UpdateTeam } from "@webiny/api-core/features/security/teams/UpdateTeam/index.js";
|
|
4
|
-
declare const inputSchema: z.ZodObject<{
|
|
5
|
-
teamId: z.ZodString;
|
|
6
|
-
name: z.ZodOptional<z.ZodString>;
|
|
7
|
-
description: z.ZodOptional<z.ZodString>;
|
|
8
|
-
roles: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
9
|
-
}, z.core.$strip>;
|
|
10
|
-
type Input = z.infer<typeof inputSchema>;
|
|
11
|
-
interface UpdatedTeam {
|
|
12
|
-
id: string;
|
|
13
|
-
name: string;
|
|
14
|
-
slug: string;
|
|
15
|
-
description: string;
|
|
16
|
-
roles: string[];
|
|
17
|
-
}
|
|
18
|
-
declare class UpdateTeamToolHandlerImpl implements AiSdkToolHandler.Interface<Input> {
|
|
19
|
-
private updateTeam;
|
|
20
|
-
constructor(updateTeam: UpdateTeam.Interface);
|
|
21
|
-
execute(input: Input): Promise<UpdatedTeam>;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Changes a team's name, description or roles. The slug cannot change: folder permissions refer to
|
|
25
|
-
* teams by slug.
|
|
26
|
-
*
|
|
27
|
-
* Needs approval for the same reason as `createTeam`: the roles decide what the team's members can
|
|
28
|
-
* do. `roles` replaces the stored list, and the approval shows that whole list, so a role the model
|
|
29
|
-
* left out is visible as missing before anything is written.
|
|
30
|
-
*/
|
|
31
|
-
declare class UpdateTeamToolImpl implements AiSdkToolDefinition.Interface<Input> {
|
|
32
|
-
readonly name = "updateTeam";
|
|
33
|
-
readonly title = "Update team";
|
|
34
|
-
readonly description = "Changes a team's name, description or roles. Call listTeams first for the id. `roles` replaces the team's whole role list, so pass every role it should keep; call listRoles to resolve them. System teams and teams defined in code cannot be changed. Requires user approval.";
|
|
35
|
-
readonly inputSchema: z.ZodObject<{
|
|
36
|
-
teamId: z.ZodString;
|
|
37
|
-
name: z.ZodOptional<z.ZodString>;
|
|
38
|
-
description: z.ZodOptional<z.ZodString>;
|
|
39
|
-
roles: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
40
|
-
}, z.core.$strip>;
|
|
41
|
-
readonly annotations: {
|
|
42
|
-
readOnlyHint: boolean;
|
|
43
|
-
idempotentHint: boolean;
|
|
44
|
-
};
|
|
45
|
-
readonly handler: typeof UpdateTeamToolHandlerImpl & {
|
|
46
|
-
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/ai/abstractions").IAiSdkToolHandler<any>>;
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
export declare const UpdateTeamTool: typeof UpdateTeamToolImpl & {
|
|
50
|
-
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/ai/abstractions").IAiSdkToolDefinition<any>>;
|
|
51
|
-
};
|
|
52
|
-
export {};
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { AiSdkToolDefinition, AiSdkToolHandler } from "@webiny/api-core/features/ai/index.js";
|
|
3
|
-
import { UpdateTeam } from "@webiny/api-core/features/security/teams/UpdateTeam/index.js";
|
|
4
|
-
const inputSchema = z.object({
|
|
5
|
-
teamId: z.string().describe("Team id as returned by listTeams."),
|
|
6
|
-
name: z.string().min(3).optional().describe("New team name. Omit it to keep the current one."),
|
|
7
|
-
description: z.string().max(500).optional().describe("New description. Omit it to keep the current one; an empty string clears it."),
|
|
8
|
-
roles: z.array(z.string()).optional().describe("The complete list of roles the team should have afterwards. It REPLACES the stored list, so include the roles to keep. Omit it to leave the roles alone. Resolve values with listRoles first.")
|
|
9
|
-
});
|
|
10
|
-
class UpdateTeamToolHandlerImpl {
|
|
11
|
-
constructor(updateTeam){
|
|
12
|
-
this.updateTeam = updateTeam;
|
|
13
|
-
}
|
|
14
|
-
async execute(input) {
|
|
15
|
-
const result = await this.updateTeam.execute(input.teamId, {
|
|
16
|
-
name: input.name,
|
|
17
|
-
description: input.description,
|
|
18
|
-
roles: input.roles
|
|
19
|
-
});
|
|
20
|
-
if (result.isFail()) throw new Error(`Could not update the team: ${result.error.message}`);
|
|
21
|
-
const team = result.value;
|
|
22
|
-
return {
|
|
23
|
-
id: team.id,
|
|
24
|
-
name: team.name,
|
|
25
|
-
slug: team.slug,
|
|
26
|
-
description: team.description,
|
|
27
|
-
roles: team.roles
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
const UpdateTeamToolHandler = AiSdkToolHandler.createImplementation({
|
|
32
|
-
implementation: UpdateTeamToolHandlerImpl,
|
|
33
|
-
dependencies: [
|
|
34
|
-
UpdateTeam
|
|
35
|
-
]
|
|
36
|
-
});
|
|
37
|
-
class UpdateTeamToolImpl {
|
|
38
|
-
constructor(){
|
|
39
|
-
this.name = "updateTeam";
|
|
40
|
-
this.title = "Update team";
|
|
41
|
-
this.description = "Changes a team's name, description or roles. Call listTeams first for the id. `roles` replaces the team's whole role list, so pass every role it should keep; call listRoles to resolve them. System teams and teams defined in code cannot be changed. Requires user approval.";
|
|
42
|
-
this.inputSchema = inputSchema;
|
|
43
|
-
this.annotations = {
|
|
44
|
-
readOnlyHint: false,
|
|
45
|
-
idempotentHint: true
|
|
46
|
-
};
|
|
47
|
-
this.handler = UpdateTeamToolHandler;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
const UpdateTeamTool = AiSdkToolDefinition.createImplementation({
|
|
51
|
-
implementation: UpdateTeamToolImpl,
|
|
52
|
-
dependencies: []
|
|
53
|
-
});
|
|
54
|
-
export { UpdateTeamTool };
|
|
55
|
-
|
|
56
|
-
//# sourceMappingURL=UpdateTeamTool.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"features/ai/UpdateTeamTool.js","sources":["../../../src/features/ai/UpdateTeamTool.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { AiSdkToolDefinition, AiSdkToolHandler } from \"@webiny/api-core/features/ai/index.js\";\nimport { UpdateTeam } from \"@webiny/api-core/features/security/teams/UpdateTeam/index.js\";\n\nconst inputSchema = z.object({\n teamId: z.string().describe(\"Team id as returned by listTeams.\"),\n name: z.string().min(3).optional().describe(\"New team name. Omit it to keep the current one.\"),\n description: z\n .string()\n .max(500)\n .optional()\n .describe(\"New description. Omit it to keep the current one; an empty string clears it.\"),\n roles: z\n .array(z.string())\n .optional()\n .describe(\n \"The complete list of roles the team should have afterwards. It REPLACES the stored list, so include the roles to keep. Omit it to leave the roles alone. Resolve values with listRoles first.\"\n )\n});\n\ntype Input = z.infer<typeof inputSchema>;\n\ninterface UpdatedTeam {\n id: string;\n name: string;\n slug: string;\n description: string;\n roles: string[];\n}\n\nclass UpdateTeamToolHandlerImpl implements AiSdkToolHandler.Interface<Input> {\n constructor(private updateTeam: UpdateTeam.Interface) {}\n\n async execute(input: Input): Promise<UpdatedTeam> {\n // A field the model left out arrives as `undefined`; `UpdateTeam` leaves those alone.\n const result = await this.updateTeam.execute(input.teamId, {\n name: input.name,\n description: input.description,\n roles: input.roles\n });\n\n if (result.isFail()) {\n throw new Error(`Could not update the team: ${result.error.message}`);\n }\n\n const team = result.value;\n\n return {\n id: team.id,\n name: team.name,\n slug: team.slug,\n description: team.description,\n // From the updated team, so the caller sees the resolved ids that were actually stored.\n roles: team.roles\n };\n }\n}\n\nconst UpdateTeamToolHandler = AiSdkToolHandler.createImplementation({\n implementation: UpdateTeamToolHandlerImpl,\n dependencies: [UpdateTeam]\n});\n\n/**\n * Changes a team's name, description or roles. The slug cannot change: folder permissions refer to\n * teams by slug.\n *\n * Needs approval for the same reason as `createTeam`: the roles decide what the team's members can\n * do. `roles` replaces the stored list, and the approval shows that whole list, so a role the model\n * left out is visible as missing before anything is written.\n */\nclass UpdateTeamToolImpl implements AiSdkToolDefinition.Interface<Input> {\n readonly name = \"updateTeam\";\n readonly title = \"Update team\";\n readonly description =\n \"Changes a team's name, description or roles. Call listTeams first for the id. `roles` replaces the team's whole role list, so pass every role it should keep; call listRoles to resolve them. System teams and teams defined in code cannot be changed. Requires user approval.\";\n readonly inputSchema = inputSchema;\n readonly annotations = { readOnlyHint: false, idempotentHint: true };\n readonly handler = UpdateTeamToolHandler;\n}\n\nexport const UpdateTeamTool = AiSdkToolDefinition.createImplementation({\n implementation: UpdateTeamToolImpl,\n dependencies: []\n});\n"],"names":["inputSchema","z","UpdateTeamToolHandlerImpl","updateTeam","input","result","Error","team","UpdateTeamToolHandler","AiSdkToolHandler","UpdateTeam","UpdateTeamToolImpl","UpdateTeamTool","AiSdkToolDefinition"],"mappings":";;;AAIA,MAAMA,cAAcC,EAAE,MAAM,CAAC;IACzB,QAAQA,EAAE,MAAM,GAAG,QAAQ,CAAC;IAC5B,MAAMA,EAAE,MAAM,GAAG,GAAG,CAAC,GAAG,QAAQ,GAAG,QAAQ,CAAC;IAC5C,aAAaA,EAAAA,MACF,GACN,GAAG,CAAC,KACJ,QAAQ,GACR,QAAQ,CAAC;IACd,OAAOA,EAAAA,KACG,CAACA,EAAE,MAAM,IACd,QAAQ,GACR,QAAQ,CACL;AAEZ;AAYA,MAAMC;IACF,YAAoBC,UAAgC,CAAE;aAAlCA,UAAU,GAAVA;IAAmC;IAEvD,MAAM,QAAQC,KAAY,EAAwB;QAE9C,MAAMC,SAAS,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,CAACD,MAAM,MAAM,EAAE;YACvD,MAAMA,MAAM,IAAI;YAChB,aAAaA,MAAM,WAAW;YAC9B,OAAOA,MAAM,KAAK;QACtB;QAEA,IAAIC,OAAO,MAAM,IACb,MAAM,IAAIC,MAAM,CAAC,2BAA2B,EAAED,OAAO,KAAK,CAAC,OAAO,EAAE;QAGxE,MAAME,OAAOF,OAAO,KAAK;QAEzB,OAAO;YACH,IAAIE,KAAK,EAAE;YACX,MAAMA,KAAK,IAAI;YACf,MAAMA,KAAK,IAAI;YACf,aAAaA,KAAK,WAAW;YAE7B,OAAOA,KAAK,KAAK;QACrB;IACJ;AACJ;AAEA,MAAMC,wBAAwBC,iBAAiB,oBAAoB,CAAC;IAChE,gBAAgBP;IAChB,cAAc;QAACQ;KAAW;AAC9B;AAUA,MAAMC;;aACO,IAAI,GAAG;aACP,KAAK,GAAG;aACR,WAAW,GAChB;aACK,WAAW,GAAGX;aACd,WAAW,GAAG;YAAE,cAAc;YAAO,gBAAgB;QAAK;aAC1D,OAAO,GAAGQ;;AACvB;AAEO,MAAMI,iBAAiBC,oBAAoB,oBAAoB,CAAC;IACnE,gBAAgBF;IAChB,cAAc,EAAE;AACpB"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { IdentityContext } from "@webiny/api-core/features/security/IdentityContext/abstractions.js";
|
|
2
|
-
import { WebsocketsSendToIdentityUseCase } from "@webiny/api-core/features/websockets/index.js";
|
|
3
|
-
import { NotifyFolderChangeUseCase as UseCaseAbstraction } from "./abstractions.js";
|
|
4
|
-
declare class NotifyFolderChangeUseCaseImpl implements UseCaseAbstraction.Interface {
|
|
5
|
-
private identityContext;
|
|
6
|
-
private sendToIdentity;
|
|
7
|
-
constructor(identityContext: IdentityContext.Interface, sendToIdentity: WebsocketsSendToIdentityUseCase.Interface);
|
|
8
|
-
execute({ id, change, identityId }: UseCaseAbstraction.Params): Promise<void>;
|
|
9
|
-
}
|
|
10
|
-
export declare const NotifyFolderChangeUseCase: import("@webiny/di").Implementation<typeof NotifyFolderChangeUseCaseImpl>;
|
|
11
|
-
export {};
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { createImplementation } from "@webiny/di";
|
|
2
|
-
import { IdentityContext } from "@webiny/api-core/features/security/IdentityContext/abstractions.js";
|
|
3
|
-
import { WebsocketsSendToIdentityUseCase } from "@webiny/api-core/features/websockets/index.js";
|
|
4
|
-
import { FOLDER_CREATED_WEBSOCKET_ACTION, FOLDER_DELETED_WEBSOCKET_ACTION, FOLDER_UPDATED_WEBSOCKET_ACTION, NotifyFolderChangeUseCase } from "./abstractions.js";
|
|
5
|
-
const ACTIONS = {
|
|
6
|
-
created: FOLDER_CREATED_WEBSOCKET_ACTION,
|
|
7
|
-
updated: FOLDER_UPDATED_WEBSOCKET_ACTION,
|
|
8
|
-
deleted: FOLDER_DELETED_WEBSOCKET_ACTION
|
|
9
|
-
};
|
|
10
|
-
class NotifyFolderChangeUseCaseImpl {
|
|
11
|
-
constructor(identityContext, sendToIdentity){
|
|
12
|
-
this.identityContext = identityContext;
|
|
13
|
-
this.sendToIdentity = sendToIdentity;
|
|
14
|
-
}
|
|
15
|
-
async execute({ id, change, identityId }) {
|
|
16
|
-
const recipient = identityId ?? this.identityContext.getIdentity()?.id;
|
|
17
|
-
if (!recipient) return;
|
|
18
|
-
await this.sendToIdentity.execute({
|
|
19
|
-
id: recipient
|
|
20
|
-
}, {
|
|
21
|
-
action: ACTIONS[change],
|
|
22
|
-
data: {
|
|
23
|
-
id
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
const NotifyFolderChangeUseCase_NotifyFolderChangeUseCase = createImplementation({
|
|
29
|
-
abstraction: NotifyFolderChangeUseCase,
|
|
30
|
-
implementation: NotifyFolderChangeUseCaseImpl,
|
|
31
|
-
dependencies: [
|
|
32
|
-
IdentityContext,
|
|
33
|
-
WebsocketsSendToIdentityUseCase
|
|
34
|
-
]
|
|
35
|
-
});
|
|
36
|
-
export { NotifyFolderChangeUseCase_NotifyFolderChangeUseCase as NotifyFolderChangeUseCase };
|
|
37
|
-
|
|
38
|
-
//# sourceMappingURL=NotifyFolderChangeUseCase.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"features/folder/NotifyFolderChange/NotifyFolderChangeUseCase.js","sources":["../../../../src/features/folder/NotifyFolderChange/NotifyFolderChangeUseCase.ts"],"sourcesContent":["import { createImplementation } from \"@webiny/di\";\nimport { IdentityContext } from \"@webiny/api-core/features/security/IdentityContext/abstractions.js\";\nimport { WebsocketsSendToIdentityUseCase } from \"@webiny/api-core/features/websockets/index.js\";\nimport {\n FOLDER_CREATED_WEBSOCKET_ACTION,\n FOLDER_DELETED_WEBSOCKET_ACTION,\n FOLDER_UPDATED_WEBSOCKET_ACTION,\n NotifyFolderChangeUseCase as UseCaseAbstraction\n} from \"./abstractions.js\";\n\nconst ACTIONS: Record<UseCaseAbstraction.Params[\"change\"], string> = {\n created: FOLDER_CREATED_WEBSOCKET_ACTION,\n updated: FOLDER_UPDATED_WEBSOCKET_ACTION,\n deleted: FOLDER_DELETED_WEBSOCKET_ACTION\n};\n\n/*\n * The change is already saved whether or not the message goes out, so the send's result is not the\n * caller's result. When it fails, the admin shows the change after its next reload, as it did before.\n */\nclass NotifyFolderChangeUseCaseImpl implements UseCaseAbstraction.Interface {\n constructor(\n private identityContext: IdentityContext.Interface,\n private sendToIdentity: WebsocketsSendToIdentityUseCase.Interface\n ) {}\n\n async execute({ id, change, identityId }: UseCaseAbstraction.Params): Promise<void> {\n const recipient = identityId ?? this.identityContext.getIdentity()?.id;\n if (!recipient) {\n return;\n }\n\n await this.sendToIdentity.execute(\n { id: recipient },\n { action: ACTIONS[change], data: { id } }\n );\n }\n}\n\nexport const NotifyFolderChangeUseCase = createImplementation({\n abstraction: UseCaseAbstraction,\n implementation: NotifyFolderChangeUseCaseImpl,\n dependencies: [IdentityContext, WebsocketsSendToIdentityUseCase]\n});\n"],"names":["ACTIONS","FOLDER_CREATED_WEBSOCKET_ACTION","FOLDER_UPDATED_WEBSOCKET_ACTION","FOLDER_DELETED_WEBSOCKET_ACTION","NotifyFolderChangeUseCaseImpl","identityContext","sendToIdentity","id","change","identityId","recipient","NotifyFolderChangeUseCase","createImplementation","UseCaseAbstraction","IdentityContext","WebsocketsSendToIdentityUseCase"],"mappings":";;;;AAUA,MAAMA,UAA+D;IACjE,SAASC;IACT,SAASC;IACT,SAASC;AACb;AAMA,MAAMC;IACF,YACYC,eAA0C,EAC1CC,cAAyD,CACnE;aAFUD,eAAe,GAAfA;aACAC,cAAc,GAAdA;IACT;IAEH,MAAM,QAAQ,EAAEC,EAAE,EAAEC,MAAM,EAAEC,UAAU,EAA6B,EAAiB;QAChF,MAAMC,YAAYD,cAAc,IAAI,CAAC,eAAe,CAAC,WAAW,IAAI;QACpE,IAAI,CAACC,WACD;QAGJ,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAC7B;YAAE,IAAIA;QAAU,GAChB;YAAE,QAAQV,OAAO,CAACQ,OAAO;YAAE,MAAM;gBAAED;YAAG;QAAE;IAEhD;AACJ;AAEO,MAAMI,sDAA4BC,qBAAqB;IAC1D,aAAaC;IACb,gBAAgBT;IAChB,cAAc;QAACU;QAAiBC;KAAgC;AACpE"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Sent to the user's open admin tabs when a folder changes. The admin keeps its own folder cache,
|
|
3
|
-
* and a change made on the server never passes through it, so without these the admin shows the old
|
|
4
|
-
* state until a reload. Each carries the folder id only; the admin reads the folder back.
|
|
5
|
-
*
|
|
6
|
-
* `created` and `updated` go out when the FLP tasks finish, since folder reads report permissions
|
|
7
|
-
* from the FLP records. `deleted` goes out right after the delete: nothing is read back.
|
|
8
|
-
*/
|
|
9
|
-
export declare const FOLDER_CREATED_WEBSOCKET_ACTION = "aco.folder.created";
|
|
10
|
-
export declare const FOLDER_UPDATED_WEBSOCKET_ACTION = "aco.folder.updated";
|
|
11
|
-
export declare const FOLDER_DELETED_WEBSOCKET_ACTION = "aco.folder.deleted";
|
|
12
|
-
export interface NotifyFolderChangeParams {
|
|
13
|
-
id: string;
|
|
14
|
-
/**
|
|
15
|
-
* Whose open tabs to tell. Defaults to the current identity. The FLP tasks pass the identity
|
|
16
|
-
* that made the change, because they run later, outside that request.
|
|
17
|
-
*/
|
|
18
|
-
identityId?: string;
|
|
19
|
-
change: "created" | "updated" | "deleted";
|
|
20
|
-
}
|
|
21
|
-
export interface INotifyFolderChangeUseCase {
|
|
22
|
-
execute(params: NotifyFolderChangeParams): Promise<void>;
|
|
23
|
-
}
|
|
24
|
-
export declare const NotifyFolderChangeUseCase: import("@webiny/di").Abstraction<INotifyFolderChangeUseCase>;
|
|
25
|
-
export declare namespace NotifyFolderChangeUseCase {
|
|
26
|
-
type Interface = INotifyFolderChangeUseCase;
|
|
27
|
-
type Params = NotifyFolderChangeParams;
|
|
28
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { createAbstraction } from "@webiny/feature/api";
|
|
2
|
-
const FOLDER_CREATED_WEBSOCKET_ACTION = "aco.folder.created";
|
|
3
|
-
const FOLDER_UPDATED_WEBSOCKET_ACTION = "aco.folder.updated";
|
|
4
|
-
const FOLDER_DELETED_WEBSOCKET_ACTION = "aco.folder.deleted";
|
|
5
|
-
const NotifyFolderChangeUseCase = createAbstraction("Aco/NotifyFolderChangeUseCase");
|
|
6
|
-
export { FOLDER_CREATED_WEBSOCKET_ACTION, FOLDER_DELETED_WEBSOCKET_ACTION, FOLDER_UPDATED_WEBSOCKET_ACTION, NotifyFolderChangeUseCase };
|
|
7
|
-
|
|
8
|
-
//# sourceMappingURL=abstractions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"features/folder/NotifyFolderChange/abstractions.js","sources":["../../../../src/features/folder/NotifyFolderChange/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\n\n/**\n * Sent to the user's open admin tabs when a folder changes. The admin keeps its own folder cache,\n * and a change made on the server never passes through it, so without these the admin shows the old\n * state until a reload. Each carries the folder id only; the admin reads the folder back.\n *\n * `created` and `updated` go out when the FLP tasks finish, since folder reads report permissions\n * from the FLP records. `deleted` goes out right after the delete: nothing is read back.\n */\nexport const FOLDER_CREATED_WEBSOCKET_ACTION = \"aco.folder.created\";\nexport const FOLDER_UPDATED_WEBSOCKET_ACTION = \"aco.folder.updated\";\nexport const FOLDER_DELETED_WEBSOCKET_ACTION = \"aco.folder.deleted\";\n\nexport interface NotifyFolderChangeParams {\n id: string;\n /**\n * Whose open tabs to tell. Defaults to the current identity. The FLP tasks pass the identity\n * that made the change, because they run later, outside that request.\n */\n identityId?: string;\n change: \"created\" | \"updated\" | \"deleted\";\n}\n\nexport interface INotifyFolderChangeUseCase {\n execute(params: NotifyFolderChangeParams): Promise<void>;\n}\n\nexport const NotifyFolderChangeUseCase = createAbstraction<INotifyFolderChangeUseCase>(\n \"Aco/NotifyFolderChangeUseCase\"\n);\n\nexport namespace NotifyFolderChangeUseCase {\n export type Interface = INotifyFolderChangeUseCase;\n export type Params = NotifyFolderChangeParams;\n}\n"],"names":["FOLDER_CREATED_WEBSOCKET_ACTION","FOLDER_UPDATED_WEBSOCKET_ACTION","FOLDER_DELETED_WEBSOCKET_ACTION","NotifyFolderChangeUseCase","createAbstraction"],"mappings":";AAUO,MAAMA,kCAAkC;AACxC,MAAMC,kCAAkC;AACxC,MAAMC,kCAAkC;AAgBxC,MAAMC,4BAA4BC,kBACrC"}
|