@activepieces/piece-alttextify 0.0.1

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/README.md ADDED
@@ -0,0 +1,7 @@
1
+ # pieces-alttextify
2
+
3
+ This library was generated with [Nx](https://nx.dev).
4
+
5
+ ## Building
6
+
7
+ Run `nx build pieces-alttextify` to build the library.
package/package.json ADDED
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "@activepieces/piece-alttextify",
3
+ "version": "0.0.1",
4
+ "type": "commonjs",
5
+ "main": "./src/index.js",
6
+ "types": "./src/index.d.ts",
7
+ "dependencies": {
8
+ "@sinclair/typebox": "0.34.11",
9
+ "axios": "1.13.1",
10
+ "axios-retry": "4.4.1",
11
+ "deepmerge-ts": "7.1.0",
12
+ "mime-types": "2.1.35",
13
+ "nanoid": "3.3.8",
14
+ "semver": "7.6.0",
15
+ "socket.io-client": "4.8.1",
16
+ "tslib": "^2.3.0",
17
+ "zod": "4.1.13",
18
+ "@activepieces/pieces-common": "0.10.1",
19
+ "@activepieces/pieces-framework": "0.22.2",
20
+ "@activepieces/shared": "0.30.1"
21
+ },
22
+ "resolutions": {
23
+ "rollup": "npm:@rollup/wasm-node"
24
+ }
25
+ }
package/src/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ export declare const alttextify: import("@activepieces/pieces-framework").Piece<import("@activepieces/pieces-framework").SecretTextProperty<true>>;
package/src/index.js ADDED
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.alttextify = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
6
+ const shared_1 = require("@activepieces/shared");
7
+ const auth_1 = require("./lib/common/auth");
8
+ const generate_alt_text_1 = require("./lib/actions/generate-alt-text");
9
+ const pieces_common_1 = require("@activepieces/pieces-common");
10
+ exports.alttextify = (0, pieces_framework_1.createPiece)({
11
+ displayName: "AltTextify",
12
+ categories: [shared_1.PieceCategory.PRODUCTIVITY],
13
+ auth: auth_1.alttextifyAuth,
14
+ minimumSupportedRelease: '0.36.1',
15
+ logoUrl: "https://cdn.activepieces.com/pieces/alttextify.png",
16
+ authors: ['kishanprmr'],
17
+ actions: [generate_alt_text_1.generateAltTextAction,
18
+ (0, pieces_common_1.createCustomApiCallAction)({
19
+ auth: auth_1.alttextifyAuth,
20
+ baseUrl: () => 'https://api.alttextify.net/api/v1',
21
+ authMapping: (auth) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
22
+ return {
23
+ 'X-API-Key': auth.secret_text
24
+ };
25
+ })
26
+ })
27
+ ],
28
+ triggers: [],
29
+ });
30
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/pieces/community/alttextify/src/index.ts"],"names":[],"mappings":";;;;AACA,qEAA6D;AAC7D,iDAAqD;AACrD,4CAAmD;AACnD,uEAAwE;AACxE,+DAAwE;AAE3D,QAAA,UAAU,GAAG,IAAA,8BAAW,EAAC;IACpC,WAAW,EAAE,YAAY;IACzB,UAAU,EAAE,CAAC,sBAAa,CAAC,YAAY,CAAC;IACxC,IAAI,EAAE,qBAAc;IACpB,uBAAuB,EAAE,QAAQ;IACjC,OAAO,EAAE,oDAAoD;IAC7D,OAAO,EAAE,CAAC,YAAY,CAAC;IACvB,OAAO,EAAE,CAAC,yCAAqB;QAC7B,IAAA,yCAAyB,EAAC;YACxB,IAAI,EAAE,qBAAc;YACpB,OAAO,EAAE,GAAG,EAAE,CAAC,mCAAmC;YAClD,WAAW,EAAE,CAAO,IAAI,EAAE,EAAE;gBAC1B,OAAO;oBACL,WAAW,EAAE,IAAI,CAAC,WAAW;iBAC9B,CAAA;YACH,CAAC,CAAA;SACF,CAAC;KACH;IACD,QAAQ,EAAE,EAAE;CACb,CAAC,CAAC"}
@@ -0,0 +1,6 @@
1
+ export declare const generateAltTextAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
2
+ image: import("@activepieces/pieces-framework").FileProperty<true>;
3
+ lang: import("@activepieces/pieces-framework").ShortTextProperty<false>;
4
+ keywords: import("@activepieces/pieces-framework").ArrayProperty<false>;
5
+ negative_keywords: import("@activepieces/pieces-framework").ArrayProperty<false>;
6
+ }>;
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.generateAltTextAction = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
6
+ const auth_1 = require("../common/auth");
7
+ const pieces_common_1 = require("@activepieces/pieces-common");
8
+ const mime_types_1 = tslib_1.__importDefault(require("mime-types"));
9
+ exports.generateAltTextAction = (0, pieces_framework_1.createAction)({
10
+ name: 'generate-alt-text',
11
+ auth: auth_1.alttextifyAuth,
12
+ displayName: 'Generate Image Alt Text',
13
+ description: 'Generates alt text for specified image.',
14
+ props: {
15
+ image: pieces_framework_1.Property.File({
16
+ displayName: 'Image File',
17
+ required: true
18
+ }),
19
+ lang: pieces_framework_1.Property.ShortText({
20
+ displayName: 'Language',
21
+ required: false,
22
+ defaultValue: 'en',
23
+ description: 'Specifies the language for the alt text. Supported language codes are accepted.'
24
+ }),
25
+ keywords: pieces_framework_1.Property.Array({
26
+ displayName: 'Keywords',
27
+ required: false,
28
+ description: 'List of keywords/phrases for SEO-optimized alt text.'
29
+ }),
30
+ negative_keywords: pieces_framework_1.Property.Array({
31
+ displayName: 'Negative Keywords',
32
+ required: false,
33
+ description: 'List of negative keywords/phrases for SEO-optimized alt text.'
34
+ })
35
+ },
36
+ run(context) {
37
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
38
+ const { image, keywords, negative_keywords, lang } = context.propsValue;
39
+ const fileType = image.extension
40
+ ? mime_types_1.default.lookup(image.extension)
41
+ : 'image/jpeg';
42
+ const response = yield pieces_common_1.httpClient.sendRequest({
43
+ method: pieces_common_1.HttpMethod.POST,
44
+ url: 'https://api.alttextify.net/api/v1/image/raw',
45
+ headers: {
46
+ 'X-API-Key': context.auth.secret_text
47
+ },
48
+ body: {
49
+ async: false,
50
+ image: `data:${fileType};base64,${image.base64}`,
51
+ lang,
52
+ keywords,
53
+ negative_keywords
54
+ }
55
+ });
56
+ return response.body;
57
+ });
58
+ }
59
+ });
60
+ //# sourceMappingURL=generate-alt-text.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate-alt-text.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/alttextify/src/lib/actions/generate-alt-text.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,yCAAgD;AAChD,+DAAqE;AACrE,oEAA8B;AAEjB,QAAA,qBAAqB,GAAG,IAAA,+BAAY,EAAC;IAC9C,IAAI,EAAE,mBAAmB;IACzB,IAAI,EAAE,qBAAc;IACpB,WAAW,EAAE,yBAAyB;IACtC,WAAW,EAAE,yCAAyC;IACtD,KAAK,EAAE;QACH,KAAK,EAAE,2BAAQ,CAAC,IAAI,CAAC;YACjB,WAAW,EAAE,YAAY;YACzB,QAAQ,EAAE,IAAI;SACjB,CAAC;QACF,IAAI,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACrB,WAAW,EAAE,UAAU;YACvB,QAAQ,EAAE,KAAK;YACf,YAAY,EAAE,IAAI;YAClB,WAAW,EAAE,iFAAiF;SACjG,CAAC;QACF,QAAQ,EAAE,2BAAQ,CAAC,KAAK,CAAC;YACrB,WAAW,EAAE,UAAU;YACvB,QAAQ,EAAE,KAAK;YACf,WAAW,EAAE,sDAAsD;SACtE,CAAC;QACF,iBAAiB,EAAE,2BAAQ,CAAC,KAAK,CAAC;YAC9B,WAAW,EAAE,mBAAmB;YAChC,QAAQ,EAAE,KAAK;YACf,WAAW,EAAE,+DAA+D;SAC/E,CAAC;KACL;IACK,GAAG,CAAC,OAAO;;YAEb,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,iBAAiB,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAExE,MAAM,QAAQ,GAAG,KAAK,CAAC,SAAS;gBAClC,CAAC,CAAC,oBAAI,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC;gBAC9B,CAAC,CAAC,YAAY,CAAC;YAEb,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAC;gBAC1C,MAAM,EAAE,0BAAU,CAAC,IAAI;gBACvB,GAAG,EAAE,6CAA6C;gBAClD,OAAO,EAAE;oBACL,WAAW,EAAE,OAAO,CAAC,IAAI,CAAC,WAAW;iBACxC;gBACD,IAAI,EAAE;oBACF,KAAK,EAAE,KAAK;oBACZ,KAAK,EAAE,QAAQ,QAAQ,WAAW,KAAK,CAAC,MAAM,EAAE;oBAChD,IAAI;oBACJ,QAAQ;oBACR,iBAAiB;iBACpB;aACJ,CAAC,CAAA;YAEF,OAAO,QAAQ,CAAC,IAAI,CAAC;QAEzB,CAAC;KAAA;CACJ,CAAC,CAAA"}
@@ -0,0 +1 @@
1
+ export declare const alttextifyAuth: import("@activepieces/pieces-framework").SecretTextProperty<true>;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.alttextifyAuth = void 0;
4
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
5
+ exports.alttextifyAuth = pieces_framework_1.PieceAuth.SecretText({
6
+ displayName: 'API Key',
7
+ required: true,
8
+ description: 'To obtain an API key, navigate to the [API keys](https://alttextify.net/settings/apikeys) section within your account settings.'
9
+ });
10
+ //# sourceMappingURL=auth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/alttextify/src/lib/common/auth.ts"],"names":[],"mappings":";;;AAAA,qEAA2D;AAE9C,QAAA,cAAc,GAAG,4BAAS,CAAC,UAAU,CAAC;IAC/C,WAAW,EAAC,SAAS;IACrB,QAAQ,EAAC,IAAI;IACb,WAAW,EAAC,iIAAiI;CAChJ,CAAC,CAAA"}