@skillful-ai/piece-skai-watermark 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/package.json ADDED
@@ -0,0 +1,29 @@
1
+ {
2
+ "name": "@skillful-ai/piece-skai-watermark",
3
+ "version": "0.0.1",
4
+ "type": "commonjs",
5
+ "main": "./src/index.js",
6
+ "types": "./src/index.d.ts",
7
+ "dependencies": {
8
+ "@activepieces/pieces-framework": "^0.20.1",
9
+ "@sinclair/typebox": "0.34.11",
10
+ "deepmerge-ts": "7.1.0",
11
+ "nanoid": "3.3.8",
12
+ "semver": "7.6.0",
13
+ "tslib": "^2.3.0",
14
+ "@activepieces/shared": "0.22.0"
15
+ },
16
+ "overrides": {
17
+ "@tryfabric/martian": {
18
+ "@notionhq/client": "$@notionhq/client"
19
+ },
20
+ "vite": {
21
+ "rollup": "npm:@rollup/wasm-node"
22
+ },
23
+ "undici": "6.19.8"
24
+ },
25
+ "resolutions": {
26
+ "rollup": "npm:@rollup/wasm-node",
27
+ "undici": "6.19.8"
28
+ }
29
+ }
package/src/index.d.ts ADDED
@@ -0,0 +1,9 @@
1
+ export declare const skaiWatermarkAuth: import("@activepieces/pieces-framework").CustomAuthProperty<{
2
+ cloudinaryCloudName: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
+ }>;
4
+ export type SkaiWatermarkAuthValue = {
5
+ cloudinaryCloudName: string;
6
+ };
7
+ export declare const skaiWatermark: import("@activepieces/pieces-framework").Piece<import("@activepieces/pieces-framework").CustomAuthProperty<{
8
+ cloudinaryCloudName: import("@activepieces/pieces-framework").ShortTextProperty<true>;
9
+ }>>;
package/src/index.js ADDED
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.skaiWatermark = exports.skaiWatermarkAuth = void 0;
4
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
5
+ const shared_1 = require("@activepieces/shared");
6
+ // Actions
7
+ const add_watermark_1 = require("./lib/actions/add-watermark");
8
+ const markdownDescription = `
9
+ ## SKAI Watermark
10
+
11
+ Add text watermarks or logo overlays to images using Cloudinary's free tier.
12
+
13
+ ### Setup
14
+
15
+ 1. Create a free account at https://cloudinary.com
16
+ 2. Go to Dashboard and copy your **Cloud Name**
17
+ 3. In Settings > Security, enable **"Allow fetch"** for remote image transformations
18
+
19
+ ### Features
20
+
21
+ - Add text watermarks with customizable font, color, and position
22
+ - Add logo/image overlays
23
+ - Multiple position options (corners, center)
24
+ - Adjustable opacity
25
+ - No API key required - uses Cloudinary's fetch transformation
26
+ `;
27
+ exports.skaiWatermarkAuth = pieces_framework_1.PieceAuth.CustomAuth({
28
+ description: markdownDescription,
29
+ required: true,
30
+ props: {
31
+ cloudinaryCloudName: pieces_framework_1.Property.ShortText({
32
+ displayName: 'Cloudinary Cloud Name',
33
+ description: 'Your Cloudinary cloud name. Find it in your Cloudinary Dashboard.',
34
+ required: true,
35
+ }),
36
+ },
37
+ });
38
+ exports.skaiWatermark = (0, pieces_framework_1.createPiece)({
39
+ displayName: 'SKAI Watermark',
40
+ description: 'Add watermarks and logo overlays to images',
41
+ auth: exports.skaiWatermarkAuth,
42
+ minimumSupportedRelease: '0.36.1',
43
+ logoUrl: 'https://res.cloudinary.com/cloudinary-marketing/image/upload/v1599098500/creative_source/Logo/Cloud%20Glyph/cloudinary_cloud_glyph_blue_png.png',
44
+ authors: ['Skillful AI'],
45
+ categories: [shared_1.PieceCategory.CONTENT_AND_FILES],
46
+ actions: [
47
+ add_watermark_1.addWatermark,
48
+ ],
49
+ triggers: [],
50
+ });
51
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/pieces/custom/skai-watermark/src/index.ts"],"names":[],"mappings":";;;AAAA,qEAAkF;AAClF,iDAAqD;AAErD,UAAU;AACV,+DAA2D;AAE3D,MAAM,mBAAmB,GAAG;;;;;;;;;;;;;;;;;;CAkB3B,CAAC;AAEW,QAAA,iBAAiB,GAAG,4BAAS,CAAC,UAAU,CAAC;IAClD,WAAW,EAAE,mBAAmB;IAChC,QAAQ,EAAE,IAAI;IACd,KAAK,EAAE;QACH,mBAAmB,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACpC,WAAW,EAAE,uBAAuB;YACpC,WAAW,EAAE,mEAAmE;YAChF,QAAQ,EAAE,IAAI;SACjB,CAAC;KACL;CACJ,CAAC,CAAC;AAMU,QAAA,aAAa,GAAG,IAAA,8BAAW,EAAC;IACrC,WAAW,EAAE,gBAAgB;IAC7B,WAAW,EAAE,4CAA4C;IACzD,IAAI,EAAE,yBAAiB;IACvB,uBAAuB,EAAE,QAAQ;IACjC,OAAO,EAAE,iJAAiJ;IAC1J,OAAO,EAAE,CAAC,aAAa,CAAC;IACxB,UAAU,EAAE,CAAC,sBAAa,CAAC,iBAAiB,CAAC;IAC7C,OAAO,EAAE;QACL,4BAAY;KACf;IACD,QAAQ,EAAE,EAAE;CACf,CAAC,CAAC"}
@@ -0,0 +1,13 @@
1
+ export declare const addWatermark: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
2
+ cloudinaryCloudName: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
+ }>, {
4
+ imageUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
5
+ watermarkType: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
6
+ watermarkText: import("@activepieces/pieces-framework").ShortTextProperty<false>;
7
+ logoUrl: import("@activepieces/pieces-framework").ShortTextProperty<false>;
8
+ position: import("@activepieces/pieces-framework").StaticDropdownProperty<string, false>;
9
+ opacity: import("@activepieces/pieces-framework").NumberProperty<false>;
10
+ fontSize: import("@activepieces/pieces-framework").NumberProperty<false>;
11
+ textColor: import("@activepieces/pieces-framework").StaticDropdownProperty<string, false>;
12
+ logoSize: import("@activepieces/pieces-framework").NumberProperty<false>;
13
+ }>;
@@ -0,0 +1,133 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.addWatermark = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
6
+ const index_1 = require("../../index");
7
+ exports.addWatermark = (0, pieces_framework_1.createAction)({
8
+ auth: index_1.skaiWatermarkAuth,
9
+ name: 'add_watermark',
10
+ displayName: 'Add Watermark/Logo',
11
+ description: 'Add a text watermark or logo overlay to an image',
12
+ props: {
13
+ imageUrl: pieces_framework_1.Property.ShortText({
14
+ displayName: 'Image URL',
15
+ description: 'URL of the image to watermark',
16
+ required: true,
17
+ }),
18
+ watermarkType: pieces_framework_1.Property.StaticDropdown({
19
+ displayName: 'Watermark Type',
20
+ description: 'Choose between text watermark or image logo overlay',
21
+ required: true,
22
+ defaultValue: 'text',
23
+ options: {
24
+ options: [
25
+ { label: 'Text Watermark', value: 'text' },
26
+ { label: 'Image Logo', value: 'image' },
27
+ ],
28
+ },
29
+ }),
30
+ watermarkText: pieces_framework_1.Property.ShortText({
31
+ displayName: 'Watermark Text',
32
+ description: 'Text to display as watermark (for text watermark type)',
33
+ required: false,
34
+ }),
35
+ logoUrl: pieces_framework_1.Property.ShortText({
36
+ displayName: 'Logo URL',
37
+ description: 'URL of logo image to overlay (for image logo type)',
38
+ required: false,
39
+ }),
40
+ position: pieces_framework_1.Property.StaticDropdown({
41
+ displayName: 'Position',
42
+ description: 'Where to place the watermark',
43
+ required: false,
44
+ defaultValue: 'south_east',
45
+ options: {
46
+ options: [
47
+ { label: 'Bottom Right', value: 'south_east' },
48
+ { label: 'Bottom Left', value: 'south_west' },
49
+ { label: 'Top Right', value: 'north_east' },
50
+ { label: 'Top Left', value: 'north_west' },
51
+ { label: 'Center', value: 'center' },
52
+ { label: 'Bottom Center', value: 'south' },
53
+ { label: 'Top Center', value: 'north' },
54
+ ],
55
+ },
56
+ }),
57
+ opacity: pieces_framework_1.Property.Number({
58
+ displayName: 'Opacity',
59
+ description: 'Watermark opacity (0-100, default: 70)',
60
+ required: false,
61
+ defaultValue: 70,
62
+ }),
63
+ fontSize: pieces_framework_1.Property.Number({
64
+ displayName: 'Font Size',
65
+ description: 'Text size for text watermark (default: 24)',
66
+ required: false,
67
+ defaultValue: 24,
68
+ }),
69
+ textColor: pieces_framework_1.Property.StaticDropdown({
70
+ displayName: 'Text Color',
71
+ description: 'Color for text watermark',
72
+ required: false,
73
+ defaultValue: 'white',
74
+ options: {
75
+ options: [
76
+ { label: 'White', value: 'white' },
77
+ { label: 'Black', value: 'black' },
78
+ { label: 'Gray', value: 'gray' },
79
+ { label: 'Red', value: 'red' },
80
+ { label: 'Blue', value: 'blue' },
81
+ ],
82
+ },
83
+ }),
84
+ logoSize: pieces_framework_1.Property.Number({
85
+ displayName: 'Logo Size',
86
+ description: 'Logo width in pixels (default: 100)',
87
+ required: false,
88
+ defaultValue: 100,
89
+ }),
90
+ },
91
+ run(context) {
92
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
93
+ const { imageUrl, watermarkType, watermarkText, logoUrl, position, opacity, fontSize, textColor, logoSize, } = context.propsValue;
94
+ const auth = context.auth;
95
+ // Validate inputs
96
+ if (watermarkType === 'text' && !watermarkText) {
97
+ throw new Error('Watermark text is required when using text watermark type');
98
+ }
99
+ if (watermarkType === 'image' && !logoUrl) {
100
+ throw new Error('Logo URL is required when using image logo type');
101
+ }
102
+ // Build Cloudinary fetch base URL with user's cloud name
103
+ const cloudinaryFetchBase = `https://res.cloudinary.com/${auth.cloudinaryCloudName}/image/fetch`;
104
+ const opacityValue = Math.min(100, Math.max(0, opacity || 70));
105
+ const gravityPosition = position || 'south_east';
106
+ let transformation;
107
+ if (watermarkType === 'text') {
108
+ // Text watermark transformation
109
+ const fontSizeValue = fontSize || 24;
110
+ const colorValue = textColor || 'white';
111
+ // Encode text for URL (replace spaces with %20)
112
+ const encodedText = encodeURIComponent(watermarkText || '');
113
+ transformation = `l_text:Arial_${fontSizeValue}_bold:${encodedText},co_${colorValue},o_${opacityValue},g_${gravityPosition},x_10,y_10`;
114
+ }
115
+ else {
116
+ // Image logo overlay transformation
117
+ const logoSizeValue = logoSize || 100;
118
+ transformation = `l_fetch:${Buffer.from(logoUrl || '').toString('base64')},w_${logoSizeValue},o_${opacityValue},g_${gravityPosition},x_10,y_10`;
119
+ }
120
+ // Build the final URL - source URL should NOT be encoded for Cloudinary fetch
121
+ const watermarkedUrl = `${cloudinaryFetchBase}/${transformation}/${imageUrl}`;
122
+ return {
123
+ success: true,
124
+ originalUrl: imageUrl,
125
+ watermarkedUrl: watermarkedUrl,
126
+ watermarkType: watermarkType,
127
+ position: gravityPosition,
128
+ opacity: opacityValue,
129
+ };
130
+ });
131
+ },
132
+ });
133
+ //# sourceMappingURL=add-watermark.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add-watermark.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/custom/skai-watermark/src/lib/actions/add-watermark.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,uCAAwE;AAE3D,QAAA,YAAY,GAAG,IAAA,+BAAY,EAAC;IACrC,IAAI,EAAE,yBAAiB;IACvB,IAAI,EAAE,eAAe;IACrB,WAAW,EAAE,oBAAoB;IACjC,WAAW,EAAE,kDAAkD;IAC/D,KAAK,EAAE;QACH,QAAQ,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACzB,WAAW,EAAE,WAAW;YACxB,WAAW,EAAE,+BAA+B;YAC5C,QAAQ,EAAE,IAAI;SACjB,CAAC;QACF,aAAa,EAAE,2BAAQ,CAAC,cAAc,CAAC;YACnC,WAAW,EAAE,gBAAgB;YAC7B,WAAW,EAAE,qDAAqD;YAClE,QAAQ,EAAE,IAAI;YACd,YAAY,EAAE,MAAM;YACpB,OAAO,EAAE;gBACL,OAAO,EAAE;oBACL,EAAE,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,EAAE;oBAC1C,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,OAAO,EA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