@webiny/api-file-manager 6.6.0-alpha.1 → 6.6.0-alpha.3
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import {
|
|
2
|
+
import { AiSdkToolDefinition, AiSdkToolHandler } from "@webiny/api-core/features/ai/index.js";
|
|
3
3
|
import { ListFilesUseCase } from "../../../features/file/ListFiles/index.js";
|
|
4
4
|
declare const inputSchema: z.ZodObject<{
|
|
5
5
|
tag: z.ZodString;
|
|
@@ -11,8 +11,12 @@ interface ImageItem {
|
|
|
11
11
|
type: string;
|
|
12
12
|
tags: string[];
|
|
13
13
|
}
|
|
14
|
-
declare class
|
|
14
|
+
declare class ListImagesByTagToolHandlerImpl implements AiSdkToolHandler.Interface<Input> {
|
|
15
15
|
private listFiles;
|
|
16
|
+
constructor(listFiles: ListFilesUseCase.Interface);
|
|
17
|
+
execute(input: Input): Promise<ImageItem[]>;
|
|
18
|
+
}
|
|
19
|
+
declare class ListImagesByTagToolImpl implements AiSdkToolDefinition.Interface<Input> {
|
|
16
20
|
readonly name = "listImagesByTag";
|
|
17
21
|
readonly title = "List images by tag";
|
|
18
22
|
readonly description = "Lists images from the file manager filtered by a given tag. Returns name, type, and tags for each image.";
|
|
@@ -23,10 +27,11 @@ declare class ListImagesByTagToolImpl implements IAiSdkTool<Input> {
|
|
|
23
27
|
readOnlyHint: boolean;
|
|
24
28
|
idempotentHint: boolean;
|
|
25
29
|
};
|
|
26
|
-
|
|
27
|
-
|
|
30
|
+
readonly handler: typeof ListImagesByTagToolHandlerImpl & {
|
|
31
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/ai/abstractions").IAiSdkToolHandler<any>>;
|
|
32
|
+
};
|
|
28
33
|
}
|
|
29
34
|
export declare const ListImagesByTagTool: typeof ListImagesByTagToolImpl & {
|
|
30
|
-
__abstraction: import("@webiny/di").Abstraction<
|
|
35
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/ai/abstractions").IAiSdkToolDefinition<any>>;
|
|
31
36
|
};
|
|
32
37
|
export {};
|
|
@@ -1,20 +1,12 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import {
|
|
2
|
+
import { AiSdkToolDefinition, AiSdkToolHandler } from "@webiny/api-core/features/ai/index.js";
|
|
3
3
|
import { ListFilesUseCase } from "../ListFiles/index.js";
|
|
4
4
|
const inputSchema = z.object({
|
|
5
5
|
tag: z.string().describe("Tag to filter images by")
|
|
6
6
|
});
|
|
7
|
-
class
|
|
7
|
+
class ListImagesByTagToolHandlerImpl {
|
|
8
8
|
constructor(listFiles){
|
|
9
9
|
this.listFiles = listFiles;
|
|
10
|
-
this.name = "listImagesByTag";
|
|
11
|
-
this.title = "List images by tag";
|
|
12
|
-
this.description = "Lists images from the file manager filtered by a given tag. Returns name, type, and tags for each image.";
|
|
13
|
-
this.inputSchema = inputSchema;
|
|
14
|
-
this.annotations = {
|
|
15
|
-
readOnlyHint: true,
|
|
16
|
-
idempotentHint: true
|
|
17
|
-
};
|
|
18
10
|
}
|
|
19
11
|
async execute(input) {
|
|
20
12
|
console.log("Call images tool", input);
|
|
@@ -36,12 +28,29 @@ class ListImagesByTagToolImpl {
|
|
|
36
28
|
}));
|
|
37
29
|
}
|
|
38
30
|
}
|
|
39
|
-
const
|
|
40
|
-
implementation:
|
|
31
|
+
const ListImagesByTagToolHandler = AiSdkToolHandler.createImplementation({
|
|
32
|
+
implementation: ListImagesByTagToolHandlerImpl,
|
|
41
33
|
dependencies: [
|
|
42
34
|
ListFilesUseCase
|
|
43
35
|
]
|
|
44
36
|
});
|
|
37
|
+
class ListImagesByTagToolImpl {
|
|
38
|
+
constructor(){
|
|
39
|
+
this.name = "listImagesByTag";
|
|
40
|
+
this.title = "List images by tag";
|
|
41
|
+
this.description = "Lists images from the file manager filtered by a given tag. Returns name, type, and tags for each image.";
|
|
42
|
+
this.inputSchema = inputSchema;
|
|
43
|
+
this.annotations = {
|
|
44
|
+
readOnlyHint: true,
|
|
45
|
+
idempotentHint: true
|
|
46
|
+
};
|
|
47
|
+
this.handler = ListImagesByTagToolHandler;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
const ListImagesByTagTool = AiSdkToolDefinition.createImplementation({
|
|
51
|
+
implementation: ListImagesByTagToolImpl,
|
|
52
|
+
dependencies: []
|
|
53
|
+
});
|
|
45
54
|
export { ListImagesByTagTool };
|
|
46
55
|
|
|
47
56
|
//# sourceMappingURL=ListImagesByTagTool.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features/file/ListImagesByTagTool/ListImagesByTagTool.js","sources":["../../../../src/features/file/ListImagesByTagTool/ListImagesByTagTool.ts"],"sourcesContent":["import { z } from \"zod\";\nimport {
|
|
1
|
+
{"version":3,"file":"features/file/ListImagesByTagTool/ListImagesByTagTool.js","sources":["../../../../src/features/file/ListImagesByTagTool/ListImagesByTagTool.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { AiSdkToolDefinition, AiSdkToolHandler } from \"@webiny/api-core/features/ai/index.js\";\nimport { ListFilesUseCase } from \"~/features/file/ListFiles/index.js\";\n\nconst inputSchema = z.object({\n tag: z.string().describe(\"Tag to filter images by\")\n});\n\ntype Input = z.infer<typeof inputSchema>;\n\ninterface ImageItem {\n id: string;\n name: string;\n type: string;\n tags: string[];\n}\n\nclass ListImagesByTagToolHandlerImpl implements AiSdkToolHandler.Interface<Input> {\n constructor(private listFiles: ListFilesUseCase.Interface) {}\n\n async execute(input: Input): Promise<ImageItem[]> {\n console.log(\"Call images tool\", input);\n const result = await this.listFiles.execute({\n where: {\n type_startsWith: \"image/\",\n tags_in: [input.tag]\n },\n limit: 50\n });\n\n if (result.isFail()) {\n return [];\n }\n\n return result.value.items.map(file => ({\n id: file.id,\n name: file.name,\n type: file.type,\n tags: file.tags\n }));\n }\n}\n\nconst ListImagesByTagToolHandler = AiSdkToolHandler.createImplementation({\n implementation: ListImagesByTagToolHandlerImpl,\n dependencies: [ListFilesUseCase]\n});\n\nclass ListImagesByTagToolImpl implements AiSdkToolDefinition.Interface<Input> {\n readonly name = \"listImagesByTag\";\n readonly title = \"List images by tag\";\n readonly description =\n \"Lists images from the file manager filtered by a given tag. Returns name, type, and tags for each image.\";\n readonly inputSchema = inputSchema;\n readonly annotations = { readOnlyHint: true, idempotentHint: true };\n readonly handler = ListImagesByTagToolHandler;\n}\n\nexport const ListImagesByTagTool = AiSdkToolDefinition.createImplementation({\n implementation: ListImagesByTagToolImpl,\n dependencies: []\n});\n"],"names":["inputSchema","z","ListImagesByTagToolHandlerImpl","listFiles","input","console","result","file","ListImagesByTagToolHandler","AiSdkToolHandler","ListFilesUseCase","ListImagesByTagToolImpl","ListImagesByTagTool","AiSdkToolDefinition"],"mappings":";;;AAIA,MAAMA,cAAcC,EAAE,MAAM,CAAC;IACzB,KAAKA,EAAE,MAAM,GAAG,QAAQ,CAAC;AAC7B;AAWA,MAAMC;IACF,YAAoBC,SAAqC,CAAE;aAAvCA,SAAS,GAATA;IAAwC;IAE5D,MAAM,QAAQC,KAAY,EAAwB;QAC9CC,QAAQ,GAAG,CAAC,oBAAoBD;QAChC,MAAME,SAAS,MAAM,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;YACxC,OAAO;gBACH,iBAAiB;gBACjB,SAAS;oBAACF,MAAM,GAAG;iBAAC;YACxB;YACA,OAAO;QACX;QAEA,IAAIE,OAAO,MAAM,IACb,OAAO,EAAE;QAGb,OAAOA,OAAO,KAAK,CAAC,KAAK,CAAC,GAAG,CAACC,CAAAA,OAAS;gBACnC,IAAIA,KAAK,EAAE;gBACX,MAAMA,KAAK,IAAI;gBACf,MAAMA,KAAK,IAAI;gBACf,MAAMA,KAAK,IAAI;YACnB;IACJ;AACJ;AAEA,MAAMC,6BAA6BC,iBAAiB,oBAAoB,CAAC;IACrE,gBAAgBP;IAChB,cAAc;QAACQ;KAAiB;AACpC;AAEA,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,sBAAsBC,oBAAoB,oBAAoB,CAAC;IACxE,gBAAgBF;IAChB,cAAc,EAAE;AACpB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/api-file-manager",
|
|
3
|
-
"version": "6.6.0-alpha.
|
|
3
|
+
"version": "6.6.0-alpha.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./index.js",
|
|
@@ -22,19 +22,19 @@
|
|
|
22
22
|
],
|
|
23
23
|
"license": "MIT",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@webiny/api": "6.6.0-alpha.
|
|
26
|
-
"@webiny/api-core": "6.6.0-alpha.
|
|
27
|
-
"@webiny/api-graphql": "6.6.0-alpha.
|
|
28
|
-
"@webiny/api-headless-cms": "6.6.0-alpha.
|
|
29
|
-
"@webiny/background-tasks": "6.6.0-alpha.
|
|
30
|
-
"@webiny/build-tools": "6.6.0-alpha.
|
|
25
|
+
"@webiny/api": "6.6.0-alpha.3",
|
|
26
|
+
"@webiny/api-core": "6.6.0-alpha.3",
|
|
27
|
+
"@webiny/api-graphql": "6.6.0-alpha.3",
|
|
28
|
+
"@webiny/api-headless-cms": "6.6.0-alpha.3",
|
|
29
|
+
"@webiny/background-tasks": "6.6.0-alpha.3",
|
|
30
|
+
"@webiny/build-tools": "6.6.0-alpha.3",
|
|
31
31
|
"@webiny/di": "1.1.0",
|
|
32
|
-
"@webiny/error": "6.6.0-alpha.
|
|
33
|
-
"@webiny/event-handler-core": "6.6.0-alpha.
|
|
34
|
-
"@webiny/feature": "6.6.0-alpha.
|
|
35
|
-
"@webiny/handler": "6.6.0-alpha.
|
|
36
|
-
"@webiny/plugins": "6.6.0-alpha.
|
|
37
|
-
"@webiny/wcp": "6.6.0-alpha.
|
|
32
|
+
"@webiny/error": "6.6.0-alpha.3",
|
|
33
|
+
"@webiny/event-handler-core": "6.6.0-alpha.3",
|
|
34
|
+
"@webiny/feature": "6.6.0-alpha.3",
|
|
35
|
+
"@webiny/handler": "6.6.0-alpha.3",
|
|
36
|
+
"@webiny/plugins": "6.6.0-alpha.3",
|
|
37
|
+
"@webiny/wcp": "6.6.0-alpha.3",
|
|
38
38
|
"cache-control-parser": "2.2.0",
|
|
39
39
|
"graphql": "16.14.2",
|
|
40
40
|
"mime": "4.1.0",
|
|
@@ -45,9 +45,9 @@
|
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@types/object-hash": "3.0.6",
|
|
48
|
-
"@webiny/api-core-testing": "6.6.0-alpha.
|
|
49
|
-
"@webiny/utils": "6.6.0-alpha.
|
|
50
|
-
"@webiny/wcp": "6.6.0-alpha.
|
|
48
|
+
"@webiny/api-core-testing": "6.6.0-alpha.3",
|
|
49
|
+
"@webiny/utils": "6.6.0-alpha.3",
|
|
50
|
+
"@webiny/wcp": "6.6.0-alpha.3",
|
|
51
51
|
"rimraf": "6.1.3",
|
|
52
52
|
"typescript": "7.0.2"
|
|
53
53
|
},
|