@activepieces/piece-text-helper 0.2.7 → 0.4.0
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 +11 -10
- package/src/index.js +3 -0
- package/src/index.js.map +1 -1
- package/src/lib/actions/default-value.d.ts +4 -0
- package/src/lib/actions/default-value.js +42 -0
- package/src/lib/actions/default-value.js.map +1 -0
- package/src/lib/actions/html-to-markdown.d.ts +0 -1
- package/src/lib/actions/html-to-markdown.js +4 -19
- package/src/lib/actions/html-to-markdown.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,28 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@activepieces/piece-text-helper",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"dependencies": {
|
|
5
|
-
"@anthropic-ai/sdk": "0.
|
|
6
|
-
"@sinclair/typebox": "0.
|
|
7
|
-
"axios": "1.7.
|
|
5
|
+
"@anthropic-ai/sdk": "0.33.1",
|
|
6
|
+
"@sinclair/typebox": "0.34.11",
|
|
7
|
+
"axios": "1.7.8",
|
|
8
8
|
"axios-retry": "4.4.1",
|
|
9
|
-
"deepmerge": "
|
|
10
|
-
"jsdom": "23.0.1",
|
|
9
|
+
"deepmerge-ts": "7.1.0",
|
|
11
10
|
"mime-types": "2.1.35",
|
|
12
|
-
"nanoid": "3.3.
|
|
11
|
+
"nanoid": "3.3.8",
|
|
13
12
|
"openai": "4.67.1",
|
|
14
13
|
"replicate": "0.34.1",
|
|
15
14
|
"semver": "7.6.0",
|
|
16
15
|
"showdown": "2.1.0",
|
|
17
16
|
"slugify": "1.6.6",
|
|
18
17
|
"string-strip-html": "8.5.0",
|
|
18
|
+
"turndown": "7.2.0",
|
|
19
19
|
"zod": "3.23.8",
|
|
20
|
-
"@activepieces/pieces-common": "0.
|
|
21
|
-
"@activepieces/pieces-framework": "0.7.
|
|
22
|
-
"@activepieces/shared": "0.10.
|
|
20
|
+
"@activepieces/pieces-common": "0.3.0",
|
|
21
|
+
"@activepieces/pieces-framework": "0.7.42",
|
|
22
|
+
"@activepieces/shared": "0.10.141",
|
|
23
23
|
"tslib": "1.14.1"
|
|
24
24
|
},
|
|
25
25
|
"overrides": {
|
|
26
|
+
"cross-spawn": "7.0.6",
|
|
26
27
|
"@tryfabric/martian": {
|
|
27
28
|
"@notionhq/client": "$@notionhq/client"
|
|
28
29
|
},
|
package/src/index.js
CHANGED
|
@@ -11,6 +11,7 @@ const replace_1 = require("./lib/actions/replace");
|
|
|
11
11
|
const split_1 = require("./lib/actions/split");
|
|
12
12
|
const strip_html_1 = require("./lib/actions/strip-html");
|
|
13
13
|
const slugify_1 = require("./lib/actions/slugify");
|
|
14
|
+
const default_value_1 = require("./lib/actions/default-value");
|
|
14
15
|
exports.textHelper = (0, pieces_framework_1.createPiece)({
|
|
15
16
|
displayName: 'Text Helper',
|
|
16
17
|
description: 'Tools for text processing',
|
|
@@ -24,6 +25,7 @@ exports.textHelper = (0, pieces_framework_1.createPiece)({
|
|
|
24
25
|
'AbdulTheActivePiecer',
|
|
25
26
|
'abuaboud',
|
|
26
27
|
'AdamSelene',
|
|
28
|
+
'Anmol-Gup',
|
|
27
29
|
],
|
|
28
30
|
categories: [shared_1.PieceCategory.CORE],
|
|
29
31
|
actions: [
|
|
@@ -35,6 +37,7 @@ exports.textHelper = (0, pieces_framework_1.createPiece)({
|
|
|
35
37
|
html_to_markdown_1.htmlToMarkdown,
|
|
36
38
|
strip_html_1.stripHtmlContent,
|
|
37
39
|
slugify_1.slugifyAction,
|
|
40
|
+
default_value_1.defaultValue,
|
|
38
41
|
],
|
|
39
42
|
triggers: [],
|
|
40
43
|
});
|
package/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/pieces/community/text-helper/src/index.ts"],"names":[],"mappings":";;;AAAA,qEAAwE;AACxE,iDAAqD;AACrD,iDAA8C;AAC9C,6CAA0C;AAC1C,qEAAgE;AAChE,qEAAgE;AAChE,mDAAgD;AAChD,+CAA4C;AAC5C,yDAA4D;AAC5D,mDAAsD;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/pieces/community/text-helper/src/index.ts"],"names":[],"mappings":";;;AAAA,qEAAwE;AACxE,iDAAqD;AACrD,iDAA8C;AAC9C,6CAA0C;AAC1C,qEAAgE;AAChE,qEAAgE;AAChE,mDAAgD;AAChD,+CAA4C;AAC5C,yDAA4D;AAC5D,mDAAsD;AACtD,+DAA2D;AAE9C,QAAA,UAAU,GAAG,IAAA,8BAAW,EAAC;IACpC,WAAW,EAAE,aAAa;IAC1B,WAAW,EAAE,2BAA2B;IACxC,IAAI,EAAE,4BAAS,CAAC,IAAI,EAAE;IACtB,uBAAuB,EAAE,QAAQ;IACjC,OAAO,EAAE,qDAAqD;IAC9D,OAAO,EAAE;QACP,YAAY;QACZ,YAAY;QACZ,WAAW;QACX,sBAAsB;QACtB,UAAU;QACV,YAAY;QACZ,WAAW;KACZ;IACD,UAAU,EAAE,CAAC,sBAAa,CAAC,IAAI,CAAC;IAChC,OAAO,EAAE;QACP,eAAM;QACN,iBAAO;QACP,aAAK;QACL,WAAI;QACJ,iCAAc;QACd,iCAAc;QACd,6BAAgB;QAChB,uBAAa;QACb,4BAAY;KACb;IACD,QAAQ,EAAE,EAAE;CACb,CAAC,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const defaultValue: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").PieceAuthProperty, {
|
|
2
|
+
value: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
3
|
+
defaultString: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
}>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.defaultValue = 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
|
+
exports.defaultValue = (0, pieces_framework_1.createAction)({
|
|
8
|
+
// auth: check https://www.activepieces.com/docs/developers/piece-reference/authentication,
|
|
9
|
+
name: 'defaultValue',
|
|
10
|
+
errorHandlingOptions: {
|
|
11
|
+
continueOnFailure: {
|
|
12
|
+
hide: true,
|
|
13
|
+
},
|
|
14
|
+
retryOnFailure: {
|
|
15
|
+
hide: true,
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
displayName: 'Use Default Value if Input is Empty',
|
|
19
|
+
description: 'Checks your input and returns the default value, if the input is an empty text or list',
|
|
20
|
+
props: {
|
|
21
|
+
value: pieces_framework_1.Property.ShortText({
|
|
22
|
+
displayName: 'Enter value',
|
|
23
|
+
description: 'Enter value',
|
|
24
|
+
required: false,
|
|
25
|
+
}),
|
|
26
|
+
defaultString: pieces_framework_1.Property.ShortText({
|
|
27
|
+
displayName: 'Default Value',
|
|
28
|
+
required: true,
|
|
29
|
+
}),
|
|
30
|
+
},
|
|
31
|
+
run(context) {
|
|
32
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
33
|
+
// Action logic here
|
|
34
|
+
const { value, defaultString } = context.propsValue;
|
|
35
|
+
if ((0, shared_1.isEmpty)(value)) {
|
|
36
|
+
return defaultString;
|
|
37
|
+
}
|
|
38
|
+
return value;
|
|
39
|
+
});
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
//# sourceMappingURL=default-value.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default-value.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/text-helper/src/lib/actions/default-value.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,iDAA+C;AAElC,QAAA,YAAY,GAAG,IAAA,+BAAY,EAAC;IACvC,2FAA2F;IAC3F,IAAI,EAAE,cAAc;IACpB,oBAAoB,EAAE;QACpB,iBAAiB,EAAE;YACjB,IAAI,EAAE,IAAI;SACX;QACD,cAAc,EAAE;YACd,IAAI,EAAE,IAAI;SACX;KACF;IACD,WAAW,EAAE,qCAAqC;IAClD,WAAW,EACT,wFAAwF;IAC1F,KAAK,EAAE;QACL,KAAK,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACxB,WAAW,EAAE,aAAa;YAC1B,WAAW,EAAE,aAAa;YAC1B,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,aAAa,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAChC,WAAW,EAAE,eAAe;YAC5B,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,oBAAoB;YACpB,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YACpD,IAAI,IAAA,gBAAO,EAAC,KAAK,CAAC,EAAE,CAAC;gBACnB,OAAO,aAAa,CAAC;YACvB,CAAC;YACD,OAAO,KAAK,CAAC;QACf,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
export declare const htmlToMarkdown: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").PieceAuthProperty, {
|
|
2
2
|
html: import("@activepieces/pieces-framework").LongTextProperty<true>;
|
|
3
|
-
flavor: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
4
3
|
}>;
|
|
@@ -3,8 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.htmlToMarkdown = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
-
const
|
|
7
|
-
const jsdom_1 = require("jsdom");
|
|
6
|
+
const turndown_1 = tslib_1.__importDefault(require("turndown"));
|
|
8
7
|
exports.htmlToMarkdown = (0, pieces_framework_1.createAction)({
|
|
9
8
|
name: 'html_to_markdown',
|
|
10
9
|
displayName: 'HTML to Markdown',
|
|
@@ -23,26 +22,12 @@ exports.htmlToMarkdown = (0, pieces_framework_1.createAction)({
|
|
|
23
22
|
description: 'The HTML to convert to markdown',
|
|
24
23
|
required: true,
|
|
25
24
|
}),
|
|
26
|
-
flavor: pieces_framework_1.Property.StaticDropdown({
|
|
27
|
-
displayName: 'Flavor of Markdown',
|
|
28
|
-
description: 'The flavor of markdown use during conversion',
|
|
29
|
-
required: true,
|
|
30
|
-
defaultValue: 'vanilla',
|
|
31
|
-
options: {
|
|
32
|
-
options: [
|
|
33
|
-
{ label: 'Default', value: 'vanilla' },
|
|
34
|
-
{ label: 'Original', value: 'original' },
|
|
35
|
-
{ label: 'GitHub', value: 'github' },
|
|
36
|
-
],
|
|
37
|
-
},
|
|
38
|
-
}),
|
|
39
25
|
},
|
|
40
26
|
run: (context) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
41
27
|
const html = context.propsValue.html;
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
return converter.makeMarkdown(html, doc.window.document);
|
|
28
|
+
const service = new turndown_1.default();
|
|
29
|
+
service.remove('script');
|
|
30
|
+
return service.turndown(html);
|
|
46
31
|
}),
|
|
47
32
|
});
|
|
48
33
|
//# sourceMappingURL=html-to-markdown.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"html-to-markdown.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/text-helper/src/lib/actions/html-to-markdown.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,
|
|
1
|
+
{"version":3,"file":"html-to-markdown.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/text-helper/src/lib/actions/html-to-markdown.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,gEAAuC;AAE1B,QAAA,cAAc,GAAG,IAAA,+BAAY,EAAC;IACzC,IAAI,EAAE,kBAAkB;IACxB,WAAW,EAAE,kBAAkB;IAC/B,WAAW,EAAE,0BAA0B;IACvC,oBAAoB,EAAE;QACpB,iBAAiB,EAAE;YACjB,IAAI,EAAE,IAAI;SACX;QACD,cAAc,EAAE;YACd,IAAI,EAAE,IAAI;SACX;KACF;IACD,KAAK,EAAE;QACL,IAAI,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YACtB,WAAW,EAAE,cAAc;YAC3B,WAAW,EAAE,iCAAiC;YAC9C,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IACD,GAAG,EAAE,CAAO,OAAO,EAAE,EAAE;QACrB,MAAM,IAAI,GAAG,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC;QACrC,MAAM,OAAO,GAAG,IAAI,kBAAe,EAAE,CAAC;QACtC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QACzB,OAAO,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC,CAAA;CACF,CAAC,CAAC"}
|